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 | List of all members
battle_context_unit_stats Struct Reference

Structure describing the statistics of a unit involved in the battle. More...

#include <attack.hpp>

Public Member Functions

 battle_context_unit_stats (const unit &u, const map_location &u_loc, int u_attack_num, bool attacking, const unit &opp, const map_location &opp_loc, const_attack_ptr opp_weapon, const unit_map &units)
 
 battle_context_unit_stats (const unit_type *u_type, const_attack_ptr att_weapon, bool attacking, const unit_type *opp_type, const_attack_ptr opp_weapon, unsigned int opp_terrain_defense, int lawful_bonus=0)
 Used by AI for combat analysis. More...
 
 ~battle_context_unit_stats ()
 
unsigned int calc_blows (unsigned new_hp) const
 Calculates the number of blows we would have if we had new_hp. More...
 

Public Attributes

const_attack_ptr weapon
 The weapon used by the unit to attack the opponent, or nullptr if there is none. More...
 
int attack_num
 Index into unit->attacks() or -1 for none. More...
 
bool is_attacker
 True if the unit is the attacker. More...
 
bool is_poisoned
 True if the unit is poisoned at the beginning of the battle. More...
 
bool is_slowed
 True if the unit is slowed at the beginning of the battle. More...
 
bool slows
 Attack slows opponent when it hits. More...
 
bool drains
 Attack drains opponent when it hits. More...
 
bool petrifies
 Attack petrifies opponent when it hits. More...
 
bool plagues
 Attack turns opponent into a zombie when fatal. More...
 
bool poisons
 Attack poisons opponent when it hits. More...
 
bool backstab_pos
 True if the attacker is in position to backstab the defender (this is used to determine whether to apply the backstab bonus in case the attacker has backstab). More...
 
bool swarm
 Attack has swarm special. More...
 
bool firststrike
 Attack has firststrike special. More...
 
bool disable
 Attack has disable special. More...
 
unsigned int experience
 
unsigned int max_experience
 
unsigned int level
 
unsigned int rounds
 Berserk special can force us to fight more than one round. More...
 
unsigned int hp
 Hitpoints of the unit at the beginning of the battle. More...
 
unsigned int max_hp
 Maximum hitpoints of the unit. More...
 
unsigned int chance_to_hit
 Effective chance to hit as a percentage (all factors accounted for). More...
 
int damage
 Effective damage of the weapon (all factors accounted for). More...
 
int slow_damage
 Effective damage if unit becomes slowed (== damage, if already slowed) More...
 
int drain_percent
 Percentage of damage recovered as health. More...
 
int drain_constant
 Base HP drained regardless of damage dealt. More...
 
unsigned int num_blows
 Effective number of blows, takes swarm into account. More...
 
