#include <attack_predictions.hpp>
Classes | |
struct | combatant_data |
Public Member Functions | |
attack_predictions (battle_context &bc, unit_const_ptr attacker, unit_const_ptr defender) | |
![]() | |
modal_dialog () | |
virtual | ~modal_dialog () |
bool | show (const unsigned auto_close_time=0) |
Shows the window. More... | |
window * | get_window () const |
Returns a pointer to the dialog's window. More... | |
int | get_retval () const |
Returns the cached window exit code. More... | |
void | set_retval (int retval) |
Convenience wrapper to set the window's exit code. More... | |
void | set_always_save_fields (const bool always_save_fields) |
void | set_restore (const bool restore) |
void | set_allow_plugin_skip (const bool allow_plugin_skip) |
void | set_show_even_without_video (const bool show_even_without_video) |
Private Member Functions | |
virtual const std::string & | window_id () const override |
Inherited from modal_dialog, implemented by REGISTER_DIALOG. More... | |
virtual void | pre_show (window &window) override |
Inherited from modal_dialog. More... | |
void | set_data (window &window, const combatant_data &attacker, const combatant_data &defender) const |
hp_probability_vector | get_hitpoint_probabilities (const std::vector< double > &hp_dist) const |
void | draw_hp_graph (drawing &hp_graph, const combatant_data &attacker, const combatant_data &defender) const |
Private Attributes | |
combatant_data | attacker_data_ |
combatant_data | defender_data_ |
Static Private Attributes | |
static const unsigned int | graph_width = 270 |
static const unsigned int | graph_height = 170 |
static const unsigned int | graph_max_rows = 10 |
Additional Inherited Members | |
![]() | |
field_bool * | register_bool (const std::string &id, const bool mandatory, const std::function< bool()> callback_load_value=nullptr, const std::function< void(bool)> callback_save_value=nullptr, const std::function< void(widget &)> callback_change=nullptr, const bool initial_fire=false) |
Creates a new boolean field. More... | |
field_bool * | register_bool (const std::string &id, const bool mandatory, bool &linked_variable, const std::function< void(widget &)> callback_change=nullptr, const bool initial_fire=false) |
Creates a new boolean field. More... | |
field_integer * | register_integer (const std::string &id, const bool mandatory, const std::function< int()> callback_load_value=nullptr, const std::function< void(int)> callback_save_value=nullptr) |
Creates a new integer field. More... | |
field_integer * | register_integer (const std::string &id, const bool mandatory, int &linked_variable) |
Creates a new integer field. More... | |
field_text * | register_text (const std::string &id, const bool mandatory, const std::function< std::string()> callback_load_value=nullptr, const std::function< void(const std::string &)> callback_save_value=nullptr, const bool capture_focus=false) |
Creates a new text field. More... | |
field_text * | register_text (const std::string &id, const bool mandatory, std::string &linked_variable, const bool capture_focus=false) |
Creates a new text field. More... | |
field_label * | register_label (const std::string &id, const bool mandatory, const std::string &text, const bool use_markup=false) |
Registers a new styled_widget as a label. More... | |
field_label * | register_image (const std::string &id, const bool mandatory, const std::string &filename) |
Registers a new styled_widget as image. More... | |
![]() | |
std::unique_ptr< window > | window_ |
The window object build for this dialog. More... | |
Definition at line 34 of file attack_predictions.hpp.
gui2::dialogs::attack_predictions::attack_predictions | ( | battle_context & | bc, |
unit_const_ptr | attacker, | ||
unit_const_ptr | defender | ||
) |
Definition at line 51 of file attack_predictions.cpp.
|
private |
Definition at line 272 of file attack_predictions.cpp.
References config::add_child(), gui2::drawing::append_drawing_data(), config::clear(), gui2::dialogs::attack_predictions::combatant_data::combatant_, gui2::drawing::get_drawing_canvas(), get_hitpoint_probabilities(), gui2::dialogs::get_probability_string(), graph_width, battle_context_unit_stats::hp, combatant::hp_dist, i, battle_context_unit_stats::petrifies, gui2::canvas::set_variable(), font::SIZE_SMALL, gui2::dialogs::attack_predictions::combatant_data::stats_, and color_t::to_rgba_string().
Referenced by set_data().
|
private |
Definition at line 372 of file attack_predictions.cpp.
References graph_max_rows, i, and sort().
Referenced by draw_hp_graph().
|
overrideprivatevirtual |
Inherited from modal_dialog.
Reimplemented from gui2::dialogs::modal_dialog.
Definition at line 57 of file attack_predictions.cpp.
References attacker_data_, defender_data_, and set_data().
|
private |
Definition at line 76 of file attack_predictions.cpp.
References _(), unit_abilities::ADD, unit::alignment(), battle_context_unit_stats::backstab_pos, font::bad_dmg_color, battle_context_unit_stats::chance_to_hit, combat_modifier(), gui2::dialogs::attack_predictions::combatant_data::combatant_, battle_context_unit_stats::damage, draw_hp_graph(), e, resources::gameboard, unit::get_location(), gui2::dialogs::get_probability_string(), font::good_dmg_color, gui2::widget::invisible, battle_context_unit_stats::is_attacker, unit::is_fearless(), battle_context_unit_stats::is_slowed, unit_abilities::MUL, battle_context_unit_stats::num_blows, game_config::red_to_green(), unit_abilities::SET, utils::signed_percent(), font::span_color(), gui2::dialogs::attack_predictions::combatant_data::stats_, string_table, under_leadership(), font::unicode_multiplication_sign, gui2::dialogs::attack_predictions::combatant_data::unit_, combatant::untouched, battle_context_unit_stats::weapon, font::weapon_color, and font::weapon_numbers_sep.
Referenced by pre_show().
|
overrideprivatevirtual |
Inherited from modal_dialog, implemented by REGISTER_DIALOG.
Implements gui2::dialogs::modal_dialog.
|
private |
Definition at line 72 of file attack_predictions.hpp.
Referenced by pre_show().
|
private |
Definition at line 73 of file attack_predictions.hpp.
Referenced by pre_show().
|
staticprivate |
Definition at line 67 of file attack_predictions.hpp.
|
staticprivate |
Definition at line 68 of file attack_predictions.hpp.
Referenced by get_hitpoint_probabilities().
|
staticprivate |
Definition at line 66 of file attack_predictions.hpp.
Referenced by draw_hp_graph().