Freeciv-3.1: /fast/freeciv/nightly/S3_1/common/combat.h Source File

Freeciv-3.1

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};
41
42bool is_unit_reachable_at(const struct unit *defender,
43 const struct unit *attacker,
44 const struct tile *location);
45enum unit_attack_result
46 unit_attack_unit_at_tile_result(const struct unit *punit,
47 const struct action *paction,
48 const struct unit *pdefender,
49 const struct tile *dest_tile);
50enum unit_attack_result
51 unit_attack_units_at_tile_result(const struct unit *punit,
52 const struct action *paction,
53 const struct tile *ptile);
54bool can_unit_attack_tile(const struct unit *punit,
55 const struct action *paction,
56 const struct tile *ptile);
57
58double win_chance(int as, int ahp, int afp, int ds, int dhp, int dfp);
59
60void get_modified_firepower(const struct civ_map *nmap,
61 const struct unit *attacker,
62 const struct unit *defender,
63 int *att_fp, int *def_fp);
64double unit_win_chance(const struct civ_map *nmap,
65 const struct unit *attacker,
66 const struct unit *defender);
67
68 bool unit_really_ignores_citywalls(const struct unit *punit);
69struct city *sdi_try_defend(const struct civ_map *nmap,
70 const struct player *owner,
71 const struct tile *ptile);
72bool is_tired_attack(int moves_left);
73
74int get_attack_power(const struct unit *punit);
75int base_get_attack_power(const struct unit_type *punittype,
76 int veteran, int moves_left);
77int base_get_defense_power(const struct unit *punit);
78int get_total_defense_power(const struct unit *attacker,
79 const struct unit *defender);
80int get_fortified_defense_power(const struct unit *attacker,
81 struct unit *defender);
82int get_virtual_defense_power(const struct civ_map *nmap,
83 const struct unit_type *attacker,
84 const struct unit_type *defender,
85 struct player *defending_player,
86 struct tile *ptile,
87 bool fortified, int veteran);
88int get_total_attack_power(const struct unit *attacker,
89 const struct unit *defender);
90
91struct unit *get_defender(const struct civ_map *nmap,
92 const struct unit *attacker,
93 const struct tile *ptile);
94struct unit *get_attacker(const struct civ_map *nmap,
95 const struct unit *defender,
96 const struct tile *ptile);
97
98struct unit *get_diplomatic_defender(const struct unit *act_unit,
99 const struct unit *pvictim,
100 const struct tile *tgt_tile);
101
102bool is_stack_vulnerable(const struct tile *ptile);
103
104int combat_bonus_against(const struct combat_bonus_list *list,
105 const struct unit_type *enemy,
106 enum combat_bonus_type type);
107
108int unit_bombard_rate(struct unit *punit);
109
110#ifdef __cplusplus
111}
112#endif /* __cplusplus */
113
114#endif /* FC__COMBAT_H */
list
static struct fc_sockaddr_list * list
Definition clinet.c:102
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:928
get_attack_power
int get_attack_power(const struct unit *punit)
Definition combat.c:494
unit_bombard_rate
int unit_bombard_rate(struct unit *punit)
Definition combat.c:959
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:941
get_fortified_defense_power
int get_fortified_defense_power(const struct unit *attacker, struct unit *defender)
Definition combat.c:726
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:849
base_get_attack_power
int base_get_attack_power(const struct unit_type *punittype, int veteran, int moves_left)
Definition combat.c:504
sdi_try_defend
struct city * sdi_try_defend(const struct civ_map *nmap, const struct player *owner, const struct tile *ptile)
Definition combat.c:460
get_total_defense_power
int get_total_defense_power(const struct unit *attacker, const struct unit *defender)
Definition combat.c:712
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
get_diplomatic_defender
struct unit * get_diplomatic_defender(const struct unit *act_unit, const struct unit *pvictim, const struct tile *tgt_tile)
Definition combat.c:882
is_tired_attack
bool is_tired_attack(int moves_left)
Definition combat.c:486
unit_attack_result
unit_attack_result
Definition combat.h:34
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:271
win_chance
double win_chance(int as, int ahp, int afp, int ds, int dhp, int dfp)
Definition combat.c:292
get_total_attack_power
int get_total_attack_power(const struct unit *attacker, const struct unit *defender)
Definition combat.c:567
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:657
unit_win_chance
double unit_win_chance(const struct civ_map *nmap, const struct unit *attacker, const struct unit *defender)
Definition combat.c:438
base_get_defense_power
int base_get_defense_power(const struct unit *punit)
Definition combat.c:528
get_defender
struct unit * get_defender(const struct civ_map *nmap, const struct unit *attacker, const struct tile *ptile)
Definition combat.c:781
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:369
unit_really_ignores_citywalls
bool unit_really_ignores_citywalls(const struct unit *punit)
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:73
fc_types.h
owner
struct city * owner
Definition citydlg.c:219
type
GType type
Definition repodlgs.c:1312
action
Definition actions.h:379
city
Definition city.h:309
civ_map
Definition map_types.h:71
player
Definition player.h:249
tile
Definition tile.h:49
unit_type
Definition unittype.h:481
unit
Definition unit.h:138
unittype.h