The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Public Attributes | Private Attributes | Static Private Attributes | List of all members
combatant Struct Reference

All combat-related info. More...

#include <attack_prediction.hpp>

Public Member Functions

 combatant (const battle_context_unit_stats &u, const combatant *prev=nullptr)
 Construct a combatant. More...
 
 combatant (const combatant &that, const battle_context_unit_stats &u)
 Copy constructor. More...
 
 combatant (const combatant &that)=delete
 
combatantoperator= (const combatant &)=delete
 
void fight (combatant &opponent, bool levelup_considered=true)
 Simulate a fight! Can be called multiple times for cumulative calculations. More...
 
double average_hp (unsigned int healing=0) const
 What's the average hp (weighted average of hp_dist). More...
 

Public Attributes

std::vector< double > hp_dist
 Resulting probability distribution (might be not as large as max_hp) More...
 
double untouched
 Resulting chance we were not hit by this opponent (important if it poisons) More...
 
double poisoned
 Resulting chance we are poisoned. More...
 
double slowed
 Resulting chance we are slowed. More...
 

Private Attributes

const battle_context_unit_statsu_
 
std::array< std::vector
< double >, 2 > 
summary
 Summary of matrix used to calculate last battle (unslowed & slowed). More...
 

Static Private Attributes

static const unsigned int MONTE_CARLO_SIMULATION_THRESHOLD = 50000u
 

Detailed Description

All combat-related info.

Definition at line 27 of file attack_prediction.hpp.

Constructor & Destructor Documentation

combatant::combatant ( const battle_context_unit_stats u,
const combatant prev = nullptr 
)
combatant::combatant ( const combatant that,
const battle_context_unit_stats u 
)

Copy constructor.

Definition at line 1701 of file attack_prediction.cpp.

References summary.

combatant::combatant ( const combatant that)
delete

Member Function Documentation

double combatant::average_hp ( unsigned int  healing = 0) const
void combatant::fight ( combatant opponent,
bool  levelup_considered = true 
)
combatant& combatant::operator= ( const combatant )
delete

Member Data Documentation

std::vector<double> combatant::hp_dist

Resulting probability distribution (might be not as large as max_hp)

Definition at line 42 of file attack_prediction.hpp.

Referenced by ai::attack_analysis::analyze(), battle_context::better_combat(), combatant(), gui2::dialogs::attack_predictions::draw_hp_graph(), fight(), luaW_pushsimdata(), and unit_weapons().

const unsigned int combatant::MONTE_CARLO_SIMULATION_THRESHOLD = 50000u
staticprivate

Definition at line 63 of file attack_prediction.hpp.

Referenced by fight().

double combatant::poisoned
double combatant::slowed

Resulting chance we are slowed.

Definition at line 51 of file attack_prediction.hpp.

Referenced by combatant(), fight(), and luaW_pushsimdata().

std::array<std::vector<double>, 2> combatant::summary
private

Summary of matrix used to calculate last battle (unslowed & slowed).

Invariant: summary[1].size() == summary[0].size() or summary[1].empty()

Definition at line 69 of file attack_prediction.hpp.

Referenced by combatant(), and fight().

const battle_context_unit_stats& combatant::u_
private

Definition at line 65 of file attack_prediction.hpp.

Referenced by average_hp(), and fight().

double combatant::untouched

Resulting chance we were not hit by this opponent (important if it poisons)

Definition at line 45 of file attack_prediction.hpp.

Referenced by combatant(), fight(), luaW_pushsimdata(), and gui2::dialogs::attack_predictions::set_data().


The documentation for this struct was generated from the following files: