The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
attack_predictions.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2010 - 2025
3 by Mark de Wever <koraq@xs4all.nl>
4 Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY.
12
13 See the COPYING file for more details.
14*/
15
16#pragma once
17
18#include "actions/attack.hpp"
20#include "units/ptr.hpp"
21
22#include <string>
23
24class battle_context;
25
27struct combatant;
28
29namespace gui2
30{
31class drawing;
32
33namespace dialogs
34{
35using hp_probability_vector = std::vector<std::pair<int, double>>;
36
38{
39public:
41
43
44 static std::string rng_mode_name();
45
46 static std::string rng_mode_tooltip();
47
48private:
49 virtual const std::string& window_id() const override;
50
51 virtual void pre_show() override;
52
66
67 void set_data(const combatant_data& attacker, const combatant_data& defender);
68
69 hp_probability_vector get_hitpoint_probabilities(const std::vector<double>& hp_dist) const;
70
71 static const unsigned int graph_width;
72 static const unsigned int graph_height;
73 static const unsigned int graph_max_rows;
74
75 void draw_hp_graph(drawing& hp_graph, const combatant_data& attacker, const combatant_data& defender);
76
79};
80
81} // namespace dialogs
82} // namespace gui2
Various functions that implement attacks and attack calculations.
Computes the statistics of a battle between an attacker and a defender unit.
Definition attack.hpp:183
static const unsigned int graph_width
void draw_hp_graph(drawing &hp_graph, const combatant_data &attacker, const combatant_data &defender)
static const unsigned int graph_height
void set_data(const combatant_data &attacker, const combatant_data &defender)
virtual const std::string & window_id() const override
The ID of the window to build.
static const unsigned int graph_max_rows
virtual void pre_show() override
Actions to be taken before showing the window.
hp_probability_vector get_hitpoint_probabilities(const std::vector< double > &hp_dist) const
Abstract base class for all modal dialogs.
This class represents a single unit of a specific type.
Definition unit.hpp:39
#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
Generic file dialog.
std::shared_ptr< const unit > unit_const_ptr
Definition ptr.hpp:27
Structure describing the statistics of a unit involved in the battle.
Definition attack.hpp:72
All combat-related info.
combatant_data(unit_const_ptr unit, const combatant &combatant, const battle_context_unit_stats &stats)