Public Member Functions | Public Attributes

ai::attack_analysis Class Reference

#include <contexts.hpp>

Inheritance diagram for ai::attack_analysis:
Inheritance graph
[legend]
Collaboration diagram for ai::attack_analysis:
Collaboration graph
[legend]

List of all members.

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 Attributes

map_location target
std::vector< std::pair
< map_location, map_location > > 
movements
double target_value
 The value of the unit being targeted.
double avg_losses
 The value on average, of units lost in the combat.
double chance_to_kill
 Estimated % chance to kill the unit.
double avg_damage_inflicted
 The average hitpoints damage inflicted.
int target_starting_damage
double avg_damage_taken
 The average hitpoints damage taken.
double resources_used
 The sum of the values of units used in the attack.
double terrain_quality
 The weighted average of the % chance to hit each attacking unit.
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).
double vulnerability
 The vulnerability is the power projection of enemy units onto the hex we're standing on.
double support
bool leader_threat
 Is true if the unit is a threat to our leader.
bool uses_leader
 Is true if this attack sequence makes use of the leader.
bool is_surrounded
 Is true if the units involved in this attack sequence are surrounded.

Detailed Description

Definition at line 50 of file contexts.hpp.


Constructor & Destructor Documentation

ai::attack_analysis::attack_analysis (  )  [inline]

Definition at line 53 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 
)

Todo:
1.9 add combatant.prob_killed
Todo:
1.9: attack_prediction.cpp should understand advancement directly. For each level of attacker def gets 1 xp or kill_experience.

Definition at line 40 of file attack.cpp.

References unit::advances_to(), alternative_terrain_quality, unit::attacks(), combatant::average_hp(), avg_damage_inflicted, avg_damage_taken, avg_losses, ai::readonly_context::best_defensive_position(), unit::can_recruit(), battle_context_unit_stats::chance_to_hit, ai::defensive_position::chance_to_hit, chance_to_kill, unit::cost(), ai::readonly_context::current_team(), unit_map::end(), unit::experience(), unit_map::extract(), unit_map::find(), get_adjacent_tiles(), battle_context::get_attacker_combatant(), battle_context::get_attacker_stats(), battle_context::get_defender_combatant(), battle_context::get_defender_stats(), ai::readonly_context::get_leader_aggression(), unit::get_state(), gamemap::gives_healing(), unit::hitpoints(), combatant::hp_dist, if(), unit_map::insert(), team::is_enemy(), gamemap::is_village(), game_config::kill_xp(), leader_threat, unit::level(), unit::max_experience(), unit_map::move(), movements, battle_context_unit_stats::plagues, game_config::poison_amount, resources_used, unit::set_location(), unit::STATE_POISONED, target_starting_damage, target_value, terrain_quality, unit::type(), ai::readonly_context::unit_stats_cache(), and uses_leader.

Referenced by ai::testing_ai_default::aspect_attacks::do_attack_analysis().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 253 of file attack.cpp.

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

Referenced by rating().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from game_logic::formula_callable.

Definition at line 955 of file ai.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

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

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

The average hitpoints damage inflicted.

Definition at line 98 of file contexts.hpp.

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

The average hitpoints damage taken.

Definition at line 103 of file contexts.hpp.

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

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

Definition at line 92 of file contexts.hpp.

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

Estimated % chance to kill the unit.

Definition at line 95 of file contexts.hpp.

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

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

Definition at line 131 of file contexts.hpp.

Referenced by ai::testing_ai_default::aspect_attacks::do_attack_analysis(), get_value(), ai::push_attack_analysis(), and rating().

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

Definition at line 125 of file contexts.hpp.

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

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

Definition at line 106 of file contexts.hpp.

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

Definition at line 100 of file contexts.hpp.

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

The value of the unit being targeted.

Definition at line 89 of file contexts.hpp.

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

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

Definition at line 109 of file contexts.hpp.

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

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

Definition at line 128 of file contexts.hpp.

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

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

Referenced by ai::testing_ai_default::aspect_attacks::do_attack_analysis(), get_value(), ai::push_attack_analysis(), and rating().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:18:56 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs