/// <summary> /// Actual attack logic once a target is selected. /// </summary> /// <param name="target"></param> public void OnAttack(Character target) { if (Constants.Random.Next(1, 101) < minion.Accuracy) { int damage = minion.AttackPower - target.Defence; if (damage <= 0) damage = 1; target.CurrentHealth -= damage; } screenInstance.SelectTarget = false; }
public virtual void UseItem(Character target) { if (this.EffectType == EffectType.Instant) { //Apply effects ApplyTo(target); //Reset max mana and health if they overflowed. if (target.CurrentMana > target.MaxMana) target.CurrentMana = target.MaxMana; if (target.CurrentHealth > target.MaxHealth) target.CurrentHealth = target.MaxHealth; Quantity--; } else if (this.EffectType == EffectType.Timed) { //Timed logic goes here. } }
public virtual void InterpetCommands(string[] commandArguments, Character target) { }
/// <summary> /// Applies item effect /// </summary> /// <param name="target"></param> /// <param name="item"></param> public void OnItem(Character target, string itemName) { Consumable item = (Consumable) minion.Inventory.GetItem(itemName); item.UseItem(target); minion.Inventory.CheckConsistency(); screenInstance.ItemSelectionBox.UnloadContent(); screenInstance.ItemSelectionBox = new ListBox(minion.Inventory.Consumables); screenInstance.CommandSequence = new string[screenInstance.CommandSequence.Length]; screenInstance.SelectTarget = false; }
/// <summary> /// Interprets the result of commands that require additional exteranl input. /// </summary> /// <param name="commandSequnce"></param> /// <param name="target"></param> public override void InterpetCommands(string[] commandSequnce, Character target) { if (commandSequnce[0] == "Attack") OnAttack(target); else if (commandSequnce[0] == "Skill") OnSkill(target, commandSequnce[1]) ; else if (commandSequnce[0] == "Item") OnItem(target, commandSequnce[1]) ; }
/// <summary> /// Not yet implemented /// </summary> /// <param name="target"></param> /// <param name="skill"></param> public void OnSkill(Character target, string skill) { //Skill effect here. (pop actual skill effect - would involve target selection) }