Freeciv-3.1
Loading...
Searching...
No Matches
common
aicore
aiactions.c
Go to the documentation of this file.
1
/**********************************************************************
2
Freeciv - Copyright (C) 2020 - The Freeciv Project contributors.
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
14
#ifdef HAVE_CONFIG_H
15
#include <fc_config.h>
16
#endif
17
18
/* common */
19
#include "
unittype.h
"
20
21
22
#include "
aiactions.h
"
23
24
25
/**********************************************************************/
29
bool
aia_utype_is_considered_spy_vs_city
(
const
struct
unit_type
*putype)
30
{
31
return
(
utype_can_do_action_result
(putype, ACTRES_SPY_POISON)
32
||
utype_can_do_action_result
(putype, ACTRES_SPY_SPREAD_PLAGUE)
33
||
utype_can_do_action_result
(putype, ACTRES_SPY_SABOTAGE_CITY)
34
||
utype_can_do_action_result
(putype,
35
ACTRES_SPY_TARGETED_SABOTAGE_CITY)
36
||
utype_can_do_action_result
(putype,
37
ACTRES_SPY_SABOTAGE_CITY_PRODUCTION)
38
||
utype_can_do_action_result
(putype, ACTRES_SPY_INCITE_CITY)
39
||
utype_can_do_action_result
(putype, ACTRES_ESTABLISH_EMBASSY)
40
||
utype_can_do_action_result
(putype, ACTRES_SPY_STEAL_TECH)
41
||
utype_can_do_action_result
(putype,
42
ACTRES_SPY_TARGETED_STEAL_TECH)
43
||
utype_can_do_action_result
(putype, ACTRES_SPY_INVESTIGATE_CITY)
44
||
utype_can_do_action_result
(putype, ACTRES_SPY_STEAL_GOLD)
45
||
utype_can_do_action_result
(putype, ACTRES_STEAL_MAPS)
46
||
utype_can_do_action_result
(putype, ACTRES_SPY_NUKE));
47
}
48
49
/**********************************************************************/
53
bool
aia_utype_is_considered_spy
(
const
struct
unit_type
*putype)
54
{
55
return
(
aia_utype_is_considered_spy_vs_city
(putype)
56
||
utype_can_do_action_result
(putype,
57
ACTRES_SPY_ATTACK)
58
||
utype_can_do_action_result
(putype,
59
ACTRES_SPY_BRIBE_UNIT)
60
||
utype_can_do_action_result
(putype,
61
ACTRES_SPY_SABOTAGE_UNIT));
62
}
63
64
/**********************************************************************/
68
bool
aia_utype_is_considered_caravan_trade
(
const
struct
unit_type
*putype)
69
{
70
return
(
utype_can_do_action_result
(putype,
71
ACTRES_TRADE_ROUTE)
72
||
utype_can_do_action_result
(putype,
73
ACTRES_MARKETPLACE));
74
}
75
76
/**********************************************************************/
80
bool
aia_utype_is_considered_caravan
(
const
struct
unit_type
*putype)
81
{
82
return
(
aia_utype_is_considered_caravan_trade
(putype)
83
||
utype_can_do_action_result
(putype,
84
ACTRES_HELP_WONDER));
85
}
86
87
/**********************************************************************/
91
bool
aia_utype_is_considered_worker
(
const
struct
unit_type
*putype)
92
{
93
return
(
utype_can_do_action_result
(putype, ACTRES_TRANSFORM_TERRAIN)
94
||
utype_can_do_action_result
(putype, ACTRES_CULTIVATE)
95
||
utype_can_do_action_result
(putype, ACTRES_PLANT)
96
||
utype_can_do_action_result
(putype, ACTRES_ROAD)
97
||
utype_can_do_action_result
(putype, ACTRES_BASE)
98
||
utype_can_do_action_result
(putype, ACTRES_MINE)
99
||
utype_can_do_action_result
(putype, ACTRES_IRRIGATE)
100
||
utype_can_do_action_result
(putype, ACTRES_CLEAN_POLLUTION)
101
||
utype_can_do_action_result
(putype, ACTRES_CLEAN_FALLOUT));
102
}
aia_utype_is_considered_caravan_trade
bool aia_utype_is_considered_caravan_trade(const struct unit_type *putype)
Definition
aiactions.c:68
aia_utype_is_considered_spy_vs_city
bool aia_utype_is_considered_spy_vs_city(const struct unit_type *putype)
Definition
aiactions.c:29
aia_utype_is_considered_spy
bool aia_utype_is_considered_spy(const struct unit_type *putype)
Definition
aiactions.c:53
aia_utype_is_considered_caravan
bool aia_utype_is_considered_caravan(const struct unit_type *putype)
Definition
aiactions.c:80
aia_utype_is_considered_worker
bool aia_utype_is_considered_worker(const struct unit_type *putype)
Definition
aiactions.c:91
aiactions.h
unit_type
Definition
unittype.h:481
utype_can_do_action_result
bool utype_can_do_action_result(const struct unit_type *putype, enum action_result result)
Definition
unittype.c:459
unittype.h
Generated on Sun Jan 5 2025 22:00:34 for Freeciv-3.1 by
1.9.8