23 #define POWER_FACTOR 10
34 const struct unit *attacker,
35 const struct tile *location);
38 const struct unit *pdefender,
39 const struct tile *dest_tile);
42 const struct tile *ptile);
44 const struct tile *ptile);
46 double win_chance(
int as,
int ahp,
int afp,
int ds,
int dhp,
int dfp);
49 const struct unit *defender,
int *att_fp,
52 const struct unit *defender);
55 const struct tile *ptile);
63 const struct unit *defender);
65 struct unit *defender);
68 struct player *defending_player,
69 struct tile *ptile,
bool fortified,
72 const struct unit *defender);
75 const struct tile *ptile);
78 const struct unit *pvictim,
79 const struct tile *tgt_tile);
85 enum combat_bonus_type type);
struct unit * get_defender(const struct unit *attacker, const struct tile *ptile)
Finds the best defender on the tile, given an attacker.
bool is_unit_reachable_at(const struct unit *defender, const struct unit *attacker, const struct tile *location)
Can unit attack other at given location.
enum unit_attack_result unit_attack_unit_at_tile_result(const struct unit *punit, const struct unit *pdefender, const struct tile *dest_tile)
Checks if a unit can physically attack pdefender at the tile (assuming it is adjacent and at war).
enum unit_attack_result unit_attack_units_at_tile_result(const struct unit *punit, const struct tile *ptile)
Check if unit can attack unit stack at tile.
bool is_stack_vulnerable(const struct tile *ptile)
Is it a city/fortress/air base or will the whole stack die in an attack.
int get_attack_power(const struct unit *punit)
Convenience wrapper for base_get_attack_power.
int combat_bonus_against(const struct combat_bonus_list *list, const struct unit_type *enemy, enum combat_bonus_type type)
Get bonus value against given unit type from bonus list.
int get_fortified_defense_power(const struct unit *attacker, struct unit *defender)
Return total defense power of the unit if it fortifies, if possible, where it is.
int base_get_attack_power(const struct unit_type *punittype, int veteran, int moves_left)
Returns the attack power, modified by moves left, and veteran status.
int get_total_defense_power(const struct unit *attacker, const struct unit *defender)
return the modified defense power of a unit.
struct city * sdi_try_defend(const struct player *owner, const struct tile *ptile)
Try defending against nuclear attack; if successful, return a city which had enough luck and EFT_NUKE...
bool can_unit_attack_tile(const struct unit *punit, const struct tile *ptile)
Is unit (1) diplomatically allowed to attack and (2) physically able to do so?
bool is_tired_attack(int moves_left)
Returns if the attack is going to be a tired attack.
struct unit * get_diplomatic_defender(const struct unit *act_unit, const struct unit *pvictim, const struct tile *tgt_tile)
Returns the defender of the tile in a diplomatic battle or nullptr if no diplomatic defender could be...
double win_chance(int as, int ahp, int afp, int ds, int dhp, int dfp)
Returns the chance of the attacker winning, a number between 0 and 1.
int get_total_attack_power(const struct unit *attacker, const struct unit *defender)
Return the modified attack power of a unit.
int get_virtual_defense_power(const struct unit_type *attacker, const struct unit_type *defender, struct player *defending_player, struct tile *ptile, bool fortified, int veteran)
May be called with a non-existing att_type to avoid any effects which depend on the attacker.
int base_get_defense_power(const struct unit *punit)
Returns the defense power, modified by veteran status.
double unit_win_chance(const struct unit *attacker, const struct unit *defender)
Returns a double in the range [0;1] indicating the attackers chance of winning.
void get_modified_firepower(const struct unit *attacker, const struct unit *defender, int *att_fp, int *def_fp)
A unit's effective firepower depend on the situation.