Attack predictions: fix for chance of being unscathed
The probabilities being combined here are additive, not multiplicative. The two terms in the equations are the probabilities that either unit in a fight is already dead before the strike currently being evaluated. As a result, this only affected fights in which both units can die before the last round of combat. It also only affected the chance of being unscathed, the HP distributions shown were correct. This fixes #6590.
This commit is contained in:
parent
e8edb5e48c
commit
81ccaa2cd6
1 changed files with 2 additions and 2 deletions
|
@ -2115,7 +2115,7 @@ void complex_fight(attack_prediction_mode mode,
|
|||
double first_hit = hit_chance * opp_hit_unknown;
|
||||
opp_hit += first_hit;
|
||||
opp_hit_unknown -= first_hit;
|
||||
double both_were_alive = (1.0 - b_already_dead) * (1.0 - pm->dead_prob_a());
|
||||
double both_were_alive = 1.0 - b_already_dead - pm->dead_prob_a();
|
||||
double this_hit_killed_b = both_were_alive != 0.0 ? (pm->dead_prob_b() - b_already_dead) / both_were_alive : 1.0;
|
||||
self_hit_unknown *= (1.0 - this_hit_killed_b);
|
||||
}
|
||||
|
@ -2128,7 +2128,7 @@ void complex_fight(attack_prediction_mode mode,
|
|||
double first_hit = opp_hit_chance * self_hit_unknown;
|
||||
self_hit += first_hit;
|
||||
self_hit_unknown -= first_hit;
|
||||
double both_were_alive = (1.0 - a_already_dead) * (1.0 - pm->dead_prob_b());
|
||||
double both_were_alive = 1.0 - a_already_dead - pm->dead_prob_b();
|
||||
double this_hit_killed_a = both_were_alive != 0.0 ? (pm->dead_prob_a() - a_already_dead) / both_were_alive : 1.0;
|
||||
opp_hit_unknown *= (1.0 - this_hit_killed_a);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue