statistics_dialog: Change the percentages in the "Hits" table
Make the contents of the table cell the same regardless of whether actual<expected or actual>expected. For example, 2 hits out of 4 strikes at 70% now shows "8.4%, 26.5%, 65.1%", which are the probabilities of hitting less than twice, exactly twice, and more than twice, respectively. Color has been temporarily removed, will be restored in the next commit.
This commit is contained in:
parent
651615f979
commit
a932ebee58
2 changed files with 22 additions and 15 deletions
|
@ -565,7 +565,7 @@
|
|||
{_GUI_DAMAGE_STATS_LIST
|
||||
(_ "Hits") stats_list_hits hits_type hits_overall hits_this_turn
|
||||
(_"stats dialog^Number of hits (actual / expected)")
|
||||
(_"stats dialog^<i>A priori</i> probability of getting this result or a more extreme one")}
|
||||
(_"stats dialog^<i>A priori</i> probabilities of hitting less than, exactly, and more than the actual number of hits")}
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
|
|
@ -251,21 +251,28 @@ static hitrate_table_element tally(const statistics::stats::hitrate_map& by_cth)
|
|||
const std::vector<double>& final_hp_dist = current_defender->hp_dist;
|
||||
const auto& chance_of_exactly_N_hits = [&final_hp_dist](int n) { return final_hp_dist[final_hp_dist.size() - 1 - n]; };
|
||||
|
||||
double probability = 0.0;
|
||||
if(overall_hits == expected_hits) {
|
||||
probability = chance_of_exactly_N_hits(overall_hits);
|
||||
} else if (overall_hits > expected_hits) {
|
||||
for(unsigned int i = overall_hits; i < final_hp_dist.size(); ++i) {
|
||||
probability += chance_of_exactly_N_hits(i);
|
||||
}
|
||||
} else {
|
||||
for(unsigned int i = 0; i <= overall_hits; ++i) {
|
||||
probability += chance_of_exactly_N_hits(i);
|
||||
}
|
||||
double probability_lt = 0.0;
|
||||
for(unsigned int i = 0; i < overall_hits; ++i) {
|
||||
probability_lt += chance_of_exactly_N_hits(i);
|
||||
}
|
||||
double probability_eq = chance_of_exactly_N_hits(overall_hits);
|
||||
double probability_gt = 0.0;
|
||||
for(unsigned int i = final_hp_dist.size() - 1; i > overall_hits; --i) {
|
||||
probability_gt += chance_of_exactly_N_hits(i);
|
||||
}
|
||||
|
||||
if(overall_strikes == 0) {
|
||||
// Start of turn
|
||||
str2 << "0%";
|
||||
} else {
|
||||
// TODO: add coloring
|
||||
// TODO: document for users what these values are.
|
||||
str2 << get_probability_string(probability_lt);
|
||||
str2 << ", ";
|
||||
str2 << get_probability_string(probability_eq);
|
||||
str2 << ", ";
|
||||
str2 << get_probability_string(probability_gt);
|
||||
}
|
||||
// TODO: document for users what this value is.
|
||||
str2 << font::span_color(game_config::red_to_green(probability * 100.0, true))
|
||||
<< get_probability_string(probability) << "</span>";
|
||||
}
|
||||
|
||||
return hitrate_table_element{str.str(), str2.str()};
|
||||
|
|
Loading…
Add table
Reference in a new issue