The Battle for Wesnoth  1.19.7+dev
Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
ai::attack_result Class Reference

#include <actions.hpp>

Inheritance diagram for ai::attack_result:

Public Types

enum  result {
  E_EMPTY_ATTACKER = 1001 , E_EMPTY_DEFENDER = 1002 , E_INCAPACITATED_ATTACKER = 1003 , E_INCAPACITATED_DEFENDER = 1004 ,
  E_NOT_OWN_ATTACKER = 1005 , E_NOT_ENEMY_DEFENDER = 1006 , E_NO_ATTACKS_LEFT = 1007 , E_WRONG_ATTACKER_WEAPON = 1008 ,
  E_UNABLE_TO_CHOOSE_ATTACKER_WEAPON = 1009 , E_ATTACKER_AND_DEFENDER_NOT_ADJACENT = 1010
}
 
- Public Types inherited from ai::action_result
enum  result { AI_ACTION_SUCCESS = 0 , AI_ACTION_STARTED = 1 , AI_ACTION_FAILURE = -1 }
 

Public Member Functions

 attack_result (side_number side, const map_location &attacker_loc, const map_location &defender_loc, int attacker_weapon, double aggression)
 
virtual std::string do_describe () const
 
- Public Member Functions inherited from ai::action_result
virtual ~action_result ()
 
void check_before ()
 
void execute ()
 
bool is_gamestate_changed () const
 
bool is_ok ()
 
int get_status () const
 

Protected Member Functions

virtual void do_check_before ()
 
virtual void do_check_after ()
 
virtual void do_execute ()
 
virtual void do_init_for_execution ()
 
- Protected Member Functions inherited from ai::action_result
 action_result (side_number side)
 
bool is_execution () const
 
int get_side () const
 
game_infoget_info () const
 
teamget_my_team () const
 
void set_error (int error_code, bool log_as_error=true)
 
bool is_success () const
 
void set_gamestate_changed ()
 

Private Attributes

const map_locationattacker_loc_
 
const map_locationdefender_loc_
 
int attacker_weapon_
 
double aggression_
 

Detailed Description

Definition at line 129 of file actions.hpp.

Member Enumeration Documentation

◆ result

Enumerator
E_EMPTY_ATTACKER 
E_EMPTY_DEFENDER 
E_INCAPACITATED_ATTACKER 
E_INCAPACITATED_DEFENDER 
E_NOT_OWN_ATTACKER 
E_NOT_ENEMY_DEFENDER 
E_NO_ATTACKS_LEFT 
E_WRONG_ATTACKER_WEAPON 
E_UNABLE_TO_CHOOSE_ATTACKER_WEAPON 
E_ATTACKER_AND_DEFENDER_NOT_ADJACENT 

Definition at line 137 of file actions.hpp.

Constructor & Destructor Documentation

◆ attack_result()

ai::attack_result::attack_result ( side_number  side,
const map_location attacker_loc,
const map_location defender_loc,
int  attacker_weapon,
double  aggression 
)

Definition at line 175 of file actions.cpp.

Member Function Documentation

◆ do_check_after()

void ai::attack_result::do_check_after ( )
protectedvirtual

Implements ai::action_result.

Definition at line 245 of file actions.cpp.

◆ do_check_before()

void ai::attack_result::do_check_before ( )
protectedvirtual

◆ do_describe()

std::string ai::attack_result::do_describe ( ) const
virtual

Implements ai::action_result.

Definition at line 249 of file actions.cpp.

References aggression_, attacker_loc_, attacker_weapon_, defender_loc_, ai::action_result::get_side(), and s.

Referenced by operator<<().

◆ do_execute()

void ai::attack_result::do_execute ( )
protectedvirtual

◆ do_init_for_execution()

void ai::attack_result::do_init_for_execution ( )
protectedvirtual

Implements ai::action_result.

Definition at line 317 of file actions.cpp.

Member Data Documentation

◆ aggression_

double ai::attack_result::aggression_
private

Definition at line 160 of file actions.hpp.

Referenced by do_describe(), and do_execute().

◆ attacker_loc_

const map_location& ai::attack_result::attacker_loc_
private

Definition at line 157 of file actions.hpp.

Referenced by do_check_before(), do_describe(), and do_execute().

◆ attacker_weapon_

int ai::attack_result::attacker_weapon_
private

Definition at line 159 of file actions.hpp.

Referenced by do_check_before(), do_describe(), and do_execute().

◆ defender_loc_

const map_location& ai::attack_result::defender_loc_
private

Definition at line 158 of file actions.hpp.

Referenced by do_check_before(), do_describe(), and do_execute().


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