The Battle for Wesnoth  1.13.4+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_type *opp_weapon, const unit_map &units)
 
 battle_context_unit_stats (const unit_type *u_type, const attack_type *att_weapon, bool attacking, const unit_type *opp_type, const attack_type *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_typeweapon
 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 49 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_type opp_weapon,
const unit_map units 
)
battle_context_unit_stats::battle_context_unit_stats ( const unit_type u_type,
const attack_type att_weapon,
bool  attacking,
const unit_type opp_type,
const attack_type opp_weapon,
unsigned int  opp_terrain_defense,
int  lawful_bonus = 0 
)
battle_context_unit_stats::~battle_context_unit_stats ( )
inline

Definition at line 98 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 103 of file attack.hpp.

References swarm_blows().

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

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 61 of file attack.hpp.

Referenced by battle_context_unit_stats(), battle_prediction_pane::get_unit_strings(), and luaW_pushsimweapon().

unsigned int battle_context_unit_stats::chance_to_hit
int battle_context_unit_stats::damage

Effective damage of the weapon (all factors accounted for).

Definition at line 75 of file attack.hpp.

Referenced by battle_context_unit_stats(), battle_context::choose_defender_weapon(), battle_prediction_pane::get_unit_strings(), luaW_pushsimweapon(), gui2::set_weapon_info(), and unit_weapons().

bool battle_context_unit_stats::disable

Attack has disable special.

Definition at line 67 of file attack.hpp.

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

int battle_context_unit_stats::drain_constant

Base HP drained regardless of damage dealt.

Definition at line 78 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 77 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 57 of file attack.hpp.

Referenced by battle_context_unit_stats(), and luaW_pushsimweapon().

unsigned int battle_context_unit_stats::experience

Definition at line 68 of file attack.hpp.

bool battle_context_unit_stats::firststrike

Attack has firststrike special.

Definition at line 66 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 72 of file attack.hpp.

Referenced by battle_context_unit_stats(), combatant::combatant(), and battle_prediction_pane::get_hp_distrib_surface().

bool battle_context_unit_stats::is_attacker

True if the unit is the attacker.

Definition at line 53 of file attack.hpp.

Referenced by battle_context_unit_stats(), and battle_prediction_pane::get_unit_strings().

bool battle_context_unit_stats::is_poisoned

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

Definition at line 54 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 55 of file attack.hpp.

Referenced by battle_context_unit_stats(), combatant::combatant(), and battle_prediction_pane::get_unit_strings().

unsigned int battle_context_unit_stats::level

Definition at line 69 of file attack.hpp.

Referenced by events::mouse_handler::attack_enemy_().

unsigned int battle_context_unit_stats::max_experience

Definition at line 68 of file attack.hpp.

Referenced by battle_context_unit_stats().

unsigned int battle_context_unit_stats::max_hp

Maximum hitpoints of the unit.

Definition at line 73 of file attack.hpp.

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

unsigned int battle_context_unit_stats::num_blows
bool battle_context_unit_stats::petrifies

Attack petrifies opponent when it hits.

Definition at line 58 of file attack.hpp.

Referenced by battle_context_unit_stats(), battle_prediction_pane::get_hp_distrib_surface(), and luaW_pushsimweapon().

std::string battle_context_unit_stats::plague_type

The plague type used by the attack, if any.

Definition at line 83 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 59 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 60 of file attack.hpp.

Referenced by battle_context_unit_stats(), and luaW_pushsimweapon().

unsigned int battle_context_unit_stats::rounds

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

Definition at line 71 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 76 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 56 of file attack.hpp.

Referenced by battle_context_unit_stats(), and luaW_pushsimweapon().

bool battle_context_unit_stats::swarm

Attack has swarm special.

Definition at line 65 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 81 of file attack.hpp.

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

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 80 of file attack.hpp.

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

const attack_type* battle_context_unit_stats::weapon

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

Definition at line 51 of file attack.hpp.

Referenced by battle_context_unit_stats(), battle_prediction_pane::battle_prediction_pane(), battle_prediction_pane::get_unit_strings(), luaW_pushsimweapon(), gui2::set_weapon_info(), and unit_weapons().


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