Freeciv-3.2: /fast/freeciv/nightly/S3_2/common/combat.h Source File

Freeciv-3.2

Loading...
Searching...
No Matches
combat.h
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13#ifndef FC__COMBAT_H
14#define FC__COMBAT_H
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
20/* common */
21#include "fc_types.h"
22#include "unittype.h"
23
24struct civ_map;
25
26/*
27 * attack_strength and defense_strength are multiplied by POWER_FACTOR
28 * to yield the base of attack_power and defense_power.
29 *
30 * The constant may be changed since it isn't externally visibly used.
31 */
32#define POWER_FACTOR 10
33
34 enum unit_attack_result {
35 ATT_OK,
36 ATT_NON_ATTACK,
37 ATT_UNREACHABLE,
38 ATT_NONNATIVE_SRC,
39 ATT_NONNATIVE_DST,
40 ATT_NOT_WIPABLE
41};
42
43bool is_unit_reachable_at(const struct unit *defender,
44 const struct unit *attacker,
45 const struct tile *location);
46enum unit_attack_result
47 unit_attack_unit_at_tile_result(const struct unit *punit,
48 const struct action *paction,
49 const struct unit *pdefender,
50 const struct tile *dest_tile);
51enum unit_attack_result
52 unit_attack_units_at_tile_result(const struct unit *punit,
53 const struct action *paction,
54 const struct tile *ptile);
55enum unit_attack_result
56 unit_wipe_units_at_tile_result(const struct unit *punit,
57 const struct tile *ptile);
58bool can_unit_attack_tile(const struct unit *punit,
59 const struct action *paction,
60 const struct tile *ptile);
61
62double win_chance(int as, int ahp, int afp, int ds, int dhp, int dfp);
63
64void get_modified_firepower(const struct civ_map *nmap,
65 const struct unit *attacker,
66 const struct unit *defender,
67 int *att_fp, int *def_fp);
68double unit_win_chance(const struct civ_map *nmap,
69 const struct unit *attacker,
70 const struct unit *defender,
71 const struct action *paction);
72
73 bool unit_really_ignores_citywalls(const struct unit *punit);
74struct city *sdi_try_defend(const struct civ_map *nmap,
75 const struct player *owner,
76 const struct tile *ptile);
77bool is_tired_attack(int moves_left);
78
79int get_attack_power(const struct unit *punit);
80int base_get_attack_power(const struct unit_type *punittype,
81 int veteran, int moves_left);
82int base_get_defense_power(const struct unit *punit);
83int get_total_defense_power(const struct unit *attacker,
84 const struct unit *defender);
85int get_fortified_defense_power(const struct unit *attacker,
86 struct unit *defender);
87int get_virtual_defense_power(const struct civ_map *nmap,
88 const struct unit_type *attacker,
89 const struct unit_type *defender,
90 struct player *defending_player,
91 struct tile *ptile,
92 bool fortified, int veteran);
93int get_total_attack_power(const struct unit *attacker,
94 const struct unit *defender,
95 const struct action *paction);
96
97struct unit *get_defender(const struct civ_map *nmap,
98 const struct unit *attacker,
99 const struct tile *ptile,
100 const struct action *paction);
101struct unit *get_attacker(const struct civ_map *nmap,
102 const struct unit *defender,
103 const struct tile *ptile);
104
105struct unit *get_diplomatic_defender(const struct unit *act_unit,
106 const struct unit *pvictim,
107 const struct tile *tgt_tile,
108 const struct action *paction);
109
110bool is_stack_vulnerable(const struct tile *ptile);
111
112int combat_bonus_against(const struct combat_bonus_list *list,
113 const struct unit_type *enemy,
114 enum combat_bonus_type type);
115
116int unit_bombard_rate(struct unit *punit);
117
118#ifdef __cplusplus
119}
120#endif /* __cplusplus */
121
122#endif /* FC__COMBAT_H */
list
static struct fc_sockaddr_list * list
Definition clinet.c:102
unit_win_chance
double unit_win_chance(const struct civ_map *nmap, const struct unit *attacker, const struct unit *defender, const struct action *paction)
Definition combat.c:478
is_unit_reachable_at
bool is_unit_reachable_at(const struct unit *defender, const struct unit *attacker, const struct tile *location)
Definition combat.c:85
is_stack_vulnerable
bool is_stack_vulnerable(const struct tile *ptile)
Definition combat.c:987
get_attack_power
int get_attack_power(const struct unit *punit)
Definition combat.c:535
unit_bombard_rate
int unit_bombard_rate(struct unit *punit)
Definition combat.c:1018
combat_bonus_against
int combat_bonus_against(const struct combat_bonus_list *list, const struct unit_type *enemy, enum combat_bonus_type type)
Definition combat.c:1000
get_fortified_defense_power
int get_fortified_defense_power(const struct unit *attacker, struct unit *defender)
Definition combat.c:779
unit_attack_units_at_tile_result
enum unit_attack_result unit_attack_units_at_tile_result(const struct unit *punit, const struct action *paction, const struct tile *ptile)
Definition combat.c:256
get_attacker
struct unit * get_attacker(const struct civ_map *nmap, const struct unit *defender, const struct tile *ptile)
Definition combat.c:904
base_get_attack_power
int base_get_attack_power(const struct unit_type *punittype, int veteran, int moves_left)
Definition combat.c:545
sdi_try_defend
struct city * sdi_try_defend(const struct civ_map *nmap, const struct player *owner, const struct tile *ptile)
Definition combat.c:501
get_total_defense_power
int get_total_defense_power(const struct unit *attacker, const struct unit *defender)
Definition combat.c:765
get_total_attack_power
int get_total_attack_power(const struct unit *attacker, const struct unit *defender, const struct action *paction)
Definition combat.c:608
unit_attack_unit_at_tile_result
enum unit_attack_result unit_attack_unit_at_tile_result(const struct unit *punit, const struct action *paction, const struct unit *pdefender, const struct tile *dest_tile)
Definition combat.c:122
is_tired_attack
bool is_tired_attack(int moves_left)
Definition combat.c:527
unit_attack_result
unit_attack_result
Definition combat.h:34
ATT_NOT_WIPABLE
@ ATT_NOT_WIPABLE
Definition combat.h:40
ATT_NONNATIVE_DST
@ ATT_NONNATIVE_DST
Definition combat.h:39
ATT_OK
@ ATT_OK
Definition combat.h:35
ATT_NON_ATTACK
@ ATT_NON_ATTACK
Definition combat.h:36
ATT_UNREACHABLE
@ ATT_UNREACHABLE
Definition combat.h:37
ATT_NONNATIVE_SRC
@ ATT_NONNATIVE_SRC
Definition combat.h:38
can_unit_attack_tile
bool can_unit_attack_tile(const struct unit *punit, const struct action *paction, const struct tile *ptile)
Definition combat.c:311
win_chance
double win_chance(int as, int ahp, int afp, int ds, int dhp, int dfp)
Definition combat.c:332
unit_wipe_units_at_tile_result
enum unit_attack_result unit_wipe_units_at_tile_result(const struct unit *punit, const struct tile *ptile)
Definition combat.c:271
get_virtual_defense_power
int get_virtual_defense_power(const struct civ_map *nmap, const struct unit_type *attacker, const struct unit_type *defender, struct player *defending_player, struct tile *ptile, bool fortified, int veteran)
Definition combat.c:710
get_defender
struct unit * get_defender(const struct civ_map *nmap, const struct unit *attacker, const struct tile *ptile, const struct action *paction)
Definition combat.c:834
get_diplomatic_defender
struct unit * get_diplomatic_defender(const struct unit *act_unit, const struct unit *pvictim, const struct tile *tgt_tile, const struct action *paction)
Definition combat.c:940
base_get_defense_power
int base_get_defense_power(const struct unit *punit)
Definition combat.c:569
get_modified_firepower
void get_modified_firepower(const struct civ_map *nmap, const struct unit *attacker, const struct unit *defender, int *att_fp, int *def_fp)
Definition combat.c:409
unit_really_ignores_citywalls
bool unit_really_ignores_citywalls(const struct unit *punit)
incite_cost
char * incite_cost
Definition comments.c:74
punit
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
Definition dialogs_g.h:74
fc_types.h
owner
struct city * owner
Definition citydlg.c:220
type
GType type
Definition repodlgs.c:1313
action
Definition actions.h:360
city
Definition city.h:320
civ_map
Definition map_types.h:71
player
Definition player.h:247
tile
Definition tile.h:50
unit_type
Definition unittype.h:500
unit
Definition unit.h:138
unittype.h