The Battle for Wesnoth  1.19.5+dev
Public Member Functions | Public Attributes | List of all members
ai::attack_analysis Class Reference

#include <contexts.hpp>

Inheritance diagram for ai::attack_analysis:

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
 
wfl::variant get_value (const std::string &key) const override
 
void get_inputs (wfl::formula_input_vector &inputs) const override
 
bool attack_close (const map_location &loc) const
 
wfl::variant execute_self (wfl::variant ctxt) override
 
- Public Member Functions inherited from wfl::formula_callable
 formula_callable (bool has_self=true)
 
virtual ~formula_callable ()
 
formula_callable_ptr fake_ptr ()
 
const_formula_callable_ptr fake_ptr () const
 
variant query_value (const std::string &key) const
 
void mutate_value (const std::string &key, const variant &value)
 
formula_input_vector inputs () const
 
bool equals (const formula_callable &other) const
 
bool less (const formula_callable &other) const
 
bool has_key (const std::string &key) const
 
void serialize (std::string &str) const
 
void subscribe_dtor (callable_die_subscriber *d) const
 
void unsubscribe_dtor (callable_die_subscriber *d) 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 wfl::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 wfl::formula_callable
virtual void set_value (const std::string &key, const variant &)
 
virtual int do_compare (const formula_callable *callable) const
 
virtual void serialize_to_string (std::string &) const
 
- Static Protected Member Functions inherited from wfl::formula_callable
template<typename T , typename K >
static variant convert_map (const std::map< T, K > &input_map)
 
template<typename T >
static variant convert_set (const std::set< T > &input_set)
 
template<typename T >
static variant convert_vector (const std::vector< T > &input_vector)
 
static void add_input (formula_input_vector &inputs, const std::string &key, formula_access access_type=formula_access::read_only)
 
- Protected Attributes inherited from wfl::formula_callable
TYPE type_
 
std::set< callable_die_subscriber * > dtor_notify
 

Detailed Description

Definition at line 39 of file contexts.hpp.

Constructor & Destructor Documentation

◆ attack_analysis()

ai::attack_analysis::attack_analysis ( )
inline

Definition at line 42 of file contexts.hpp.

Member Function Documentation

◆ analyze()

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 
)

◆ attack_close()

bool ai::attack_analysis::attack_close ( const map_location loc) const

◆ execute_self()

wfl::variant ai::attack_analysis::execute_self ( wfl::variant  ctxt)
overridevirtual

◆ get_inputs()

void ai::attack_analysis::get_inputs ( wfl::formula_input_vector inputs) const
overridevirtual

Reimplemented from wfl::formula_callable.

Definition at line 389 of file attack.cpp.

References wfl::formula_callable::add_input(), and wfl::formula_callable::inputs().

◆ get_value()

wfl::variant ai::attack_analysis::get_value ( const std::string &  key) const
overridevirtual

◆ rating()

double ai::attack_analysis::rating ( double  aggression,
const readonly_context ai_obj 
) const

Member Data Documentation

◆ alternative_terrain_quality

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 105 of file contexts.hpp.

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

◆ avg_damage_inflicted

double ai::attack_analysis::avg_damage_inflicted

The average hitpoints damage inflicted.

Definition at line 87 of file contexts.hpp.

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

◆ avg_damage_taken

double ai::attack_analysis::avg_damage_taken

The average hitpoints damage taken.

Definition at line 92 of file contexts.hpp.

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

◆ avg_losses

double ai::attack_analysis::avg_losses

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

Definition at line 81 of file contexts.hpp.

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

◆ chance_to_kill

double ai::attack_analysis::chance_to_kill

Estimated % chance to kill the unit.

Definition at line 84 of file contexts.hpp.

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

◆ is_surrounded

bool ai::attack_analysis::is_surrounded

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

Definition at line 120 of file contexts.hpp.

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

◆ leader_threat

bool ai::attack_analysis::leader_threat

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

Definition at line 114 of file contexts.hpp.

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

◆ movements

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

◆ resources_used

double ai::attack_analysis::resources_used

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

Definition at line 95 of file contexts.hpp.

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

◆ support

double ai::attack_analysis::support

◆ target

map_location ai::attack_analysis::target

◆ target_starting_damage

int ai::attack_analysis::target_starting_damage

Definition at line 89 of file contexts.hpp.

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

◆ target_value

double ai::attack_analysis::target_value

The value of the unit being targeted.

Definition at line 78 of file contexts.hpp.

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

◆ terrain_quality

double ai::attack_analysis::terrain_quality

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

Definition at line 98 of file contexts.hpp.

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

◆ uses_leader

bool ai::attack_analysis::uses_leader

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

Definition at line 117 of file contexts.hpp.

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

◆ vulnerability

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 111 of file contexts.hpp.

Referenced by ai::ai_default_rca::aspect_attacks_base::analyze_targets(), 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: