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
41
42bool is_unit_reachable_at(const struct unit *defender,
43 const struct unit *attacker,
44 const struct tile *location);
47 const struct action *paction,
48 const struct unit *pdefender,
49 const struct tile *dest_tile);
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
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 */
static struct fc_sockaddr_list * list
Definition clinet.c:102
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:930
int get_attack_power(const struct unit *punit)
Definition combat.c:494
int unit_bombard_rate(struct unit *punit)
Definition combat.c:961
int combat_bonus_against(const struct combat_bonus_list *list, const struct unit_type *enemy, enum combat_bonus_type type)
Definition combat.c:943
int get_fortified_defense_power(const struct unit *attacker, struct unit *defender)
Definition combat.c:728
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:851
int base_get_attack_power(const struct unit_type *punittype, int veteran, int moves_left)
Definition combat.c:504
struct city * sdi_try_defend(const struct civ_map *nmap, const struct player *owner, const struct tile *ptile)
Definition combat.c:460
int get_total_defense_power(const struct unit *attacker, const struct unit *defender)
Definition combat.c:714
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
struct unit * get_diplomatic_defender(const struct unit *act_unit, const struct unit *pvictim, const struct tile *tgt_tile)
Definition combat.c:884
bool is_tired_attack(int moves_left)
Definition combat.c:486
unit_attack_result
Definition combat.h:34
@ 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:271
double win_chance(int as, int ahp, int afp, int ds, int dhp, int dfp)
Definition combat.c:292
int get_total_attack_power(const struct unit *attacker, const struct unit *defender)
Definition combat.c:569
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:659
double unit_win_chance(const struct civ_map *nmap, const struct unit *attacker, const struct unit *defender)
Definition combat.c:438
int base_get_defense_power(const struct unit *punit)
Definition combat.c:528
struct unit * get_defender(const struct civ_map *nmap, const struct unit *attacker, const struct tile *ptile)
Definition combat.c:783
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
bool unit_really_ignores_citywalls(const struct unit *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
struct city * owner
Definition citydlg.c:219
GType type
Definition repodlgs.c:1312
Definition city.h:309
Definition tile.h:49
Definition unit.h:138