private void CreateAttackFact(ICharacterInTeam attacker, ICharacterInTeam defender, int actionCounter) { var newHp = CalculateNewHp(attacker, defender); actions.Add(new FightAction { Action_Order = actionCounter, Attacker_ID = attacker.getID(), Attacker_Position = attacker.GetPosition(), Defender_ID = defender.getID(), Defender_Position = defender.GetPosition(), Defender_New_Hp = newHp, Attacker_DMG_dealt = defender.getHp() - newHp }); defender.setNewHP(newHp); }
private int CalculateNewHp(ICharacterInTeam attacker, ICharacterInTeam defender) { int damage = CalculateDamage(attacker, defender); return(defender.getHp() < damage ? 0 : defender.getHp() - damage); }