Freeciv-3.2
Loading...
Searching...
No Matches
effects.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__EFFECTS_H
14#define FC__EFFECTS_H
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
20/* utility */
21#include "support.h" /* bool type */
22
23/* common */
24#include "fc_types.h"
25
26#include "requirements.h"
27
28struct conn_list;
29struct multiplier;
30
31/* Type of effects. Add new values via SPECENUM_VALUE%d and
32 * SPECENUM_VALUE%dNAME at the end of the list.
33 * Used in the network protocol.
34 *
35 */
36#define SPECENUM_NAME effect_type
37#define SPECENUM_VALUE0 EFT_TECH_PARASITE
38#define SPECENUM_VALUE0NAME "Tech_Parasite"
39#define SPECENUM_VALUE1 EFT_AIRLIFT
40#define SPECENUM_VALUE1NAME "Airlift"
41#define SPECENUM_VALUE2 EFT_ANY_GOVERNMENT
42#define SPECENUM_VALUE2NAME "Any_Government"
43#define SPECENUM_VALUE3 EFT_CAPITAL_CITY
44#define SPECENUM_VALUE3NAME "Capital_City"
45#define SPECENUM_VALUE4 EFT_ENABLE_NUKE
46#define SPECENUM_VALUE4NAME "Enable_Nuke"
47#define SPECENUM_VALUE5 EFT_ENABLE_SPACE
48#define SPECENUM_VALUE5NAME "Enable_Space"
49#define SPECENUM_VALUE6 EFT_SPECIALIST_OUTPUT
50#define SPECENUM_VALUE6NAME "Specialist_Output"
51#define SPECENUM_VALUE7 EFT_OUTPUT_BONUS
52#define SPECENUM_VALUE7NAME "Output_Bonus"
53#define SPECENUM_VALUE8 EFT_OUTPUT_BONUS_2
54#define SPECENUM_VALUE8NAME "Output_Bonus_2"
55/* add to each worked tile */
56#define SPECENUM_VALUE9 EFT_OUTPUT_ADD_TILE
57#define SPECENUM_VALUE9NAME "Output_Add_Tile"
58/* add to each worked tile that already has output */
59#define SPECENUM_VALUE10 EFT_OUTPUT_INC_TILE
60#define SPECENUM_VALUE10NAME "Output_Inc_Tile"
61/* increase tile output by given % */
62#define SPECENUM_VALUE11 EFT_OUTPUT_PER_TILE
63#define SPECENUM_VALUE11NAME "Output_Per_Tile"
64#define SPECENUM_VALUE12 EFT_OUTPUT_WASTE_PCT
65#define SPECENUM_VALUE12NAME "Output_Waste_Pct"
66#define SPECENUM_VALUE13 EFT_FORCE_CONTENT
67#define SPECENUM_VALUE13NAME "Force_Content"
68/* TODO: EFT_FORCE_CONTENT_PCT */
69#define SPECENUM_VALUE14 EFT_GIVE_IMM_TECH
70#define SPECENUM_VALUE14NAME "Give_Imm_Tech"
71#define SPECENUM_VALUE15 EFT_GROWTH_FOOD
72#define SPECENUM_VALUE15NAME "Growth_Food"
73#define SPECENUM_VALUE16 EFT_SHRINK_FOOD
74#define SPECENUM_VALUE16NAME "Shrink_Food"
75#define SPECENUM_VALUE17 EFT_HAVE_EMBASSIES
76#define SPECENUM_VALUE17NAME "Have_Embassies"
77#define SPECENUM_VALUE18 EFT_MAKE_CONTENT
78#define SPECENUM_VALUE18NAME "Make_Content"
79#define SPECENUM_VALUE19 EFT_MAKE_CONTENT_MIL
80#define SPECENUM_VALUE19NAME "Make_Content_Mil"
81#define SPECENUM_VALUE20 EFT_MAKE_CONTENT_MIL_PER
82#define SPECENUM_VALUE20NAME "Make_Content_Mil_Per"
83/* TODO: EFT_MAKE_CONTENT_PCT */
84#define SPECENUM_VALUE21 EFT_MAKE_HAPPY
85#define SPECENUM_VALUE21NAME "Make_Happy"
86#define SPECENUM_VALUE22 EFT_NO_ANARCHY
87#define SPECENUM_VALUE22NAME "No_Anarchy"
88#define SPECENUM_VALUE23 EFT_NUKE_PROOF
89#define SPECENUM_VALUE23NAME "Nuke_Proof"
90/* TODO: EFT_POLLU_ADJ */
91/* TODO: EFT_POLLU_PCT */
92/* TODO: EFT_POLLU_POP_ADJ */
93#define SPECENUM_VALUE24 EFT_POLLU_POP_PCT
94#define SPECENUM_VALUE24NAME "Pollu_Pop_Pct"
95#define SPECENUM_VALUE25 EFT_POLLU_POP_PCT_2
96#define SPECENUM_VALUE25NAME "Pollu_Pop_Pct_2"
97/* TODO: EFT_POLLU_PROD_ADJ */
98#define SPECENUM_VALUE26 EFT_POLLU_PROD_PCT
99#define SPECENUM_VALUE26NAME "Pollu_Prod_Pct"
100/* TODO: EFT_PROD_PCT */
101#define SPECENUM_VALUE27 EFT_REVEAL_CITIES
102#define SPECENUM_VALUE27NAME "Reveal_Cities"
103#define SPECENUM_VALUE28 EFT_REVEAL_MAP
104#define SPECENUM_VALUE28NAME "Reveal_Map"
105/* TODO: EFT_INCITE_DIST_ADJ */
106#define SPECENUM_VALUE29 EFT_INCITE_COST_PCT
107#define SPECENUM_VALUE29NAME "Incite_Cost_Pct"
108#define SPECENUM_VALUE30 EFT_SIZE_ADJ
109#define SPECENUM_VALUE30NAME "Size_Adj"
110#define SPECENUM_VALUE31 EFT_SIZE_UNLIMIT
111#define SPECENUM_VALUE31NAME "Size_Unlimit"
112#define SPECENUM_VALUE32 EFT_SS_STRUCTURAL
113#define SPECENUM_VALUE32NAME "SS_Structural"
114#define SPECENUM_VALUE33 EFT_SS_COMPONENT
115#define SPECENUM_VALUE33NAME "SS_Component"
116#define SPECENUM_VALUE34 EFT_SS_MODULE
117#define SPECENUM_VALUE34NAME "SS_Module"
118#define SPECENUM_VALUE35 EFT_SPY_RESISTANT
119#define SPECENUM_VALUE35NAME "Spy_Resistant"
120#define SPECENUM_VALUE36 EFT_MOVE_BONUS
121#define SPECENUM_VALUE36NAME "Move_Bonus"
122#define SPECENUM_VALUE37 EFT_UNIT_NO_LOSE_POP
123#define SPECENUM_VALUE37NAME "Unit_No_Lose_Pop"
124#define SPECENUM_VALUE38 EFT_UNIT_RECOVER
125#define SPECENUM_VALUE38NAME "Unit_Recover"
126#define SPECENUM_VALUE39 EFT_UPGRADE_UNIT
127#define SPECENUM_VALUE39NAME "Upgrade_Unit"
128#define SPECENUM_VALUE40 EFT_UPKEEP_FREE
129#define SPECENUM_VALUE40NAME "Upkeep_Free"
130#define SPECENUM_VALUE41 EFT_TECH_UPKEEP_FREE
131#define SPECENUM_VALUE41NAME "Tech_Upkeep_Free"
132#define SPECENUM_VALUE42 EFT_NO_UNHAPPY
133#define SPECENUM_VALUE42NAME "No_Unhappy"
134#define SPECENUM_VALUE43 EFT_VETERAN_BUILD
135#define SPECENUM_VALUE43NAME "Veteran_Build"
136#define SPECENUM_VALUE44 EFT_VETERAN_COMBAT
137#define SPECENUM_VALUE44NAME "Veteran_Combat"
138#define SPECENUM_VALUE45 EFT_HP_REGEN
139#define SPECENUM_VALUE45NAME "HP_Regen"
140#define SPECENUM_VALUE46 EFT_CITY_VISION_RADIUS_SQ
141#define SPECENUM_VALUE46NAME "City_Vision_Radius_Sq"
142#define SPECENUM_VALUE47 EFT_UNIT_VISION_RADIUS_SQ
143#define SPECENUM_VALUE47NAME "Unit_Vision_Radius_Sq"
144/* Interacts with UTYF_BADWALLATTACKER */
145#define SPECENUM_VALUE48 EFT_DEFEND_BONUS
146#define SPECENUM_VALUE48NAME "Defend_Bonus"
147#define SPECENUM_VALUE49 EFT_TRADE_ROUTE_PCT
148/* FIXME: -> "Trade_Route_Pct" */
149#define SPECENUM_VALUE49NAME "Traderoute_Pct"
150#define SPECENUM_VALUE50 EFT_GAIN_AI_LOVE
151#define SPECENUM_VALUE50NAME "Gain_AI_Love"
152#define SPECENUM_VALUE51 EFT_TURN_YEARS
153#define SPECENUM_VALUE51NAME "Turn_Years"
154#define SPECENUM_VALUE52 EFT_SLOW_DOWN_TIMELINE
155#define SPECENUM_VALUE52NAME "Slow_Down_Timeline"
156#define SPECENUM_VALUE53 EFT_CIVIL_WAR_CHANCE
157#define SPECENUM_VALUE53NAME "Civil_War_Chance"
158/* change of the migration score */
159#define SPECENUM_VALUE54 EFT_MIGRATION_PCT
160#define SPECENUM_VALUE54NAME "Migration_Pct"
161/* +1 unhappy when more than this cities */
162#define SPECENUM_VALUE55 EFT_EMPIRE_SIZE_BASE
163#define SPECENUM_VALUE55NAME "Empire_Size_Base"
164/* adds additional +1 unhappy steps to above */
165#define SPECENUM_VALUE56 EFT_EMPIRE_SIZE_STEP
166#define SPECENUM_VALUE56NAME "Empire_Size_Step"
167#define SPECENUM_VALUE57 EFT_MAX_RATES
168#define SPECENUM_VALUE57NAME "Max_Rates"
169#define SPECENUM_VALUE58 EFT_MARTIAL_LAW_EACH
170#define SPECENUM_VALUE58NAME "Martial_Law_Each"
171#define SPECENUM_VALUE59 EFT_MARTIAL_LAW_MAX
172#define SPECENUM_VALUE59NAME "Martial_Law_Max"
173#define SPECENUM_VALUE60 EFT_RAPTURE_GROW
174#define SPECENUM_VALUE60NAME "Rapture_Grow"
175#define SPECENUM_VALUE61 EFT_REVOLUTION_UNHAPPINESS
176#define SPECENUM_VALUE61NAME "Revolution_Unhappiness"
177#define SPECENUM_VALUE62 EFT_HAS_SENATE
178#define SPECENUM_VALUE62NAME "Has_Senate"
179#define SPECENUM_VALUE63 EFT_INSPIRE_PARTISANS
180#define SPECENUM_VALUE63NAME "Inspire_Partisans"
181#define SPECENUM_VALUE64 EFT_HAPPINESS_TO_GOLD
182#define SPECENUM_VALUE64NAME "Happiness_To_Gold"
183/* stupid special case; we hate it */
184#define SPECENUM_VALUE65 EFT_FANATICS
185#define SPECENUM_VALUE65NAME "Fanatics"
186#define SPECENUM_VALUE66 EFT_NO_DIPLOMACY
187#define SPECENUM_VALUE66NAME "No_Diplomacy"
188#define SPECENUM_VALUE67 EFT_TRADE_REVENUE_BONUS
189#define SPECENUM_VALUE67NAME "Trade_Revenue_Bonus"
190/* multiply unhappy upkeep by this effect */
191#define SPECENUM_VALUE68 EFT_UNHAPPY_FACTOR
192#define SPECENUM_VALUE68NAME "Unhappy_Factor"
193/* multiply upkeep by this effect */
194#define SPECENUM_VALUE69 EFT_UPKEEP_FACTOR
195#define SPECENUM_VALUE69NAME "Upkeep_Factor"
196/* this many units are free from upkeep */
197#define SPECENUM_VALUE70 EFT_UNIT_UPKEEP_FREE_PER_CITY
198#define SPECENUM_VALUE70NAME "Unit_Upkeep_Free_Per_City"
199#define SPECENUM_VALUE71 EFT_OUTPUT_WASTE
200#define SPECENUM_VALUE71NAME "Output_Waste"
201#define SPECENUM_VALUE72 EFT_OUTPUT_WASTE_BY_DISTANCE
202#define SPECENUM_VALUE72NAME "Output_Waste_By_Distance"
203/* -1 penalty to tiles producing more than this */
204#define SPECENUM_VALUE73 EFT_OUTPUT_PENALTY_TILE
205#define SPECENUM_VALUE73NAME "Output_Penalty_Tile"
206#define SPECENUM_VALUE74 EFT_OUTPUT_INC_TILE_CELEBRATE
207#define SPECENUM_VALUE74NAME "Output_Inc_Tile_Celebrate"
208/* all citizens after this are unhappy */
209#define SPECENUM_VALUE75 EFT_CITY_UNHAPPY_SIZE
210#define SPECENUM_VALUE75NAME "City_Unhappy_Size"
211/* add to default squared city radius */
212#define SPECENUM_VALUE76 EFT_CITY_RADIUS_SQ
213#define SPECENUM_VALUE76NAME "City_Radius_Sq"
214/* number of build slots for units */
215#define SPECENUM_VALUE77 EFT_CITY_BUILD_SLOTS
216#define SPECENUM_VALUE77NAME "City_Build_Slots"
217#define SPECENUM_VALUE78 EFT_UPGRADE_PRICE_PCT
218#define SPECENUM_VALUE78NAME "Upgrade_Price_Pct"
219/* City should use walls gfx */
220#define SPECENUM_VALUE79 EFT_VISIBLE_WALLS
221#define SPECENUM_VALUE79NAME "Visible_Walls"
222#define SPECENUM_VALUE80 EFT_TECH_COST_FACTOR
223#define SPECENUM_VALUE80NAME "Tech_Cost_Factor"
224/* [x%] gold upkeep instead of [1] shield upkeep for units */
225#define SPECENUM_VALUE81 EFT_SHIELD2GOLD_FACTOR
226#define SPECENUM_VALUE81NAME "Shield2Gold_Factor"
227#define SPECENUM_VALUE82 EFT_TILE_WORKABLE
228#define SPECENUM_VALUE82NAME "Tile_Workable"
229/* The index for the city image of the given city style. */
230#define SPECENUM_VALUE83 EFT_CITY_IMAGE
231#define SPECENUM_VALUE83NAME "City_Image"
232#define SPECENUM_VALUE84 EFT_IMPR_BUILD_COST_PCT
233#define SPECENUM_VALUE84NAME "Building_Build_Cost_Pct"
234#define SPECENUM_VALUE85 EFT_MAX_TRADE_ROUTES
235#define SPECENUM_VALUE85NAME "Max_Trade_Routes"
236#define SPECENUM_VALUE86 EFT_GOV_CENTER
237#define SPECENUM_VALUE86NAME "Gov_Center"
238#define SPECENUM_VALUE87 EFT_COMBAT_ROUNDS
239#define SPECENUM_VALUE87NAME "Combat_Rounds"
240#define SPECENUM_VALUE88 EFT_IMPR_BUY_COST_PCT
241#define SPECENUM_VALUE88NAME "Building_Buy_Cost_Pct"
242#define SPECENUM_VALUE89 EFT_UNIT_BUILD_COST_PCT
243#define SPECENUM_VALUE89NAME "Unit_Build_Cost_Pct"
244#define SPECENUM_VALUE90 EFT_UNIT_BUY_COST_PCT
245#define SPECENUM_VALUE90NAME "Unit_Buy_Cost_Pct"
246#define SPECENUM_VALUE91 EFT_NOT_TECH_SOURCE
247#define SPECENUM_VALUE91NAME "Not_Tech_Source"
248#define SPECENUM_VALUE92 EFT_ENEMY_CITIZEN_UNHAPPY_PCT
249#define SPECENUM_VALUE92NAME "Enemy_Citizen_Unhappy_Pct"
250#define SPECENUM_VALUE93 EFT_IRRIGATION_PCT
251#define SPECENUM_VALUE93NAME "Irrigation_Pct"
252#define SPECENUM_VALUE94 EFT_MINING_PCT
253#define SPECENUM_VALUE94NAME "Mining_Pct"
254#define SPECENUM_VALUE95 EFT_OUTPUT_TILE_PUNISH_PCT
255#define SPECENUM_VALUE95NAME "Output_Tile_Punish_Pct"
256#define SPECENUM_VALUE96 EFT_UNIT_BRIBE_COST_PCT
257#define SPECENUM_VALUE96NAME "Unit_Bribe_Cost_Pct"
258#define SPECENUM_VALUE97 EFT_VICTORY
259#define SPECENUM_VALUE97NAME "Victory"
260#define SPECENUM_VALUE98 EFT_PERFORMANCE
261#define SPECENUM_VALUE98NAME "Performance"
262#define SPECENUM_VALUE99 EFT_HISTORY
263#define SPECENUM_VALUE99NAME "History"
264#define SPECENUM_VALUE100 EFT_NATION_PERFORMANCE
265#define SPECENUM_VALUE100NAME "National_Performance"
266#define SPECENUM_VALUE101 EFT_NATION_HISTORY
267#define SPECENUM_VALUE101NAME "National_History"
268#define SPECENUM_VALUE102 EFT_TURN_FRAGMENTS
269#define SPECENUM_VALUE102NAME "Turn_Fragments"
270#define SPECENUM_VALUE103 EFT_MAX_STOLEN_GOLD_PM
271#define SPECENUM_VALUE103NAME "Max_Stolen_Gold_Pm"
272#define SPECENUM_VALUE104 EFT_THIEFS_SHARE_PM
273#define SPECENUM_VALUE104NAME "Thiefs_Share_Pm"
274#define SPECENUM_VALUE105 EFT_RETIRE_PCT
275#define SPECENUM_VALUE105NAME "Retire_Pct"
276#define SPECENUM_VALUE106 EFT_ILLEGAL_ACTION_MOVE_COST
277#define SPECENUM_VALUE106NAME "Illegal_Action_Move_Cost"
278#define SPECENUM_VALUE107 EFT_HAVE_CONTACTS
279#define SPECENUM_VALUE107NAME "Have_Contacts"
280#define SPECENUM_VALUE108 EFT_CASUS_BELLI_CAUGHT
281#define SPECENUM_VALUE108NAME "Casus_Belli_Caught"
282#define SPECENUM_VALUE109 EFT_CASUS_BELLI_SUCCESS
283#define SPECENUM_VALUE109NAME "Casus_Belli_Success"
284#define SPECENUM_VALUE110 EFT_ACTION_ODDS_PCT
285#define SPECENUM_VALUE110NAME "Action_Odds_Pct"
286#define SPECENUM_VALUE111 EFT_BORDER_VISION
287#define SPECENUM_VALUE111NAME "Border_Vision"
288#define SPECENUM_VALUE112 EFT_STEALINGS_IGNORE
289#define SPECENUM_VALUE112NAME "Stealings_Ignore"
290#define SPECENUM_VALUE113 EFT_OUTPUT_WASTE_BY_REL_DISTANCE
291#define SPECENUM_VALUE113NAME "Output_Waste_By_Rel_Distance"
292#define SPECENUM_VALUE114 EFT_SABOTEUR_RESISTANT
293#define SPECENUM_VALUE114NAME "Building_Saboteur_Resistant"
294#define SPECENUM_VALUE115 EFT_UNIT_SLOTS
295#define SPECENUM_VALUE115NAME "Unit_Slots"
296#define SPECENUM_VALUE116 EFT_ATTACK_BONUS
297#define SPECENUM_VALUE116NAME "Attack_Bonus"
298#define SPECENUM_VALUE117 EFT_CONQUEST_TECH_PCT
299#define SPECENUM_VALUE117NAME "Conquest_Tech_Pct"
300#define SPECENUM_VALUE118 EFT_ACTION_SUCCESS_MOVE_COST
301#define SPECENUM_VALUE118NAME "Action_Success_Actor_Move_Cost"
302#define SPECENUM_VALUE119 EFT_ACTION_SUCCESS_TARGET_MOVE_COST
303#define SPECENUM_VALUE119NAME "Action_Success_Target_Move_Cost"
304#define SPECENUM_VALUE120 EFT_INFRA_POINTS
305#define SPECENUM_VALUE120NAME "Infra_Points"
306#define SPECENUM_VALUE121 EFT_FORTIFY_DEFENSE_BONUS
307#define SPECENUM_VALUE121NAME "Fortify_Defense_Bonus"
308#define SPECENUM_VALUE122 EFT_MAPS_STOLEN_PCT
309#define SPECENUM_VALUE122NAME "Maps_Stolen_Pct"
310#define SPECENUM_VALUE123 EFT_UNIT_SHIELD_VALUE_PCT
311#define SPECENUM_VALUE123NAME "Unit_Shield_Value_Pct"
312#define SPECENUM_VALUE124 EFT_CASUS_BELLI_COMPLETE
313#define SPECENUM_VALUE124NAME "Casus_Belli_Complete"
314#define SPECENUM_VALUE125 EFT_ILLEGAL_ACTION_HP_COST
315#define SPECENUM_VALUE125NAME "Illegal_Action_HP_Cost"
316#define SPECENUM_VALUE126 EFT_POPCOST_FREE
317#define SPECENUM_VALUE126NAME "Popcost_Free"
318#define SPECENUM_VALUE127 EFT_HEAL_UNIT_PCT
319#define SPECENUM_VALUE127NAME "Heal_Unit_Pct"
320#define SPECENUM_VALUE128 EFT_NUKE_BLAST_RADIUS_1_SQ
321#define SPECENUM_VALUE128NAME "Nuke_Blast_Radius_1_Sq"
322#define SPECENUM_VALUE129 EFT_BORDER_STRENGTH_PCT
323#define SPECENUM_VALUE129NAME "Border_Strength_Pct"
324#define SPECENUM_VALUE130 EFT_ACTION_RESIST_PCT
325#define SPECENUM_VALUE130NAME "Action_Resist_Pct"
326#define SPECENUM_VALUE131 EFT_OUTPUT_BONUS_ABSOLUTE
327#define SPECENUM_VALUE131NAME "Output_Bonus_Absolute"
328#define SPECENUM_VALUE132 EFT_MIN_HP_PCT
329#define SPECENUM_VALUE132NAME "Min_HP_Pct"
330#define SPECENUM_VALUE133 EFT_HP_REGEN_2
331#define SPECENUM_VALUE133NAME "HP_Regen_2"
332#define SPECENUM_VALUE134 EFT_TECH_PARASITE_PCT_MAX
333#define SPECENUM_VALUE134NAME "Tech_Parasite_Pct_Max"
334/* Reduced illness due to buildings ... */
335#define SPECENUM_VALUE135 EFT_HEALTH_PCT
336#define SPECENUM_VALUE135NAME "Health_Pct"
337#define SPECENUM_VALUE136 EFT_ACTIVITY_TIME
338#define SPECENUM_VALUE136NAME "Activity_Time"
339#define SPECENUM_VALUE137 EFT_SURPLUS_WASTE_PCT
340#define SPECENUM_VALUE137NAME "Surplus_Waste_Pct"
341#define SPECENUM_VALUE138 EFT_SURPLUS_WASTE_PCT_BY_REL_DISTANCE
342#define SPECENUM_VALUE138NAME "Surplus_Waste_Pct_By_Rel_Distance"
343#define SPECENUM_VALUE139 EFT_IMPR_UPKEEP_REDUCTION
344#define SPECENUM_VALUE139NAME "Impr_Upkeep_Reduction"
345/* Ruleset specific effects for use from Lua scripts */
346#define SPECENUM_VALUE140 EFT_USER_EFFECT_1
347#define SPECENUM_VALUE140NAME "User_Effect_1"
348#define SPECENUM_VALUE141 EFT_USER_EFFECT_2
349#define SPECENUM_VALUE141NAME "User_Effect_2"
350#define SPECENUM_VALUE142 EFT_USER_EFFECT_3
351#define SPECENUM_VALUE142NAME "User_Effect_3"
352#define SPECENUM_VALUE143 EFT_USER_EFFECT_4
353#define SPECENUM_VALUE143NAME "User_Effect_4"
354/* Keep this last */
355#define SPECENUM_COUNT EFT_COUNT
356#include "specenum_gen.h"
357
358#define EFT_USER_EFFECT_LAST EFT_USER_EFFECT_4
359
360#define USER_EFFECT_NUMBER(eff) (eff - EFT_USER_EFFECT_1)
361
362/* An effect is provided by a source. If the source is present, and the
363 * other conditions (described below) are met, the effect will be active.
364 * Note the difference between effect and effect_type. */
365struct effect {
366 enum effect_type type;
367
368 /* Pointer to multipliers (NULL means that this effect has no multiplier */
370
371 /* The "value" of the effect. The meaning of this varies between
372 * effects. When get_xxx_bonus() is called the value of all applicable
373 * effects will be summed up. */
374 int value;
375
376 /* An effect can have multiple requirements. The effect will only be
377 * active if all of these requirement are met. */
379
380 /* Only relevant for ruledit and other rulesave users. */
381 struct {
382 /* Indicates that this effect is deleted and shouldn't be saved. */
384
385 /* Comment field to save. While an entry in the ini-file, not
386 * used by freeciv. */
387 char *comment;
389};
390
391/* A callback type that takes an individual effect and a context for it
392 * and tells its weighted (by probability or something) value.
393 */
394typedef double
395 (*eft_value_filter_cb)(const struct effect *eft,
396 const struct req_context *context,
397 const struct player *other_player,
398 void *data, int n_data);
399
400/* An effect_list is a list of effects. */
401#define SPECLIST_TAG effect
402#define SPECLIST_TYPE struct effect
403#include "speclist.h"
404#define effect_list_iterate(effect_list, peffect) \
405 TYPED_LIST_ITERATE(struct effect, effect_list, peffect)
406#define effect_list_iterate_end LIST_ITERATE_END
407
408struct effect *effect_new(enum effect_type type, int value,
409 struct multiplier *pmul);
410struct effect *effect_copy(struct effect *old,
411 enum effect_type override_type);
412void effect_free(struct effect *peffect);
413void effect_remove(struct effect *peffect);
414void effect_req_append(struct effect *peffect, struct requirement req);
415
416struct astring;
417void get_effect_req_text(const struct effect *peffect,
418 char *buf, size_t buf_len);
420 struct astring *astr);
421
422/* ruleset cache creation and communication functions */
424
425void ruleset_cache_init(void);
426void ruleset_cache_free(void);
427void recv_ruleset_effect(const struct packet_ruleset_effect *packet);
428void send_ruleset_cache(struct conn_list *dest);
429
431 size_t n_unis);
433
435 struct universal *unis, size_t n_unis);
436
438 struct universal *unis,
439 size_t n_unis,
440 int min_value);
441
443
444bool is_building_replaced(const struct city *pcity,
445 const struct impr_type *pimprove,
446 const enum req_problem_type prob_type);
447
448/* Functions to know the bonuses a certain effect is granting */
450int get_player_bonus(const struct player *plr, enum effect_type effect_type);
451int get_city_bonus(const struct city *pcity, enum effect_type effect_type);
452int get_tile_bonus(const struct tile *ptile, enum effect_type effect_type);
453int get_city_specialist_output_bonus(const struct city *pcity,
454 const struct specialist *pspecialist,
455 const struct output_type *poutput,
457int get_city_tile_output_bonus(const struct city *pcity,
458 const struct tile *ptile,
459 const struct output_type *poutput,
461int get_tile_output_bonus(const struct city *pcity,
462 const struct tile *ptile,
463 const struct output_type *poutput,
465int get_player_output_bonus(const struct player *pplayer,
466 const struct output_type *poutput,
468int get_city_output_bonus(const struct city *pcity,
469 const struct output_type *poutput,
471int get_building_bonus(const struct city *pcity,
472 const struct impr_type *building,
474int get_unittype_bonus(const struct player *pplayer,
475 const struct tile *ptile, /* pcity is implied */
476 const struct unit_type *punittype,
477 const struct action *paction,
479int get_unit_bonus(const struct unit *punit, enum effect_type effect_type);
480int get_unit_vs_tile_bonus(const struct tile *ptile,
481 const struct unit *punit,
482 enum effect_type etype);
483
484/* Miscellaneous auxiliary effects functions */
486
488 const struct player *pplayer,
489 enum effect_type effect_type);
491 const struct city *pcity,
492 const struct output_type *poutput,
493 enum effect_type effect_type);
494
496 const struct req_context *context,
497 const struct player *other_player,
498 enum effect_type effect_type);
500 const struct player *other_player,
501 enum effect_type effect_type,
503 void *data, int n_data)
505
506bool building_has_effect(const struct impr_type *pimprove,
507 enum effect_type effect_type);
508int get_current_construction_bonus(const struct city *pcity,
509 enum effect_type effect_type,
510 const enum req_problem_type prob_type);
511int get_potential_improvement_bonus(const struct impr_type *pimprove,
512 const struct city *pcity,
513 enum effect_type effect_type,
514 const enum req_problem_type prob_type,
516
517struct effect_list *get_effects(enum effect_type effect_type);
518
519typedef bool (*iec_cb)(struct effect*, void *data);
520bool iterate_effect_cache(iec_cb cb, void *data);
521
522bool is_user_effect(enum effect_type eff);
523enum effect_type user_effect_ai_valued_as(enum effect_type);
524void user_effect_ai_valued_set(enum effect_type tgt, enum effect_type valued_as);
525
526#ifdef __cplusplus
527}
528#endif /* __cplusplus */
529
530#endif /* FC__EFFECTS_H */
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
void effect_remove(struct effect *peffect)
Definition effects.c:230
void recv_ruleset_effect(const struct packet_ruleset_effect *packet)
Definition effects.c:591
bool effect_universals_value_never_below(enum effect_type type, struct universal *unis, size_t n_unis, int min_value)
Definition effects.c:545
int get_tile_output_bonus(const struct city *pcity, const struct tile *ptile, const struct output_type *poutput, enum effect_type effect_type)
Definition effects.c:940
int get_player_output_bonus(const struct player *pplayer, const struct output_type *poutput, enum effect_type effect_type)
Definition effects.c:961
int get_city_specialist_output_bonus(const struct city *pcity, const struct specialist *pspecialist, const struct output_type *poutput, enum effect_type effect_type)
Definition effects.c:885
bool is_building_replaced(const struct city *pcity, const struct impr_type *pimprove, const enum req_problem_type prob_type)
Definition effects.c:698
int get_target_bonus_effects(struct effect_list *plist, const struct req_context *context, const struct player *other_player, enum effect_type effect_type)
Definition effects.c:748
int get_player_bonus_effects(struct effect_list *plist, const struct player *pplayer, enum effect_type effect_type)
Definition effects.c:1130
bool iterate_effect_cache(iec_cb cb, void *data)
Definition effects.c:1323
int get_city_bonus(const struct city *pcity, enum effect_type effect_type)
Definition effects.c:846
int get_current_construction_bonus(const struct city *pcity, enum effect_type effect_type, const enum req_problem_type prob_type)
Definition effects.c:1182
int get_city_bonus_effects(struct effect_list *plist, const struct city *pcity, const struct output_type *poutput, enum effect_type effect_type)
Definition effects.c:1153
double(* eft_value_filter_cb)(const struct effect *eft, const struct req_context *context, const struct player *other_player, void *data, int n_data)
Definition effects.h:395
int get_unit_vs_tile_bonus(const struct tile *ptile, const struct unit *punit, enum effect_type etype)
Definition effects.c:1094
int get_unit_bonus(const struct unit *punit, enum effect_type effect_type)
Definition effects.c:1070
double get_effect_expected_value(const struct req_context *context, const struct player *other_player, enum effect_type effect_type, eft_value_filter_cb weighter, void *data, int n_data) fc__attribute((nonnull(4)))
Definition effects.c:793
int get_city_output_bonus(const struct city *pcity, const struct output_type *poutput, enum effect_type effect_type)
Definition effects.c:984
int get_potential_improvement_bonus(const struct impr_type *pimprove, const struct city *pcity, enum effect_type effect_type, const enum req_problem_type prob_type, bool consider_multipliers)
Definition effects.c:1204
void send_ruleset_cache(struct conn_list *dest)
Definition effects.c:610
void get_effect_req_text(const struct effect *peffect, char *buf, size_t buf_len)
Definition effects.c:1275
bool(* iec_cb)(struct effect *, void *data)
Definition effects.h:519
int get_player_bonus(const struct player *plr, enum effect_type effect_type)
Definition effects.c:828
void ruleset_cache_free(void)
Definition effects.c:329
struct effect * effect_new(enum effect_type type, int value, struct multiplier *pmul)
Definition effects.c:186
int get_building_bonus(const struct city *pcity, const struct impr_type *building, enum effect_type effect_type)
Definition effects.c:1008
int effect_value_from_universals(enum effect_type type, struct universal *unis, size_t n_unis)
Definition effects.c:459
int get_city_tile_output_bonus(const struct city *pcity, const struct tile *ptile, const struct output_type *poutput, enum effect_type effect_type)
Definition effects.c:916
void user_effect_ai_valued_set(enum effect_type tgt, enum effect_type valued_as)
Definition effects.c:1348
struct effect * effect_copy(struct effect *old, enum effect_type override_type)
Definition effects.c:246
int effect_cumulative_max(enum effect_type type, struct universal *unis, size_t n_unis)
Definition effects.c:388
void effect_free(struct effect *peffect)
Definition effects.c:216
void ruleset_cache_init(void)
Definition effects.c:297
enum effect_type user_effect_ai_valued_as(enum effect_type)
Definition effects.c:1359
int get_world_bonus(enum effect_type effect_type)
Definition effects.c:816
int effect_cumulative_min(enum effect_type type, struct universal *for_uni)
Definition effects.c:424
struct effect_list * get_effects(enum effect_type effect_type)
Definition effects.c:143
struct effect_list * get_req_source_effects(const struct universal *psource)
Definition effects.c:153
bool building_has_effect(const struct impr_type *pimprove, enum effect_type effect_type)
Definition effects.c:644
void effect_req_append(struct effect *peffect, struct requirement req)
Definition effects.c:266
int get_tile_bonus(const struct tile *ptile, enum effect_type effect_type)
Definition effects.c:866
int get_unittype_bonus(const struct player *pplayer, const struct tile *ptile, const struct unit_type *punittype, const struct action *paction, enum effect_type effect_type)
Definition effects.c:1035
void get_effect_list_req_text(const struct effect_list *plist, struct astring *astr)
Definition effects.c:1303
bool is_user_effect(enum effect_type eff)
Definition effects.c:1339
int effect_value_will_make_positive(enum effect_type type)
Definition effects.c:582
req_problem_type
Definition fc_types.h:699
GType type
Definition repodlgs.c:1313
Definition city.h:320
int value
Definition effects.h:374
char * comment
Definition effects.h:387
struct multiplier * multiplier
Definition effects.h:369
bool do_not_save
Definition effects.h:383
struct effect::@23 rulesave
struct requirement_vector reqs
Definition effects.h:378
enum effect_type type
Definition effects.h:366
enum effect_type effect_type
Definition tile.h:50
Definition unit.h:138
#define fc__attribute(x)
Definition support.h:99
#define bool
Definition support.h:71