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
42
43bool is_unit_reachable_at(const struct unit *defender,
44 const struct unit *attacker,
45 const struct tile *location);
48 const struct action *paction,
49 const struct unit *pdefender,
50 const struct tile *dest_tile);
53 const struct action *paction,
54 const struct tile *ptile);
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
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);
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,
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
113 const struct unit_type *enemy,
115
116int unit_bombard_rate(struct unit *punit);
117
118#ifdef __cplusplus
119}
120#endif /* __cplusplus */
121
122#endif /* FC__COMBAT_H */
static struct fc_sockaddr_list * list
Definition clinet.c:102
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
bool is_unit_reachable_at(const struct unit *defender, const struct unit *attacker, const struct tile *location)
Definition combat.c:85
bool is_stack_vulnerable(const struct tile *ptile)
Definition combat.c:989
int get_attack_power(const struct unit *punit)
Definition combat.c:535
int unit_bombard_rate(struct unit *punit)
Definition combat.c:1020
int combat_bonus_against(const struct combat_bonus_list *list, const struct unit_type *enemy, enum combat_bonus_type type)
Definition combat.c:1002
int get_fortified_defense_power(const struct unit *attacker, struct unit *defender)
Definition combat.c:781
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
struct unit * get_attacker(const struct civ_map *nmap, const struct unit *defender, const struct tile *ptile)
Definition combat.c:906
int base_get_attack_power(const struct unit_type *punittype, int veteran, int moves_left)
Definition combat.c:545
struct city * sdi_try_defend(const struct civ_map *nmap, const struct player *owner, const struct tile *ptile)
Definition combat.c:501
int get_total_defense_power(const struct unit *attacker, const struct unit *defender)
Definition combat.c:767
int get_total_attack_power(const struct unit *attacker, const struct unit *defender, const struct action *paction)
Definition combat.c:610
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
bool is_tired_attack(int moves_left)
Definition combat.c:527
unit_attack_result
Definition combat.h:34
@ ATT_NOT_WIPABLE
Definition combat.h:40
@ ATT_NONNATIVE_DST
Definition combat.h:39
@ ATT_OK
Definition combat.h:35
@ ATT_NON_ATTACK
Definition combat.h:36
@ ATT_UNREACHABLE
Definition combat.h:37
@ ATT_NONNATIVE_SRC
Definition combat.h:38
bool can_unit_attack_tile(const struct unit *punit, const struct action *paction, const struct tile *ptile)
Definition combat.c:311
double win_chance(int as, int ahp, int afp, int ds, int dhp, int dfp)
Definition combat.c:332
enum unit_attack_result unit_wipe_units_at_tile_result(const struct unit *punit, const struct tile *ptile)
Definition combat.c:271
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:712
struct unit * get_defender(const struct civ_map *nmap, const struct unit *attacker, const struct tile *ptile, const struct action *paction)
Definition combat.c:836
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:942
int base_get_defense_power(const struct unit *punit)
Definition combat.c:569
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
bool unit_really_ignores_citywalls(const struct unit *punit)
char * incite_cost
Definition comments.c:75
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
struct city * owner
Definition citydlg.c:226
GType type
Definition repodlgs.c:1313
Definition city.h:320
Definition tile.h:50
Definition unit.h:138