unsigned int swarm_min
 Minimum number of blows with swarm (equal to num_blows if swarm isn't used). More...
 
unsigned int swarm_max
 Maximum number of blows with swarm (equal to num_blows if swarm isn't used). More...
 
std::string plague_type
 The plague type used by the attack, if any. More...
 

Detailed Description

Structure describing the statistics of a unit involved in the battle.

Definition at line 47 of file attack.hpp.

Constructor & Destructor Documentation

battle_context_unit_stats::battle_context_unit_stats ( const unit u,
const map_location u_loc,
int  u_attack_num,
bool  attacking,
const unit opp,
const map_location opp_loc,
const_attack_ptr  opp_weapon,
const unit_map units 
)
battle_context_unit_stats::battle_context_unit_stats ( const unit_type u_type,
const_attack_ptr  att_weapon,
bool  attacking,
const unit_type opp_type,
const_attack_ptr  opp_weapon,
unsigned int  opp_terrain_defense,
int  lawful_bonus = 0 
)
battle_context_unit_stats::~battle_context_unit_stats ( )
inline

Definition at line 101 of file attack.hpp.

Member Function Documentation

unsigned int battle_context_unit_stats::calc_blows ( unsigned  new_hp) const
inline

Calculates the number of blows we would have if we had new_hp.

Definition at line 107 of file attack.hpp.

References swarm_blows().

Referenced by battle_context_unit_stats().

Member Data Documentation

int battle_context_unit_stats::attack_num
bool battle_context_unit_stats::backstab_pos

True if the attacker is in position to backstab the defender (this is used to determine whether to apply the backstab bonus in case the attacker has backstab).

Definition at line 59 of file attack.hpp.

Referenced by battle_context_unit_stats(), luaW_pushsimweapon(), and gui2::dialogs::attack_predictions::set_data().

unsigned int battle_context_unit_stats::chance_to_hit
int battle_context_unit_stats::damage
bool battle_context_unit_stats::disable

Attack has disable special.

Definition at line 65 of file attack.hpp.

Referenced by battle_context_unit_stats(), and battle_context::choose_defender_weapon().

int battle_context_unit_stats::drain_constant

Base HP drained regardless of damage dealt.

Definition at line 76 of file attack.hpp.

Referenced by battle_context_unit_stats(), and luaW_pushsimweapon().

int battle_context_unit_stats::drain_percent

Percentage of damage recovered as health.

Definition at line 75 of file attack.hpp.

Referenced by battle_context_unit_stats(), and luaW_pushsimweapon().

bool battle_context_unit_stats::drains

Attack drains opponent when it hits.

Definition at line 55 of file attack.hpp.

Referenced by battle_context_unit_stats(), and luaW_pushsimweapon().

unsigned int battle_context_unit_stats::experience

Definition at line 66 of file attack.hpp.

Referenced by combatant::fight().

bool battle_context_unit_stats::firststrike

Attack has firststrike special.

Definition at line 64 of file attack.hpp.

Referenced by battle_context_unit_stats(), combatant::fight(), and luaW_pushsimweapon().

unsigned int battle_context_unit_stats::hp

Hitpoints of the unit at the beginning of the battle.

Definition at line 70 of file attack.hpp.

Referenced by battle_context_unit_stats(), combatant::combatant(), and gui2::dialogs::attack_predictions::draw_hp_graph().

bool battle_context_unit_stats::is_attacker

True if the unit is the attacker.

Definition at line 51 of file attack.hpp.

Referenced by battle_context_unit_stats(), and gui2::dialogs::attack_predictions::set_data().

bool battle_context_unit_stats::is_poisoned

True if the unit is poisoned at the beginning of the battle.

Definition at line 52 of file attack.hpp.

Referenced by ai::attack_analysis::analyze(), and combatant::combatant().

bool battle_context_unit_stats::is_slowed

True if the unit is slowed at the beginning of the battle.

Definition at line 53 of file attack.hpp.

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

unsigned int battle_context_unit_stats::level
unsigned int battle_context_unit_stats::max_experience

Definition at line 66 of file attack.hpp.

Referenced by battle_context_unit_stats(), and combatant::fight().

unsigned int battle_context_unit_stats::max_hp

Maximum hitpoints of the unit.

Definition at line 71 of file attack.hpp.

Referenced by combatant::average_hp(), battle_context_unit_stats(), and combatant::combatant().

unsigned int battle_context_unit_stats::num_blows
bool battle_context_unit_stats::petrifies

Attack petrifies opponent when it hits.

Definition at line 56 of file attack.hpp.

Referenced by battle_context_unit_stats(), gui2::dialogs::attack_predictions::draw_hp_graph(), and luaW_pushsimweapon().

std::string battle_context_unit_stats::plague_type

The plague type used by the attack, if any.

Definition at line 81 of file attack.hpp.

Referenced by battle_context_unit_stats(), and luaW_pushsimweapon().

bool battle_context_unit_stats::plagues

Attack turns opponent into a zombie when fatal.

Definition at line 57 of file attack.hpp.

Referenced by ai::attack_analysis::analyze(), battle_context_unit_stats(), and luaW_pushsimweapon().

bool battle_context_unit_stats::poisons

Attack poisons opponent when it hits.

Definition at line 58 of file attack.hpp.

Referenced by battle_context_unit_stats(), combatant::fight(), and luaW_pushsimweapon().

unsigned int battle_context_unit_stats::rounds

Berserk special can force us to fight more than one round.

Definition at line 69 of file attack.hpp.

Referenced by battle_context_unit_stats(), and luaW_pushsimweapon().

int battle_context_unit_stats::slow_damage

Effective damage if unit becomes slowed (== damage, if already slowed)

Definition at line 74 of file attack.hpp.

Referenced by battle_context_unit_stats().

bool battle_context_unit_stats::slows

Attack slows opponent when it hits.

Definition at line 54 of file attack.hpp.

Referenced by battle_context_unit_stats(), combatant::fight(), and luaW_pushsimweapon().

bool battle_context_unit_stats::swarm

Attack has swarm special.

Definition at line 63 of file attack.hpp.

Referenced by battle_context_unit_stats().

unsigned int battle_context_unit_stats::swarm_max

Maximum number of blows with swarm (equal to num_blows if swarm isn't used).

Definition at line 79 of file attack.hpp.

Referenced by battle_context_unit_stats().

unsigned int battle_context_unit_stats::swarm_min

Minimum number of blows with swarm (equal to num_blows if swarm isn't used).

Definition at line 78 of file attack.hpp.

Referenced by battle_context_unit_stats().

const_attack_ptr battle_context_unit_stats::weapon

The weapon used by the unit to attack the opponent, or nullptr if there is none.

Definition at line 49 of file attack.hpp.

Referenced by battle_context_unit_stats(), luaW_pushsimweapon(), gui2::dialogs::unit_attack::pre_show(), gui2::dialogs::attack_predictions::set_data(), and unit_weapons().


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