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
ai::attack_analysis Class Reference

#include <contexts.hpp>

Inheritance diagram for ai::attack_analysis:
Inheritance graph

Public Member Functions

 attack_analysis ()
 
void analyze (const gamemap &map, unit_map &units, const readonly_context &ai_obj, const move_map &dstsrc, const move_map &srcdst, const move_map &enemy_dstsrc, double aggression)
 
double rating (double aggression, const readonly_context &ai_obj) const
 
variant get_value (const std::string &key) const
 
void get_inputs (std::vector< game_logic::formula_input > *inputs) const
 
bool attack_close (const map_location &loc) const
 
- Public Member Functions inherited from game_logic::formula_callable
 formula_callable (bool has_self=true)
 
variant query_value (const std::string &key) const
 
void mutate_value (const std::string &key, const variant &value)
 
std::vector< formula_inputinputs () const
 
bool equals (const formula_callable *other) const
 
bool less (const formula_callable *other) const
 
void serialize (std::string &str) const
 
bool has_key (const std::string &key) const
 
- Public Member Functions inherited from reference_counted_object
 reference_counted_object ()
 
 reference_counted_object (const reference_counted_object &)
 
reference_counted_objectoperator= (const reference_counted_object &)
 
virtual ~reference_counted_object ()
 
void add_ref () const
 
void dec_ref () const
 
int refcount () const
 

Public Attributes

map_location target
 
std::vector< std::pair
< map_location, map_location > > 
movements
 
double target_value
 The value of the unit being targeted. More...
 
double avg_losses
 The value on average, of units lost in the combat. More...
 
double chance_to_kill
 Estimated % chance to kill the unit. More...
 
double avg_damage_inflicted
 The average hitpoints damage inflicted. More...
 
int target_starting_damage
 
double avg_damage_taken
 The average hitpoints damage taken. More...
 
double resources_used
 The sum of the values of units used in the attack. More...
 
double terrain_quality
 The weighted average of the % chance to hit each attacking unit. More...
 
double alternative_terrain_quality
 The weighted average of the % defense of the best possible terrain that the attacking units could reach this turn, without attacking (good for comparison to see just how good/bad 'terrain_quality' is). More...
 
double vulnerability
 The vulnerability is the power projection of enemy units onto the hex we're standing on. More...
 
double support
 
bool leader_threat
 Is true if the unit is a threat to our leader. More...
 
bool uses_leader
 Is true if this attack sequence makes use of the leader. More...
 
bool is_surrounded
 Is true if the units involved in this attack sequence are surrounded. More...
 

Additional Inherited Members

- Protected Types inherited from game_logic::formula_callable
enum  TYPE {
  FORMULA_C, TERRAIN_C, LOCATION_C, UNIT_TYPE_C,
  UNIT_C, ATTACK_TYPE_C, MOVE_PARTIAL_C, MOVE_C,
  ATTACK_C, MOVE_MAP_C
}
 
- Protected Member Functions inherited from game_logic::formula_callable
virtual ~formula_callable ()
 
virtual void set_value (const std::string &key, const variant &value)
 
virtual int do_compare (const formula_callable *callable) const
 
virtual void serialize_to_string (std::string &) const
 
- Protected Member Functions inherited from reference_counted_object
void turn_reference_counting_off () const
 
- Protected Attributes inherited from game_logic::formula_callable
TYPE type_
 

Detailed Description

Definition at line 62 of file contexts.hpp.

Constructor & Destructor Documentation

ai::attack_analysis::attack_analysis ( )
inline

Definition at line 65 of file contexts.hpp.

Member Function Documentation

void ai::attack_analysis::analyze ( const gamemap map,
unit_map units,
const readonly_context ai_obj,
const move_map dstsrc,
const move_map srcdst,
const move_map enemy_dstsrc,
double  aggression 
)
bool ai::attack_analysis::attack_close ( const map_location loc) const

Definition at line 251 of file attack.cpp.

References distance_between(), ai::manager::get_ai_info(), i, and ai::game_info::recent_attacks.

Referenced by rating().

void ai::attack_analysis::get_inputs ( std::vector< game_logic::formula_input > *  inputs) const
virtual

Reimplemented from game_logic::formula_callable.

Definition at line 390 of file attack.cpp.

References game_logic::FORMULA_READ_ONLY.

variant ai::attack_analysis::get_value ( const std::string key) const
virtual
double ai::attack_analysis::rating ( double  aggression,
const readonly_context ai_obj 
) const

Member Data Documentation

double ai::attack_analysis::alternative_terrain_quality

The weighted average of the % defense of the best possible terrain that the attacking units could reach this turn, without attacking (good for comparison to see just how good/bad 'terrain_quality' is).

Definition at line 128 of file contexts.hpp.

Referenced by analyze(), get_value(), ai::push_attack_analysis(), and rating().

double ai::attack_analysis::avg_damage_inflicted

The average hitpoints damage inflicted.

Definition at line 110 of file contexts.hpp.

Referenced by analyze(), get_value(), ai::push_attack_analysis(), and rating().

double ai::attack_analysis::avg_damage_taken

The average hitpoints damage taken.

Definition at line 115 of file contexts.hpp.

Referenced by analyze(), get_value(), ai::push_attack_analysis(), and rating().

double ai::attack_analysis::avg_losses

The value on average, of units lost in the combat.

Definition at line 104 of file contexts.hpp.

Referenced by analyze(), get_value(), ai::push_attack_analysis(), and rating().

double ai::attack_analysis::chance_to_kill

Estimated % chance to kill the unit.

Definition at line 107 of file contexts.hpp.

Referenced by analyze(), get_value(), ai::push_attack_analysis(), and rating().

bool ai::attack_analysis::is_surrounded

Is true if the units involved in this attack sequence are surrounded.

Definition at line 143 of file contexts.hpp.

Referenced by ai::ai_default_rca::aspect_attacks_base::do_attack_analysis(), get_value(), ai::push_attack_analysis(), and rating().

bool ai::attack_analysis::leader_threat

Is true if the unit is a threat to our leader.

Definition at line 137 of file contexts.hpp.

Referenced by analyze(), get_value(), ai::push_attack_analysis(), and rating().

std::vector<std::pair<map_location,map_location> > ai::attack_analysis::movements
double ai::attack_analysis::resources_used

The sum of the values of units used in the attack.

Definition at line 118 of file contexts.hpp.

Referenced by analyze(), get_value(), ai::push_attack_analysis(), and rating().

double ai::attack_analysis::support
map_location ai::attack_analysis::target
int ai::attack_analysis::target_starting_damage

Definition at line 112 of file contexts.hpp.

Referenced by analyze(), get_value(), ai::push_attack_analysis(), and rating().

double ai::attack_analysis::target_value

The value of the unit being targeted.

Definition at line 101 of file contexts.hpp.

Referenced by analyze(), get_value(), ai::push_attack_analysis(), and rating().

double ai::attack_analysis::terrain_quality

The weighted average of the % chance to hit each attacking unit.

Definition at line 121 of file contexts.hpp.

Referenced by analyze(), get_value(), and rating().

bool ai::attack_analysis::uses_leader

Is true if this attack sequence makes use of the leader.

Definition at line 140 of file contexts.hpp.

Referenced by analyze(), get_value(), ai::push_attack_analysis(), and rating().

double ai::attack_analysis::vulnerability

The vulnerability is the power projection of enemy units onto the hex we're standing on.

support is the power projection of friendly units.

Definition at line 134 of file contexts.hpp.

Referenced by ai::ai_default_rca::aspect_attacks_base::do_attack_analysis(), get_value(), ai::push_attack_analysis(), and rating().


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