public CombatEventArgs(Entity attacker, Entity defender, Entity weapon, BodyComponent.Appendage bp, CombatEventResult result = CombatEventResult.Miss, int damage = 0, int damageResisted = 0, int damageTaken = 0) { Attacker = attacker; Defender = defender; Weapon = weapon; BodyPart = bp; Result = result; Damage = damage; DamageResisted = damageResisted; DamageTaken = damageTaken; }
protected AttackAction(Entity attacker, Entity defender, Entity weapon, BodyComponent.Appendage bodyPartTargetted, bool targettingPenalty) : base(attacker) { Contract.Requires <ArgumentNullException>(attacker != null, "attacker"); Contract.Requires <ArgumentNullException>(weapon != null, "weapon"); Contract.Requires <ArgumentNullException>(defender != null, "defender"); Contract.Requires <ArgumentNullException>(bodyPartTargetted != null, "bodyPartTargetted"); Contract.Requires <ArgumentException>(attacker.Has <ControllerComponent>(), "attacker doesn't have a location"); Contract.Requires <ArgumentException>(attacker.Has <GameObject>(), "attacker doesn't have a location"); Contract.Requires <ArgumentException>(defender.Has <BodyComponent>(), "defender cannot be attacked"); Contract.Requires <ArgumentException>(defender.Has <GameObject>(), "defender doesn't have a location"); Contract.Requires <ArgumentException>(defender.Get <BodyComponent>() == bodyPartTargetted.Owner, "defender does not contain supplied body part"); Contract.Requires <ArgumentException>(defender.Get <GameObject>().Level == attacker.Get <GameObject>().Level, "attacker is not on the same level as defender"); Contract.Requires <ArgumentException>(defender.Id == bodyPartTargetted.Owner.OwnerUId); Defender = defender; Weapon = weapon; BodyPartTargetted = bodyPartTargetted; TargettingPenalty = targettingPenalty; }
public RangeAttackAction(Entity attacker, Entity defender, Entity weapon, BodyComponent.Appendage bodyPartTargetted, bool targettingPenalty = false) : base(attacker, defender, weapon, bodyPartTargetted, targettingPenalty) { Contract.Requires <ArgumentException>(weapon.Has <RangeComponent>(), "weapon cannot range attack"); }
public static void Heal(BodyComponent.Appendage bodyPart, int amount) { amount = Math.Min(amount, bodyPart.Owner.Health.MaximumValue - bodyPart.Owner.Health); bodyPart.Owner.Health.Value += amount; Logger.DebugFormat("{0} was healed {1} health", bodyPart.Owner.OwnerUId, amount); }