72 const struct city *pcity,
int amount,
73 int num_cities,
int happiness_step)
93 if (city_list_size(pplayer->
cities)
96 factor += city_list_size(pplayer->
cities)
101 v += factor * num_cities * amount;
132 const struct city *pcity,
const bool capital,
133 int turns,
const struct effect *peffect,
134 const int c,
const int nplayers)
136 int amount = peffect->
value;
137 bool affects_sea_capable_units =
false;
138 bool affects_land_capable_units =
false;
164 switch (peffect->
type) {
166 case EFT_CAPITAL_CITY:
168 case EFT_UPKEEP_FREE:
169 case EFT_TECH_UPKEEP_FREE:
170 case EFT_POLLU_POP_PCT:
171 case EFT_POLLU_POP_PCT_2:
172 case EFT_POLLU_PROD_PCT:
173 case EFT_POLLU_TRADE_PCT:
174 case EFT_OUTPUT_BONUS:
175 case EFT_OUTPUT_BONUS_2:
176 case EFT_OUTPUT_ADD_TILE:
177 case EFT_OUTPUT_INC_TILE:
178 case EFT_OUTPUT_PER_TILE:
179 case EFT_OUTPUT_WASTE:
180 case EFT_OUTPUT_WASTE_BY_DISTANCE:
181 case EFT_OUTPUT_WASTE_BY_REL_DISTANCE:
182 case EFT_OUTPUT_WASTE_PCT:
183 case EFT_SPECIALIST_OUTPUT:
184 case EFT_ENEMY_CITIZEN_UNHAPPY_PCT:
185 case EFT_IRRIGATION_PCT:
187 case EFT_OUTPUT_TILE_PUNISH_PCT:
190 case EFT_CITY_VISION_RADIUS_SQ:
191 case EFT_UNIT_VISION_RADIUS_SQ:
199 case EFT_TURN_FRAGMENTS:
200 case EFT_SLOW_DOWN_TIMELINE:
205 case EFT_INCITE_COST_PCT:
206 v += c * amount / 100;
212 if (city_list_size(pplayer->
cities)
218 case EFT_UNIT_RECOVER:
226 case EFT_FORCE_CONTENT:
229 case EFT_MAKE_CONTENT:
232 case EFT_MAKE_CONTENT_MIL_PER:
238 v +=
MIN(amount, 5) * c;
241 case EFT_MAKE_CONTENT_MIL:
245 v += c *
MAX(amount + 2, 1);
248 case EFT_TECH_PARASITE: {
252 if (nplayers <= amount) {
259 int potential = (aplayer->server.bulbs_last_turn
260 + city_list_size(aplayer->cities) + 1);
273 value = bulbs * (1.0 - pow(1.0 - (1.0 /
MORT), turns)) *
MORT;
275 value = value * (100 -
game.
server.freecost) * (nplayers - amount)
276 / (nplayers * amount * 100);
284 case EFT_CONQUEST_TECH_PCT:
290 case EFT_GROWTH_FOOD:
293 case EFT_GROWTH_SURPLUS_PCT:
299 v += c * 5 + (amount / 5) * pcity->
server.illness;
307 case EFT_ANY_GOVERNMENT:
315 case EFT_ENABLE_NUKE:
317 v += 20 + adv->
stats.
units.suicide_attackers * 5;
319 case EFT_ENABLE_SPACE:
330 case EFT_GIVE_IMM_TECH:
332 v += amount * (
game.
info.sciencebox + 1);
335 case EFT_HAVE_CONTACTS: {
336 int new_contacts = 0;
346 v += 30 * new_contacts;
348 case EFT_HAVE_EMBASSIES:
351 case EFT_REVEAL_CITIES:
357 * (capital + 1) * amount / 100;
368 case EFT_SIZE_UNLIMIT:
398 v += 30 * extra_food;
402 v += c * amount * 4 / aqueduct_size;
405 case EFT_SS_STRUCTURAL:
406 case EFT_SS_COMPONENT:
416 case EFT_SPY_RESISTANT:
417 case EFT_SABOTEUR_RESISTANT:
422 v += (8 * v * amount + num);
424 case EFT_UNIT_NO_LOSE_POP:
425 v += unit_list_size(pcity->
tile->
units) * 2;
428 case EFT_HP_REGEN_MIN:
432 case EFT_VETERAN_COMBAT:
436 case EFT_VETERAN_BUILD:
439 v += amount * (3 * c + num);
441 case EFT_UPGRADE_UNIT:
444 }
else if (amount == 2) {
450 case EFT_UNIT_BRIBE_COST_PCT:
452 v += ((2 * c + num) * amount) / 400;
454 case EFT_ATTACK_BONUS:
456 v += (num + 4) * amount / 200;
458 case EFT_DEFEND_BONUS:
469 affects_sea_capable_units =
true;
471 if (pclass->adv.land_move !=
MOVE_NONE) {
472 affects_land_capable_units =
true;
475 if (affects_sea_capable_units && affects_land_capable_units) {
482 if (affects_sea_capable_units) {
500 if (capital || affects_land_capable_units) {
512 v += amount / (!adv->
threats.
igwall ? (18 - capital * 6) : 18);
517 case EFT_FORTIFY_DEFENSE_BONUS:
519 v += (num + 4) * amount / 250;
524 case EFT_BOMBARD_LIMIT_PCT:
527 v += (num + 4) * amount / 250;
529 case EFT_GAIN_AI_LOVE:
532 if (
is_ai(aplayer)) {
542 case EFT_UPGRADE_PRICE_PCT:
544 v -= adv->
stats.
units.upgradeable * amount / 2;
547 case EFT_CITY_UNHAPPY_SIZE:
548 case EFT_UNHAPPY_FACTOR:
549 case EFT_UPKEEP_FACTOR:
550 case EFT_UNIT_UPKEEP_FREE_PER_CITY:
551 case EFT_CIVIL_WAR_CHANCE:
552 case EFT_EMPIRE_SIZE_BASE:
553 case EFT_EMPIRE_SIZE_STEP:
555 case EFT_MARTIAL_LAW_EACH:
556 case EFT_MARTIAL_LAW_MAX:
557 case EFT_RAPTURE_GROW:
558 case EFT_REVOLUTION_UNHAPPINESS:
560 case EFT_INSPIRE_PARTISANS:
561 case EFT_HAPPINESS_TO_GOLD:
563 case EFT_NO_DIPLOMACY:
564 case EFT_NOT_TECH_SOURCE:
565 case EFT_OUTPUT_PENALTY_TILE:
566 case EFT_OUTPUT_INC_TILE_CELEBRATE:
567 case EFT_TRADE_REVENUE_BONUS:
568 case EFT_TRADE_REVENUE_EXPONENT:
569 case EFT_TILE_WORKABLE:
570 case EFT_COMBAT_ROUNDS:
571 case EFT_ILLEGAL_ACTION_MOVE_COST:
572 case EFT_ILLEGAL_ACTION_HP_COST:
573 case EFT_CASUS_BELLI_CAUGHT:
574 case EFT_CASUS_BELLI_SUCCESS:
575 case EFT_CASUS_BELLI_COMPLETE:
576 case EFT_ACTION_ODDS_PCT:
577 case EFT_BORDER_VISION:
578 case EFT_STEALINGS_IGNORE:
579 case EFT_MAPS_STOLEN_PCT:
580 case EFT_UNIT_SHIELD_VALUE_PCT:
581 case EFT_WONDER_VISIBLE:
582 case EFT_NATION_INTELLIGENCE:
583 case EFT_NUKE_INFRASTRUCTURE_PCT:
586 case EFT_VISIBLE_WALLS:
588 case EFT_SHIELD2GOLD_FACTOR:
590 case EFT_PERFORMANCE:
591 case EFT_NATION_PERFORMANCE:
593 v += amount / 10 + 1;
596 case EFT_NATION_HISTORY:
600 case EFT_TECH_COST_FACTOR:
603 case EFT_IMPR_BUILD_COST_PCT:
604 case EFT_UNIT_BUILD_COST_PCT:
607 case EFT_IMPR_BUY_COST_PCT:
608 case EFT_NUKE_IMPROVEMENT_PCT:
609 case EFT_UNIT_BUY_COST_PCT:
612 case EFT_CITY_RADIUS_SQ:
615 case EFT_CITY_BUILD_SLOTS:
618 case EFT_MIGRATION_PCT:
627 if (!acity || acity == pcity ||
city_owner(acity) == pplayer) {
636 case EFT_MAX_TRADE_ROUTES:
639 * (pow(2.0,
static_cast<double>(
650 case EFT_TRADEROUTE_PCT: {
669 case EFT_MAX_STOLEN_GOLD_PM:
672 case EFT_THIEFS_SHARE_PM:
677 v -= amount * num / 20;
679 case EFT_ACTION_SUCCESS_MOVE_COST:
680 case EFT_ACTION_SUCCESS_TARGET_MOVE_COST: {
687 case EFT_INFRA_POINTS:
688 v += amount *
adv->infra_priority;
691 qCritical(
"Bad effect type.");
724 const struct player *pplayer,
725 const struct city *pcity)
732 case VUT_IMPROVEMENT: {
738 }
else if (!preq->
present && pcity !=
nullptr
769 case VUT_NATIONALITY:
774 if (pcity ==
nullptr) {
784 case VUT_TERRAINCLASS:
785 case VUT_TERRAINALTER:
803 case VUT_ACHIEVEMENT:
809 case VUT_MINFOREIGNPCT:
814 case VUT_NATIONGROUP:
816 case VUT_SERVERSETTING:
832 case VUT_MAXTILEUNITS:
842 case VUT_VISIONLAYER:
bool adv_wants_science(struct player *pplayer)
Return whether science would help us at all.
int ai_trait_get_value(enum trait tr, struct player *pplayer)
Get current value of player trait.
int city_granary_size(int city_size)
Generalized formula used to calculate granary size.
struct player * city_owner(const struct city *pcity)
Return the owner of the city.
struct tile * city_tile(const struct city *pcity)
Return the tile location of the city.
bool city_can_grow_to(const struct city *pcity, int pop_size)
Return TRUE iff the city can grow to the given size.
int city_map_radius_sq_get(const struct city *pcity)
Returns the current squared radius of the city.
citizens city_size_get(const struct city *pcity)
Get the city size.
bool dai_can_requirement_be_met_in_city(const struct requirement *preq, const struct player *pplayer, const struct city *pcity)
Does the AI expect to ever be able to meet this requirement.
adv_want dai_content_effect_value(const struct player *pplayer, const struct city *pcity, int amount, int num_cities, int happiness_step)
How desirable particular effect making people content is for a particular city?
static int num_affected_units(const struct effect *peffect, const struct adv_data *ai)
Number of AI stats units affected by effect.
static bool have_better_government(const struct player *pplayer, const struct government *pgov)
Checks recursively to see if the player already has a better government.
adv_want dai_effect_value(struct player *pplayer, struct government *gov, const struct adv_data *adv, const struct city *pcity, const bool capital, int turns, const struct effect *peffect, const int c, const int nplayers)
How desirable is a particular effect for a particular city, given the number of cities in range (c).
static int get_entertainers(const struct city *pcity)
Return the number of "luxury specialists".
int get_city_bonus(const struct city *pcity, enum effect_type effect_type, enum vision_layer vlayer)
Returns the effect bonus at a city.
int get_player_bonus(const struct player *pplayer, enum effect_type effect_type)
Returns the effect bonus for a player.
signed short Continent_id
bool can_change_to_government(struct player *pplayer, const struct government *gov)
Can change to government if appropriate tech exists, and one of:
bool has_handicap(const struct player *pplayer, enum handicap_type htype)
AI players may have handicaps - allowing them to cheat or preventing them from using certain algorith...
bool can_improvement_go_obsolete(const struct impr_type *pimprove)
Return TRUE if the improvement can ever go obsolete.
Impr_type_id improvement_index(const struct impr_type *pimprove)
Return the improvement index.
bool improvement_obsolete(const struct player *pplayer, const struct impr_type *pimprove, const struct city *pcity)
Returns TRUE if the improvement or wonder is obsolete.
#define fc_assert_ret_val(condition, val)
#define iterate_outward(nmap, start_tile, max_dist, itr_tile)
#define iterate_outward_end
#define adjc_iterate(nmap, center_tile, itr_tile)
int player_multiplier_effect_value(const struct player *pplayer, const struct multiplier *pmul)
Return the multiplier value currently in effect for pplayer, scaled from display units to the units u...
bool players_on_same_team(const struct player *pplayer1, const struct player *pplayer2)
Return TRUE if players are in the same team.
struct player_diplstate * player_diplstate_get(const struct player *plr1, const struct player *plr2)
Returns diplomatic state type between two players.
#define players_iterate_end
#define players_iterate(_pplayer)
#define players_iterate_alive_end
#define players_iterate_alive(_pplayer)
bool nation_is_in_current_set(const struct nation_type *pnation)
Is the nation in the currently selected nationset? If not, it's not allowed to appear in the game.
#define requirement_vector_iterate_end
#define requirement_vector_iterate(req_vec, preq)
#define requirement_fulfilled_by_unit_class(_uc_, _rqs_)
int research_goal_unknown_techs(const struct research *presearch, Tech_type_id goal)
Returns the number of technologies the player need to research to get the goal technology.
struct research * research_get(const struct player *pplayer)
Returns the research structure associated with the player.
int get_specialist_output(const struct city *pcity, Specialist_type_id sp, Output_type_id otype)
Return the output for the specialist type with this output type.
#define specialist_type_iterate_end
#define specialist_type_iterate(sp)
struct adv_data::@85 threats
struct adv_data::@87 stats
struct player * production_leader
struct adv_data::@89 goal
struct adv_data::@88 dipl
struct adv_data::@89::@91 govt
struct adv_data::@87::@90 units
struct adv_data::@86 explore
struct player * spacerace_leader
struct city::@15::@17 server
citizens feel[CITIZEN_LAST][FEELING_LAST]
citizens specialists[SP_MAX]
struct unit_list * units_supported
struct civ_game::@28::@32 server
struct packet_game_info info
struct multiplier * multiplier
struct requirement_vector reqs
struct government * better
struct government::@38 ai
struct requirement_vector reqs
struct city_list * cities
struct government * government
bool is_terrain_class_near_tile(const struct tile *ptile, enum terrain_class tclass)
Is there terrain of the given class near tile? (Does not check ptile itself.)
#define is_ocean_tile(ptile)
struct city * tile_city(const struct tile *ptile)
Return the city on this tile (or nullptr), checking for city center.
#define tile_continent(_tile)
int max_trade_routes(const struct city *pcity)
Return current maximum number of trade routes city can have.
int trade_base_between_cities(const struct city *pc1, const struct city *pc2)
Return the trade that exists between these cities, assuming they have a trade route.
int city_num_trade_routes(const struct city *pcity)
Return number of trade route city has.
#define trade_partners_iterate_end
#define trade_partners_iterate(c, p)
#define TRAIT_DEFAULT_VALUE
struct specialist * specialist
struct nation_type * nation
struct government * govern
const struct impr_type * building
#define unit_class_iterate(_p)
#define uclass_index(_c_)
#define unit_class_iterate_end
bool victory_enabled(enum victory_condition_type victory)
Whether victory condition is enabled.