Exemple #1
0
        protected void ProcessTargetSearch(Character currentCharacter)
        {
            var availableTargets = this.characterList
                .Where(t => this.IsWithinRange(currentCharacter.X, currentCharacter.Y, t.X, t.Y, currentCharacter.Range))
                .ToList();

            if (availableTargets.Count == 0)
            {
                return;
            }

            var target = currentCharacter.GetTarget(availableTargets);
            if (target == null)
            {
                return;
            }

            this.ProcessInteraction(currentCharacter, target);
        }
Exemple #2
0
 public void Heal(Character target)
 {
     this.Mana -= 100;
     target.Health += 150;
 }
Exemple #3
0
 public override void Attack(Character target)
 {
     this.Mana -= 100;
     target.Health -= this.Damage;
     this.Health += this.Damage / 10;
 }
 public override void Consume(Character ch)
 {
     ch.Health += this.RegenAmount; ;
 }
Exemple #5
0
 public override void Consume(Character ch)
 {
     ch.BeerBelly += 10;
 }
Exemple #6
0
 public override void Attack(Character target)
 {
     target.Health -= this.Damage;
 }
Exemple #7
0
 protected void ProcessInteraction(Character currentCharacter, Character target)
 {
     if (currentCharacter is IHeal)
     {
         target.HealthPoints += (currentCharacter as IHeal).HealingPoints;
     }
     else if (currentCharacter is IAttack)
     {
         target.HealthPoints -= (currentCharacter as IAttack).AttackPoints - target.DefensePoints;
         if (target.HealthPoints <= 0)
         {
             target.IsAlive = false;
         }
     }
 }
Exemple #8
0
 public override void Consume(Character ch)
 {
     ch.Life++;
 }
 private static void PrintInfo(Character mage, Character warrior, Character priest)
 {
     Console.WriteLine("{0}: {1}", mage.GetType().Name, mage.Health);
     Console.WriteLine("{0}: {1}", warrior.GetType().Name, warrior.Health);
     Console.WriteLine("{0}: {1}", priest.GetType().Name, priest.Health);
 }
 public abstract void Consume(Character ch);
Exemple #11
0
 public abstract void Attack(Character target);