Freeciv-3.3: /fast/freeciv/nightly/main/common/aicore/aiactions.c Source File

Freeciv-3.3

Loading...
Searching...
No Matches
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#include "aiactions.h"
22
23/**********************************************************************/
27 bool aia_utype_is_considered_spy_vs_city(const struct unit_type *putype)
28{
29 return (utype_can_do_action_result(putype, ACTRES_SPY_POISON)
30 || utype_can_do_action_result(putype, ACTRES_SPY_SPREAD_PLAGUE)
31 || utype_can_do_action_result(putype, ACTRES_SPY_SABOTAGE_CITY)
32 || utype_can_do_action_result(putype,
33 ACTRES_SPY_TARGETED_SABOTAGE_CITY)
34 || utype_can_do_action_result(putype,
35 ACTRES_SPY_SABOTAGE_CITY_PRODUCTION)
36 || utype_can_do_action_result(putype, ACTRES_SPY_INCITE_CITY)
37 || utype_can_do_action_result(putype, ACTRES_ESTABLISH_EMBASSY)
38 || utype_can_do_action_result(putype, ACTRES_SPY_STEAL_TECH)
39 || utype_can_do_action_result(putype,
40 ACTRES_SPY_TARGETED_STEAL_TECH)
41 || utype_can_do_action_result(putype, ACTRES_SPY_INVESTIGATE_CITY)
42 || utype_can_do_action_result(putype, ACTRES_SPY_STEAL_GOLD)
43 || utype_can_do_action_result(putype, ACTRES_STEAL_MAPS)
44 || utype_can_do_action_result(putype, ACTRES_SPY_NUKE));
45}
46
47/**********************************************************************/
51 bool aia_utype_is_considered_spy(const struct unit_type *putype)
52{
53 return (aia_utype_is_considered_spy_vs_city(putype)
54 || utype_can_do_action_result(putype,
55 ACTRES_SPY_ATTACK)
56 || utype_can_do_action_result(putype,
57 ACTRES_SPY_BRIBE_UNIT)
58 || utype_can_do_action_result(putype,
59 ACTRES_SPY_SABOTAGE_UNIT));
60}
61
62/**********************************************************************/
66 bool aia_utype_is_considered_caravan_trade(const struct unit_type *putype)
67{
68 return (utype_can_do_action_result(putype,
69 ACTRES_TRADE_ROUTE)
70 || utype_can_do_action_result(putype,
71 ACTRES_MARKETPLACE));
72}
73
74/**********************************************************************/
78 bool aia_utype_is_considered_caravan(const struct unit_type *putype)
79{
80 return (aia_utype_is_considered_caravan_trade(putype)
81 || utype_can_do_action_result(putype,
82 ACTRES_HELP_WONDER));
83}
84
85/**********************************************************************/
89 bool aia_utype_is_considered_worker(const struct unit_type *putype)
90{
91 return (utype_can_do_action_result(putype, ACTRES_TRANSFORM_TERRAIN)
92 || utype_can_do_action_result(putype, ACTRES_CULTIVATE)
93 || utype_can_do_action_result(putype, ACTRES_PLANT)
94 || utype_can_do_action_result(putype, ACTRES_ROAD)
95 || utype_can_do_action_result(putype, ACTRES_BASE)
96 || utype_can_do_action_result(putype, ACTRES_MINE)
97 || utype_can_do_action_result(putype, ACTRES_IRRIGATE)
98 || utype_can_do_action_result(putype, ACTRES_CLEAN));
99}
aia_utype_is_considered_caravan_trade
bool aia_utype_is_considered_caravan_trade(const struct unit_type *putype)
Definition aiactions.c:66
aia_utype_is_considered_spy_vs_city
bool aia_utype_is_considered_spy_vs_city(const struct unit_type *putype)
Definition aiactions.c:27
aia_utype_is_considered_spy
bool aia_utype_is_considered_spy(const struct unit_type *putype)
Definition aiactions.c:51
aia_utype_is_considered_caravan
bool aia_utype_is_considered_caravan(const struct unit_type *putype)
Definition aiactions.c:78
aia_utype_is_considered_worker
bool aia_utype_is_considered_worker(const struct unit_type *putype)
Definition aiactions.c:89
aiactions.h
incite_cost
char * incite_cost
Definition comments.c:74
unit_type
Definition unittype.h:507
utype_can_do_action_result
bool utype_can_do_action_result(const struct unit_type *putype, enum action_result result)
Definition unittype.c:387
unittype.h