Пример #1
0
        public void ExecuteHeal(Character target)
        {
            if (this.Team != target.Team)
            {
                return;
            }
            else
            {
                if (target.IsAlive == false)
                {
                    return;
                }

                target.HealthPoints += this.HealingPoints;
            }
        }
        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);
        }
Пример #3
0
 public void ExecuteAttack(Character target)
 {
     if (this.AttackPoints > target.DefensePoints)
     {
         target.HealthPoints -= (this.AttackPoints - target.DefensePoints);
         target.DefensePoints = 0;
         if (target.HealthPoints < 0)
         {
             target.IsAlive = false;
         }
     }
     else if (this.AttackPoints < target.DefensePoints)
     {
         target.DefensePoints -= this.AttackPoints;
     }
     else
     {
         target.DefensePoints = 0;
     }
 }
Пример #4
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;
         }
     }
 }
Пример #5
0
 public Shield(string id, Character itemHolder)
     : base(id, BASE_HEALTH_EFFECT, BASE_DEFENCE_EFFECT, BASE_ATTACK_EFFECT, itemHolder)
 {
 }
Пример #6
0
 public Injection(string id, Character itemHolder)
     : base(id, BASE_HEALTH_EFFECT, BASE_DEFENCE_EFFECT, BASE_ATTACK_EFFECT, itemHolder)
 {
     this.HasTimedOut = false;
     this.Countdown = BASE_COUNTDOWN;
 }