Пример #1
0
        public virtual void GetAttacked(AttackParams attack)
        {
            equipment.Protect(attack);

            body.TakeAttack(attack);

            GotAttacked(this, new AttackedEventArgs(attack.attacker));

            CheckForDeath();
        }
Пример #2
0
 public void TakeAttack(AttackParams attack)
 {
     if (attack.EperSquare >= (Health / Area))
     {
         isDead = true;
     }
     else
     {
         AddInjury();
     }
     TakeEnergyHit(attack);
 }
Пример #3
0
 public void TakeEnergyHit(AttackParams attack)
 {
     if (attack.E > Health)
     {
         isDead = true;
     }
     else
     {
         float damagePerBodyPart = attack.E / bodyParts.Count;
         foreach (var item in bodyParts)
         {
             item.TakeDamage(damagePerBodyPart / absorbationK);
         }
     }
 }
Пример #4
0
        public AttackParams Protect(AttackParams attack)
        {
            bool isPenetrated = true;

            foreach (var item in bodyEquipment)
            {
                if (!attack.IsActive)
                {
                    continue;
                }
                if (isPenetrated)
                {
                    isPenetrated = item.TryPenetrate(attack);
                }
                else
                {
                    item.AbsorbEnergy(attack);
                }
            }
            return(attack);
        }
Пример #5
0
 public AttackAction(AttackParams attackParams) : base()
 {
     this.attackParams = attackParams;
 }
Пример #6
0
        public virtual void Attack(Character target, AttackParams attackParams)
        {
            attackParams.attacker = this;

            target.GetAttacked(attackParams);
        }