43 virtual const std::string&
window_id()
const override;
Various functions that implement attacks and attack calculations.
Computes the statistics of a battle between an attacker and a defender unit.
void draw_hp_graph(drawing &hp_graph, const combatant_data &attacker, const combatant_data &defender) const
static const unsigned int graph_width
attack_predictions(battle_context &bc, unit_const_ptr attacker, unit_const_ptr defender)
void set_data(window &window, const combatant_data &attacker, const combatant_data &defender) const
static const unsigned int graph_height
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
static const unsigned int graph_max_rows
virtual const std::string & window_id() const override
The ID of the window to build.
combatant_data attacker_data_
hp_probability_vector get_hitpoint_probabilities(const std::vector< double > &hp_dist) const
combatant_data defender_data_
Abstract base class for all modal dialogs.
A drawing is widget with a fixed size and gives access to the canvas of the widget in the window inst...
base class of top level items, the only item which needs to store the final canvases to draw on.
This class represents a single unit of a specific type.
#define DEFINE_SIMPLE_DISPLAY_WRAPPER(dialog)
Adds a bare-bones static display function to a dialog class that immediately invokes the dialogs's mo...
Various uncategorised dialogs.
std::vector< std::pair< int, double > > hp_probability_vector
std::shared_ptr< const unit > unit_const_ptr
Structure describing the statistics of a unit involved in the battle.
combatant_data(unit_const_ptr unit, const combatant &combatant, const battle_context_unit_stats &stats)
const battle_context_unit_stats & stats_
unit_const_ptr unit_
never null
const combatant & combatant_