Ignore healing due to levelup when computing damage statistics.
Fixes bug #13277. [[Split portion of a mixed commit.]]
This commit is contained in:
parent
a719d79b6b
commit
c198e81f25
3 changed files with 7 additions and 5 deletions
|
@ -958,7 +958,7 @@ attack::attack(game_display& gui, const gamemap& map,
|
|||
// Calculate stats for battle
|
||||
combatant attacker(bc_->get_attacker_stats());
|
||||
combatant defender(bc_->get_defender_stats());
|
||||
attacker.fight(defender);
|
||||
attacker.fight(defender,false);
|
||||
const double attacker_inflict = static_cast<double>(d_.get_unit().hitpoints()) - defender.average_hp();
|
||||
const double defender_inflict = static_cast<double>(a_.get_unit().hitpoints()) - attacker.average_hp();
|
||||
|
||||
|
|
|
@ -761,7 +761,7 @@ void combatant::consider_levelup(combatant &opp) {
|
|||
// Of course, one could be a woman. Or both.
|
||||
// And neither could be human, too.
|
||||
// Um, ok, it was a stupid thing to say.
|
||||
void combatant::fight(combatant &opp)
|
||||
void combatant::fight(combatant &opp, bool levelup_considered)
|
||||
{
|
||||
unsigned int rounds = std::max<unsigned int>(u_.rounds, opp.u_.rounds);
|
||||
|
||||
|
@ -837,8 +837,10 @@ void combatant::fight(combatant &opp)
|
|||
opp.hp_dist[i] = opp.summary[0][i] + opp.summary[1][i];
|
||||
}
|
||||
|
||||
consider_levelup(opp);
|
||||
opp.consider_levelup(*this);
|
||||
if(levelup_considered) {
|
||||
consider_levelup(opp);
|
||||
opp.consider_levelup(*this);
|
||||
}
|
||||
|
||||
// Make sure we don't try to access the vectors out of bounds,
|
||||
// drain increases HPs so we determine the number of HP here
|
||||
|
|
|
@ -33,7 +33,7 @@ struct combatant
|
|||
combatant(const combatant &that, const battle_context::unit_stats &u);
|
||||
|
||||
/** Simulate a fight! Can be called multiple times for cumulative calculations. */
|
||||
void fight(combatant &opponent);
|
||||
void fight(combatant &opponent, bool levelup_considered=true);
|
||||
|
||||
/** takes into account level up when calculating resulting HP after a fight */
|
||||
void consider_levelup(combatant &opponent);
|
||||
|
|
Loading…
Add table
Reference in a new issue