Project

General

Profile

Feature #2263 ยป 0079-Add-Armistice-Ceasefire-_Length_Pct-effect-types.patch

Marko Lindqvist, 10/04/2026 09:22 AM

View differences:

ai/default/daieffects.c
case EFT_NUKE_BLAST_RADIUS_1_SQ:
case EFT_HEAL_UNIT_PCT:
case EFT_TILE_CLAIMABLE:
case EFT_SHIELD2GOLD_PCT:
case EFT_ARMISTICE_LENGTH_PCT:
case EFT_CEASEFIRE_LENGTH_PCT:
break;
/* This has no effect for AI */
case EFT_VISIBLE_WALLS:
case EFT_CITY_IMAGE:
case EFT_SHIELD2GOLD_PCT:
break;
case EFT_PERFORMANCE:
case EFT_NATION_PERFORMANCE:
data/alien/effects.ruleset
type = "Tech_Leakage"
value = 1
[effect_armistice_len_pct]
type = "Armistice_Length_Pct"
value = 100
[effect_ceasefire_len_pct]
type = "Ceasefire_Length_Pct"
value = 100
[effect_mood_center]
type = "Make_Content"
value = 3
data/civ1/effects.ruleset
type = "Tech_Leakage"
value = 1
[effect_armistice_len_pct]
type = "Armistice_Length_Pct"
value = 100
[effect_ceasefire_len_pct]
type = "Ceasefire_Length_Pct"
value = 100
; Cities can always work tiles
[effect_tile_workable]
type = "Tile_Workable"
data/civ2/effects.ruleset
type = "Tech_Leakage"
value = 1
[effect_armistice_len_pct]
type = "Armistice_Length_Pct"
value = 100
[effect_ceasefire_len_pct]
type = "Ceasefire_Length_Pct"
value = 100
; Cities can always work tiles
[effect_tile_workable]
type = "Tile_Workable"
data/civ2civ3/effects.ruleset
type = "Tech_Leakage"
value = 1
[effect_armistice_len_pct]
type = "Armistice_Length_Pct"
value = 100
[effect_ceasefire_len_pct]
type = "Ceasefire_Length_Pct"
value = 100
; Cities can always work tiles
[effect_tile_workable]
type = "Tile_Workable"
data/classic/effects.ruleset
type = "Tech_Leakage"
value = 1
[effect_armistice_len_pct]
type = "Armistice_Length_Pct"
value = 100
[effect_ceasefire_len_pct]
type = "Ceasefire_Length_Pct"
value = 100
; Cities can always work tiles
[effect_tile_workable]
type = "Tile_Workable"
data/goldkeep/effects.ruleset
type = "Tech_Leakage"
value = 1
[effect_armistice_len_pct]
type = "Armistice_Length_Pct"
value = 100
[effect_ceasefire_len_pct]
type = "Ceasefire_Length_Pct"
value = 100
; Cities can always work tiles
[effect_tile_workable]
type = "Tile_Workable"
data/granularity/effects.ruleset
"Tech", "Literature", "Player"
}
[effect_armistice_len_pct]
type = "Armistice_Length_Pct"
value = 100
[effect_ceasefire_len_pct]
type = "Ceasefire_Length_Pct"
value = 100
[effect_tile_land_workable]
type = "Tile_Workable"
value = 1
data/multiplayer/effects.ruleset
type = "Tech_Leakage"
value = 1
[effect_armistice_len_pct]
type = "Armistice_Length_Pct"
value = 100
[effect_ceasefire_len_pct]
type = "Ceasefire_Length_Pct"
value = 100
; Cities can always work tiles
[effect_tile_workable]
type = "Tile_Workable"
data/sandbox/effects.ruleset
type = "Tech_Leakage"
value = 1
[effect_armistice_len_pct]
type = "Armistice_Length_Pct"
value = 100
[effect_ceasefire_len_pct]
type = "Ceasefire_Length_Pct"
value = 100
; Cities can always work tiles
[effect_tile_workable]
type = "Tile_Workable"
data/stub/effects.ruleset
type = "Tech_Cost_Pct"
value = 100
[effect_armistice_len_pct]
type = "Armistice_Length_Pct"
value = 100
[effect_ceasefire_len_pct]
type = "Ceasefire_Length_Pct"
value = 100
; Cities can always work tiles
[effect_tile_workable]
type = "Tile_Workable"
doc/README.effects
Any_Government
Allow changing to any form of government regardless of tech prerequisites.
Armistice_Length_Pct
How long an armistice agreed by the two players last before turning
into a peace treaty. The effect is evaluated for both parties of
the treaty, and the longer of the times applies.
Attack_Bonus
Increases offensive bonuses of units. Unit requirements on this effect are
the attacking unit itself. Can be limited to only apply to some actions
......
Disband Unit Recover, Establish Trade Route, Enter Marketplace,
Pillage, Spy Escape, Surgical Strike Building, Surgical Strike Production
Ceasefire_Length_Pct
How long a cease-fire agreed by the two players last before reverting
back to war. The effect is evaluated for both parties of the treaty,
and the shorter of the times applies.
City_Build_Slots
Increase the number of units with no population cost a city can build in
a turn if there are enough shields.
gen_headers/enums/effects_enums.def
IMPR_UPKEEP_REDUCTION "Impr_Upkeep_Reduction"
CULTURE_PCT "Culture_Pct"
TILE_CLAIMABLE "Tile_Claimable"
ARMISTICE_LENGTH_PCT "Armistice_Length_Pct"
CEASEFIRE_LENGTH_PCT "Ceasefire_Length_Pct"
USER_EFFECT_1 "User_Effect_1"
USER_EFFECT_2 "User_Effect_2"
USER_EFFECT_3 "User_Effect_3"
server/diplhand.c
enum diplstate_type old_diplstate = ds_giverdest->type;
struct unit_list *pgiver_seen_units BAD_HEURISTIC_INIT(NULL);
struct unit_list *pdest_seen_units BAD_HEURISTIC_INIT(NULL);
int armistice_length, arm_1, arm_2;
int ceasefire_length, cf_1, cf_2;
switch (pclause->type) {
case CLAUSE_EMBASSY:
......
pdest_seen_units = get_units_seen_via_ally(pdest, pgiver);
}
set_diplstate_type(ds_giverdest, ds_destgiver, DS_CEASEFIRE);
ds_giverdest->turns_left = game.info.ceasefire_length;
ds_destgiver->turns_left = game.info.ceasefire_length;
cf_1 = get_target_bonus_effects(nullptr,
&(const struct req_context) {
.player = pgiver,
},
&(const struct req_context) {
.player = pdest,
}, EFT_CEASEFIRE_LENGTH_PCT);
cf_2 = get_target_bonus_effects(nullptr,
&(const struct req_context) {
.player = pdest,
},
&(const struct req_context) {
.player = pgiver,
}, EFT_CEASEFIRE_LENGTH_PCT);
ceasefire_length
= game.info.ceasefire_length * MIN(cf_1, cf_2) / 100;
ceasefire_length = MAX(1, ceasefire_length);
ds_giverdest->turns_left = ceasefire_length;
ds_destgiver->turns_left = ceasefire_length;
notify_player(pgiver, NULL, E_TREATY_CEASEFIRE, ftc_server,
_("You agree on a cease-fire with %s."),
player_name(pdest));
......
pdest_seen_units = get_units_seen_via_ally(pdest, pgiver);
}
set_diplstate_type(ds_giverdest, ds_destgiver, DS_ARMISTICE);
ds_giverdest->turns_left = game.info.armistice_length;
ds_destgiver->turns_left = game.info.armistice_length;
arm_1 = get_target_bonus_effects(nullptr,
&(const struct req_context) {
.player = pgiver,
},
&(const struct req_context) {
.player = pdest,
}, EFT_ARMISTICE_LENGTH_PCT);
arm_2 = get_target_bonus_effects(nullptr,
&(const struct req_context) {
.player = pdest,
},
&(const struct req_context) {
.player = pgiver,
}, EFT_ARMISTICE_LENGTH_PCT);
armistice_length
= game.info.armistice_length * MAX(arm_1, arm_2) / 100;
armistice_length = MAX(1, armistice_length);
ds_giverdest->turns_left = armistice_length;
ds_destgiver->turns_left = armistice_length;
notify_player(pgiver, NULL, E_TREATY_PEACE, ftc_server,
/* TRANS: ... the Poles ... Polish territory */
PL_("You agree on an armistice with the %s. In %d turn, "
......
"it will become a peace treaty. Move any "
"military units out of %s territory to avoid them "
"being disbanded.",
game.info.armistice_length),
armistice_length),
nation_plural_for_player(pdest),
game.info.armistice_length,
armistice_length,
nation_adjective_for_player(pdest));
notify_player(pdest, NULL, E_TREATY_PEACE, ftc_server,
/* TRANS: ... the Poles ... Polish territory */
......
"it will become a peace treaty. Move any "
"military units out of %s territory to avoid them "
"being disbanded.",
game.info.armistice_length),
armistice_length),
nation_plural_for_player(pgiver),
game.info.armistice_length,
armistice_length,
nation_adjective_for_player(pgiver));
if (old_diplstate == DS_ALLIANCE) {
update_players_after_alliance_breakup(pgiver, pdest,
server/ruleset/rscompat.c
* the new effects from being upgraded by accident. */
iterate_effect_cache(effect_list_compat_cb, info);
/* Old behavior: Armistice and Ceasefire took full (!00%) time. */
effect_new(EFT_ARMISTICE_LENGTH_PCT, 100, nullptr);
effect_new(EFT_CEASEFIRE_LENGTH_PCT, 100, nullptr);
/* Make sure that all action enablers added or modified by the
* compatibility post processing fulfills all hard action requirements. */
rscompat_enablers_add_obligatory_hard_reqs();
server/ruleset/rssanity.c
/* These have been made mandatory in freeciv-3.4 */
enum effect_type req_base_effects_3_4[] =
{
/* None yet */
EFT_ARMISTICE_LENGTH_PCT,
EFT_CEASEFIRE_LENGTH_PCT,
EFT_COUNT
};
    (1-1/1)