public UnitCombatResults EstimateMeleeAttackResults(IUnit attacker, IUnit defender, IHexCell location) { if (attacker == null) { throw new ArgumentNullException("attacker"); } if (defender == null) { throw new ArgumentNullException("defender"); } if (location == null) { throw new ArgumentNullException("location"); } var combatInfo = CombatInfoLogic.GetAttackInfo(attacker, defender, location, CombatType.Melee); Tuple <int, int> results = CombatCalculator.CalculateCombat(attacker, defender, combatInfo); return(new UnitCombatResults(attacker, defender, results.Item1, results.Item2, combatInfo)); }
public void PerformCommonCombatTasks(IUnit attacker, IUnit defender, CombatInfo combatInfo) { Tuple <int, int> results = CombatCalculator.CalculateCombat(attacker, defender, combatInfo); attacker.CurrentHitpoints -= results.Item1; defender.CurrentHitpoints -= results.Item2; foreach (var responder in PostCombatResponders) { responder.RespondToCombat(attacker, defender, combatInfo); } attacker.CanAttack = attacker.CombatSummary.CanAttackAfterAttacking; }