public virtual void GetAttacked(AttackParams attack) { equipment.Protect(attack); body.TakeAttack(attack); GotAttacked(this, new AttackedEventArgs(attack.attacker)); CheckForDeath(); }
public void TakeAttack(AttackParams attack) { if (attack.EperSquare >= (Health / Area)) { isDead = true; } else { AddInjury(); } TakeEnergyHit(attack); }
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); } } }
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); }
public AttackAction(AttackParams attackParams) : base() { this.attackParams = attackParams; }
public virtual void Attack(Character target, AttackParams attackParams) { attackParams.attacker = this; target.GetAttacked(attackParams); }