Exemple #1
0
        public virtual void GetAttacked(AttackParams attack)
        {
            equipment.Protect(attack);

            body.TakeAttack(attack);

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

            CheckForDeath();
        }
Exemple #2
0
 public void TakeAttack(AttackParams attack)
 {
     if (attack.EperSquare >= (Health / Area))
     {
         isDead = true;
     }
     else
     {
         AddInjury();
     }
     TakeEnergyHit(attack);
 }
Exemple #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);
         }
     }
 }
Exemple #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);
        }
Exemple #5
0
 public AttackAction(AttackParams attackParams) : base()
 {
     this.attackParams = attackParams;
 }
Exemple #6
0
        public virtual void Attack(Character target, AttackParams attackParams)
        {
            attackParams.attacker = this;

            target.GetAttacked(attackParams);
        }