#include <actions.hpp>
Public Member Functions | |
battle_context (const gamemap &map, const std::vector< team > &teams, const unit_map &units, const gamestatus &status, const gamemap::location &attacker_loc, const gamemap::location &defender_loc, int attacker_weapon=-1, int defender_weapon=-1, double aggression=0.0, const combatant *prev_def=NULL, const unit *attacker_ptr=NULL) | |
battle_context (const unit_stats &att, const unit_stats &def) | |
battle_context (const battle_context &other) | |
~battle_context () | |
battle_context & | operator= (const battle_context &other) |
const unit_stats & | get_attacker_stats () const |
This method returns the statistics of the attacker. | |
const unit_stats & | get_defender_stats () const |
This method returns the statistics of the defender. | |
const combatant & | get_attacker_combatant (const combatant *prev_def=NULL) |
Get the simulation results. | |
const combatant & | get_defender_combatant (const combatant *prev_def=NULL) |
bool | better_attack (class battle_context &that, double harm_weight) |
Given this harm_weight, is this attack better than that? | |
Private Member Functions | |
bool | better_combat (const combatant &us_a, const combatant &them_a, const combatant &us_b, const combatant &them_b, double harm_weight) |
int | choose_attacker_weapon (const unit &attacker, const unit &defender, const gamemap &map, const std::vector< team > &teams, const unit_map &units, const gamestatus &status, const gamemap::location &attacker_loc, const gamemap::location &defender_loc, double harm_weight, int *defender_weapon, const combatant *prev_def) |
int | choose_defender_weapon (const unit &attacker, const unit &defender, unsigned attacker_weapon, const gamemap &map, const std::vector< team > &teams, const unit_map &units, const gamestatus &status, const gamemap::location &attacker_loc, const gamemap::location &defender_loc, const combatant *prev_def) |
Private Attributes | |
unit_stats * | attacker_stats_ |
unit_stats * | defender_stats_ |
combatant * | attacker_combatant_ |
combatant * | defender_combatant_ |
Classes | |
struct | unit_stats |
Structure describing the statistics of a unit involved in the battle. More... |
Definition at line 65 of file actions.hpp.
battle_context::battle_context | ( | const gamemap & | map, | |
const std::vector< team > & | teams, | |||
const unit_map & | units, | |||
const gamestatus & | status, | |||
const gamemap::location & | attacker_loc, | |||
const gamemap::location & | defender_loc, | |||
int | attacker_weapon = -1 , |
|||
int | defender_weapon = -1 , |
|||
double | aggression = 0.0 , |
|||
const combatant * | prev_def = NULL , |
|||
const unit * | attacker_ptr = NULL | |||
) |
Definition at line 252 of file actions.cpp.
References _, attacker_combatant_, attacker_stats_, unit::attacks(), choose_attacker_weapon(), choose_defender_weapon(), defender_combatant_, defender_stats_, unit_map::find(), and VALIDATE.
battle_context::battle_context | ( | const unit_stats & | att, | |
const unit_stats & | def | |||
) |
Definition at line 313 of file actions.cpp.
battle_context::battle_context | ( | const battle_context & | other | ) |
Definition at line 307 of file actions.cpp.
battle_context::~battle_context | ( | ) |
Definition at line 321 of file actions.cpp.
References attacker_combatant_, attacker_stats_, defender_combatant_, and defender_stats_.
battle_context & battle_context::operator= | ( | const battle_context & | other | ) |
Definition at line 328 of file actions.cpp.
References attacker_combatant_, attacker_stats_, defender_combatant_, and defender_stats_.
const unit_stats& battle_context::get_attacker_stats | ( | ) | const [inline] |
This method returns the statistics of the attacker.
Definition at line 129 of file actions.hpp.
References attacker_stats_.
Referenced by ai::attack_analysis::analyze(), attack::attack(), ai::desperate_attack(), sample_ai::do_attacks(), ai::do_combat(), ai::move_to_targets(), ai::move_unit(), and attack::refresh_bc().
const unit_stats& battle_context::get_defender_stats | ( | ) | const [inline] |
This method returns the statistics of the defender.
Definition at line 132 of file actions.hpp.
References defender_stats_.
Referenced by ai::attack_analysis::analyze(), attack::attack(), ai::desperate_attack(), sample_ai::do_attacks(), ai::do_combat(), ai::move_to_targets(), ai::move_unit(), and attack::refresh_bc().
Get the simulation results.
Definition at line 546 of file actions.cpp.
References attacker_combatant_, attacker_stats_, defender_combatant_, defender_stats_, and combatant::fight().
Referenced by ai::attack_analysis::analyze(), and better_attack().
Definition at line 558 of file actions.cpp.
References attacker_combatant_, attacker_stats_, defender_combatant_, defender_stats_, and combatant::fight().
Referenced by ai::attack_analysis::analyze(), and better_attack().
bool battle_context::better_attack | ( | class battle_context & | that, | |
double | harm_weight | |||
) |
Given this harm_weight, is this attack better than that?
Definition at line 737 of file actions.cpp.
References better_combat(), get_attacker_combatant(), and get_defender_combatant().
Referenced by events::mouse_handler::attack_enemy_().
bool battle_context::better_combat | ( | const combatant & | us_a, | |
const combatant & | them_a, | |||
const combatant & | us_b, | |||
const combatant & | them_b, | |||
double | harm_weight | |||
) | [private] |
Definition at line 518 of file actions.cpp.
References a, combatant::average_hp(), b, and combatant::hp_dist.
Referenced by better_attack(), choose_attacker_weapon(), and choose_defender_weapon().
int battle_context::choose_attacker_weapon | ( | const unit & | attacker, | |
const unit & | defender, | |||
const gamemap & | map, | |||
const std::vector< team > & | teams, | |||
const unit_map & | units, | |||
const gamestatus & | status, | |||
const gamemap::location & | attacker_loc, | |||
const gamemap::location & | defender_loc, | |||
double | harm_weight, | |||
int * | defender_weapon, | |||
const combatant * | prev_def | |||
) | [private] |
Definition at line 438 of file actions.cpp.
References battle_context::unit_stats::attack_num, attack_type::attack_weight(), attacker_combatant_, attacker_stats_, unit::attacks(), better_combat(), choose_defender_weapon(), defender_combatant_, defender_stats_, and combatant::fight().
Referenced by battle_context().
int battle_context::choose_defender_weapon | ( | const unit & | attacker, | |
const unit & | defender, | |||
unsigned | attacker_weapon, | |||
const gamemap & | map, | |||
const std::vector< team > & | teams, | |||
const unit_map & | units, | |||
const gamestatus & | status, | |||
const gamemap::location & | attacker_loc, | |||
const gamemap::location & | defender_loc, | |||
const combatant * | prev_def | |||
) | [private] |
Definition at line 344 of file actions.cpp.
References battle_context::unit_stats::attack_num, attacker_combatant_, attacker_stats_, unit::attacks(), better_combat(), battle_context::unit_stats::chance_to_hit, battle_context::unit_stats::damage, defender_combatant_, defender_stats_, attack_type::defense_weight(), combatant::fight(), battle_context::unit_stats::num_blows, and attack_type::range().
Referenced by battle_context(), and choose_attacker_weapon().
unit_stats* battle_context::attacker_stats_ [private] |
Definition at line 158 of file actions.hpp.
Referenced by battle_context(), choose_attacker_weapon(), choose_defender_weapon(), get_attacker_combatant(), get_attacker_stats(), get_defender_combatant(), operator=(), and ~battle_context().
unit_stats * battle_context::defender_stats_ [private] |
Definition at line 158 of file actions.hpp.
Referenced by battle_context(), choose_attacker_weapon(), choose_defender_weapon(), get_attacker_combatant(), get_defender_combatant(), get_defender_stats(), operator=(), and ~battle_context().
combatant* battle_context::attacker_combatant_ [private] |
Definition at line 161 of file actions.hpp.
Referenced by battle_context(), choose_attacker_weapon(), choose_defender_weapon(), get_attacker_combatant(), get_defender_combatant(), operator=(), and ~battle_context().
combatant * battle_context::defender_combatant_ [private] |
Definition at line 161 of file actions.hpp.
Referenced by battle_context(), choose_attacker_weapon(), choose_defender_weapon(), get_attacker_combatant(), get_defender_combatant(), operator=(), and ~battle_context().
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |