#include <contexts.hpp>
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 |
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. 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... | |
Definition at line 38 of file contexts.hpp.
|
inline |
Definition at line 41 of file contexts.hpp.
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 | ||
) |
Definition at line 42 of file attack.cpp.
References alternative_terrain_quality, combatant::average_hp(), avg_damage_inflicted, avg_damage_taken, avg_losses, ai::readonly_context::best_defensive_position(), ai::defensive_position::chance_to_hit, chance_to_kill, game_config::combat_xp(), ai::readonly_context::current_team(), unit_map::end(), unit_map::extract(), unit_map::find(), get_adjacent_tiles(), ai::readonly_context::get_leader_aggression(), gamemap::gives_healing(), combatant::hp_dist, i, unit_map::insert(), team::is_enemy(), gamemap::is_village(), game_config::kill_xp(), leader_threat, unit_map::move(), movements, game_config::poison_amount, resources_used, unit::STATE_POISONED, target_starting_damage, target_value, terrain_quality, ai::target::type, ai::readonly_context::unit_stats_cache(), and uses_leader.
Referenced by ai::ai_default_rca::aspect_attacks_base::do_attack_analysis().
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(), ai::manager::get_singleton(), i, loc, and ai::game_info::recent_attacks.
Referenced by rating().
double ai::attack_analysis::rating | ( | double | aggression, |
const readonly_context & | ai_obj | ||
) | const |
Definition at line 266 of file attack.cpp.
References alternative_terrain_quality, attack_close(), avg_damage_inflicted, avg_damage_taken, avg_losses, chance_to_kill, ai::readonly_context::get_caution(), ai::readonly_context::get_leader_aggression(), is_surrounded, leader_threat, LOG_AI, movements, resources_used, support, target_starting_damage, target_value, terrain_quality, uses_leader, and vulnerability.
Referenced by ai::cfun_attack_rating().
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 101 of file contexts.hpp.
Referenced by analyze(), ai::push_attack_analysis(), and rating().
double ai::attack_analysis::avg_damage_inflicted |
The average hitpoints damage inflicted.
Definition at line 83 of file contexts.hpp.
Referenced by analyze(), ai::push_attack_analysis(), and rating().
double ai::attack_analysis::avg_damage_taken |
The average hitpoints damage taken.
Definition at line 88 of file contexts.hpp.
Referenced by analyze(), 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 77 of file contexts.hpp.
Referenced by analyze(), ai::push_attack_analysis(), and rating().
double ai::attack_analysis::chance_to_kill |
Estimated % chance to kill the unit.
Definition at line 80 of file contexts.hpp.
Referenced by analyze(), 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 116 of file contexts.hpp.
Referenced by ai::ai_default_rca::aspect_attacks_base::do_attack_analysis(), 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 110 of file contexts.hpp.
Referenced by analyze(), ai::push_attack_analysis(), and rating().
std::vector<std::pair<map_location,map_location> > ai::attack_analysis::movements |
Definition at line 71 of file contexts.hpp.
Referenced by analyze(), ai::ai_default_rca::aspect_attacks_base::do_attack_analysis(), ai::ai_default_rca::combat_phase::execute(), ai::push_attack_analysis(), and rating().
double ai::attack_analysis::resources_used |
The sum of the values of units used in the attack.
Definition at line 91 of file contexts.hpp.
Referenced by analyze(), ai::push_attack_analysis(), and rating().
double ai::attack_analysis::support |
Definition at line 107 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(), ai::push_attack_analysis(), and rating().
map_location ai::attack_analysis::target |
Definition at line 70 of file contexts.hpp.
Referenced by ai::ai_default_rca::aspect_attacks_base::analyze_targets(), ai::ai_default_rca::combat_phase::execute(), and ai::push_attack_analysis().
int ai::attack_analysis::target_starting_damage |
Definition at line 85 of file contexts.hpp.
Referenced by analyze(), ai::push_attack_analysis(), and rating().
double ai::attack_analysis::target_value |
The value of the unit being targeted.
Definition at line 74 of file contexts.hpp.
Referenced by analyze(), 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 94 of file contexts.hpp.
Referenced by analyze(), ai::push_attack_analysis(), and rating().
bool ai::attack_analysis::uses_leader |
Is true if this attack sequence makes use of the leader.
Definition at line 113 of file contexts.hpp.
Referenced by analyze(), 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 107 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(), ai::push_attack_analysis(), and rating().