From 896291012a477a148259e1dcefa91a546958ea1f Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 25 Dec 2021 10:17:06 +0200 Subject: [PATCH 29/29] Make reduced firepower in special cases ruleset controlled Replace hardcoded firepower of 1 with a ruleset defined low firepower values. These rules can still never increase the firepower, only reduce it. - BadWallAttacker - Pearl Harbour rule - LowFirepower combat bonus - Nonnative bombardment See osdn #43041 Signed-off-by: Marko Lindqvist --- common/combat.c | 28 ++++++++++++++-------------- common/networking/packets.def | 4 ++++ data/alien/game.ruleset | 23 +++++++++++++++++++++++ data/alien/units.ruleset | 3 ++- data/civ1/game.ruleset | 23 +++++++++++++++++++++++ data/civ1/units.ruleset | 3 ++- data/civ2/game.ruleset | 23 +++++++++++++++++++++++ data/civ2/units.ruleset | 3 ++- data/civ2civ3/game.ruleset | 23 +++++++++++++++++++++++ data/civ2civ3/units.ruleset | 3 ++- data/classic/game.ruleset | 23 +++++++++++++++++++++++ data/classic/units.ruleset | 3 ++- data/experimental/game.ruleset | 23 +++++++++++++++++++++++ data/experimental/units.ruleset | 3 ++- data/granularity/game.ruleset | 23 +++++++++++++++++++++++ data/granularity/units.ruleset | 3 ++- data/multiplayer/game.ruleset | 23 +++++++++++++++++++++++ data/multiplayer/units.ruleset | 3 ++- data/ruledit/comments-3.1.txt | 4 ++-- data/sandbox/game.ruleset | 23 +++++++++++++++++++++++ data/sandbox/units.ruleset | 3 ++- data/stub/game.ruleset | 23 +++++++++++++++++++++++ data/stub/units.ruleset | 3 ++- data/webperimental/game.ruleset | 23 +++++++++++++++++++++++ data/webperimental/units.ruleset | 3 ++- fc_version | 2 +- server/ruleset.c | 13 +++++++++++++ tools/ruleutil/rulesave.c | 8 ++++++++ 28 files changed, 317 insertions(+), 28 deletions(-) diff --git a/common/combat.c b/common/combat.c index 430e7b0094..c1d5e781be 100644 --- a/common/combat.c +++ b/common/combat.c @@ -367,8 +367,8 @@ double win_chance(int as, int ahp, int afp, int ds, int dhp, int dfp) A unit's effective firepower depend on the situation. ***********************************************************************/ void get_modified_firepower(const struct unit *attacker, - const struct unit *defender, - int *att_fp, int *def_fp) + const struct unit *defender, + int *att_fp, int *def_fp) { struct city *pcity = tile_city(unit_tile(defender)); const struct unit_type *att_type; @@ -387,37 +387,37 @@ void get_modified_firepower(const struct unit *attacker, } /* - * UTYF_BADWALLATTACKER sets the firepower of the attacking unit to 1 if - * an EFT_DEFEND_BONUS applies (such as a land unit attacking a city with - * city walls). + * UTYF_BADWALLATTACKER reduces the firepower of the attacking unit to + * badwallattacker firepower if an EFT_DEFEND_BONUS applies + * (such as a land unit attacking a city with city walls). */ if (unit_has_type_flag(attacker, UTYF_BADWALLATTACKER) && get_unittype_bonus(unit_owner(defender), unit_tile(defender), att_type, NULL, EFT_DEFEND_BONUS) > 0) { - *att_fp = 1; + *att_fp = MIN(*att_fp, game.info.low_firepower_badwallattacker); } - /* pearl harbour - defender's firepower is reduced to one, + /* pearl harbour - defender's firepower is reduced, * attacker's is multiplied by two */ if (unit_has_type_flag(defender, UTYF_BADCITYDEFENDER) && tile_city(unit_tile(defender))) { *att_fp *= 2; - *def_fp = 1; + *def_fp = MIN(*def_fp, game.info.low_firepower_pearl_harbour); } - + /* * When attacked by fighters, helicopters have their firepower - * reduced to 1. + * reduced to low firepower bonus. */ if (combat_bonus_against(att_type->bonuses, def_type, CBONUS_LOW_FIREPOWER)) { - *def_fp = 1; + *def_fp = MIN(*def_fp, game.info.low_firepower_combat_bonus); } att_tile = unit_tile(attacker); - /* In land bombardment both units have their firepower reduced to 1. + /* In land bombardment both units have their firepower reduced. * Land bombardment is always towards tile not native for attacker. * It's initiated either from a tile not native to defender (Ocean for Land unit) * or from a tile where attacker is despite non-native terrain (city, transport) */ @@ -426,8 +426,8 @@ void get_modified_firepower(const struct unit *attacker, && (!can_exist_at_tile(&(wld.map), def_type, att_tile) || !is_native_tile(att_type, att_tile))) { - *att_fp = 1; - *def_fp = 1; + *att_fp = MIN(*att_fp, game.info.low_firepower_nonnat_bombard); + *def_fp = MIN(*def_fp, game.info.low_firepower_nonnat_bombard); } } diff --git a/common/networking/packets.def b/common/networking/packets.def index 2b2b5098be..69362141b1 100644 --- a/common/networking/packets.def +++ b/common/networking/packets.def @@ -546,6 +546,10 @@ PACKET_GAME_INFO = 16; sc, is-info BOOL only_real_fight_makes_veteran; BOOL combat_odds_scaled_veterancy; BOOL damage_reduces_bombard_rate; + UINT8 low_firepower_badwallattacker; + UINT8 low_firepower_pearl_harbour; + UINT8 low_firepower_combat_bonus; + UINT8 low_firepower_nonnat_bombard; UINT8 nuke_pop_loss_pct; UINT8 nuke_defender_survival_chance_pct; UINT16 min_city_center_output[O_LAST]; diff --git a/data/alien/game.ruleset b/data/alien/game.ruleset index 02583bf67b..4cb21663e7 100644 --- a/data/alien/game.ruleset +++ b/data/alien/game.ruleset @@ -250,6 +250,29 @@ combat_odds_scaled_veterancy = TRUE ; Even after this unit gets at least one bombard round. damage_reduces_bombard_rate = TRUE +; When the attacker has BadWallAttacker flag, and there`s +; positive DefendBonus effect applied to the attack, attacker`s +; firepower gets reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_badwallattacker = 1 + +; When the defender has BadCityDefender flag, and it`s +; defending on a city tile, attacker`s firepower is doubled +; and defenders firepower is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_pearl_harbour = 1 + +; When the opponent has LowFirepower combat bonus against +; a unit, it`s firepower is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_combat_bonus = 1 + +; When a unit capable of attacking NonNative tiles does such an +; attack against NonNatBombardTgt unit, firepower of both sides +; is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_nonnat_bombard = 1 + ; Percentage of population lost by a city after nuclear attak. If set to ; 100 city is destroyed along with all the units. If set to 0 city does not ; loose population. Any value below 50 means the city can never be diff --git a/data/alien/units.ruleset b/data/alien/units.ruleset index 0724a8cb0e..91c9c47ea8 100644 --- a/data/alien/units.ruleset +++ b/data/alien/units.ruleset @@ -299,7 +299,8 @@ flags = "Missile", "DoesntOccupyTile" ; multiplication with 2/3, etc. ; Effectively increases *attack* by value percent. ; Bonus is defined in attackers entry. -; "LowFirepower" = Defender firepower is reduced to value 1 when +; "LowFirepower" = Defender firepower is reduced to low firepower +; value defined in game.ruleset when ; ever this has non-zero value. ; Bonus is defined in attackers entry. ; "CityDefensePct" = In a city, instead of "Defend_Bonus" effect diff --git a/data/civ1/game.ruleset b/data/civ1/game.ruleset index 201cce2b2b..e5582ce6ec 100644 --- a/data/civ1/game.ruleset +++ b/data/civ1/game.ruleset @@ -238,6 +238,29 @@ combat_odds_scaled_veterancy = FALSE ; Even after this unit gets at least one bombard round. damage_reduces_bombard_rate = TRUE +; When the attacker has BadWallAttacker flag, and there`s +; positive DefendBonus effect applied to the attack, attacker`s +; firepower gets reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_badwallattacker = 1 + +; When the defender has BadCityDefender flag, and it`s +; defending on a city tile, attacker`s firepower is doubled +; and defenders firepower is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_pearl_harbour = 1 + +; When the opponent has LowFirepower combat bonus against +; a unit, it`s firepower is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_combat_bonus = 1 + +; When a unit capable of attacking NonNative tiles does such an +; attack against NonNatBombardTgt unit, firepower of both sides +; is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_nonnat_bombard = 1 + ; Percentage of population lost by a city after nuclear attak. If set to ; 100 city is destroyed along with all the units. If set to 0 city does not ; loose population. Any value below 50 means the city can never be diff --git a/data/civ1/units.ruleset b/data/civ1/units.ruleset index ad86d7c956..49e79d1eb1 100644 --- a/data/civ1/units.ruleset +++ b/data/civ1/units.ruleset @@ -272,7 +272,8 @@ flags = "Missile", "Unreachable", "HutNothing" ; multiplication with 2/3, etc. ; Effectively increases *attack* by value percent. ; Bonus is defined in attackers entry. -; "LowFirepower" = Defender firepower is reduced to value 1 when +; "LowFirepower" = Defender firepower is reduced to low firepower +; value defined in game.ruleset when ; ever this has non-zero value. ; Bonus is defined in attackers entry. ; "CityDefensePct" = In a city, instead of "Defend_Bonus" effect diff --git a/data/civ2/game.ruleset b/data/civ2/game.ruleset index fba0d0838a..4b3aa76b03 100644 --- a/data/civ2/game.ruleset +++ b/data/civ2/game.ruleset @@ -234,6 +234,29 @@ combat_odds_scaled_veterancy = FALSE ; Even after this unit gets at least one bombard round. damage_reduces_bombard_rate = TRUE +; When the attacker has BadWallAttacker flag, and there`s +; positive DefendBonus effect applied to the attack, attacker`s +; firepower gets reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_badwallattacker = 1 + +; When the defender has BadCityDefender flag, and it`s +; defending on a city tile, attacker`s firepower is doubled +; and defenders firepower is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_pearl_harbour = 1 + +; When the opponent has LowFirepower combat bonus against +; a unit, it`s firepower is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_combat_bonus = 1 + +; When a unit capable of attacking NonNative tiles does such an +; attack against NonNatBombardTgt unit, firepower of both sides +; is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_nonnat_bombard = 1 + ; Percentage of population lost by a city after nuclear attak. If set to ; 100 city is destroyed along with all the units. If set to 0 city does not ; loose population. Any value below 50 means the city can never be diff --git a/data/civ2/units.ruleset b/data/civ2/units.ruleset index 66a1be955e..c53a3992f5 100644 --- a/data/civ2/units.ruleset +++ b/data/civ2/units.ruleset @@ -290,7 +290,8 @@ flags = "Unreachable", "DoesntOccupyTile", "HutFrighten" ; multiplication with 2/3, etc. ; Effectively increases *attack* by value percent. ; Bonus is defined in attackers entry. -; "LowFirepower" = Defender firepower is reduced to value 1 when +; "LowFirepower" = Defender firepower is reduced to low firepower +; value defined in game.ruleset when ; ever this has non-zero value. ; Bonus is defined in attackers entry. ; "CityDefensePct" = In a city, instead of "Defend_Bonus" effect diff --git a/data/civ2civ3/game.ruleset b/data/civ2civ3/game.ruleset index 49bf351221..614a082c56 100644 --- a/data/civ2civ3/game.ruleset +++ b/data/civ2civ3/game.ruleset @@ -256,6 +256,29 @@ combat_odds_scaled_veterancy = TRUE ; Even after this unit gets at least one bombard round. damage_reduces_bombard_rate = TRUE +; When the attacker has BadWallAttacker flag, and there`s +; positive DefendBonus effect applied to the attack, attacker`s +; firepower gets reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_badwallattacker = 1 + +; When the defender has BadCityDefender flag, and it`s +; defending on a city tile, attacker`s firepower is doubled +; and defenders firepower is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_pearl_harbour = 1 + +; When the opponent has LowFirepower combat bonus against +; a unit, it`s firepower is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_combat_bonus = 1 + +; When a unit capable of attacking NonNative tiles does such an +; attack against NonNatBombardTgt unit, firepower of both sides +; is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_nonnat_bombard = 1 + ; Percentage of population lost by a city after nuclear attak. If set to ; 100 city is destroyed along with all the units. If set to 0 city does not ; loose population. Any value below 50 means the city can never be diff --git a/data/civ2civ3/units.ruleset b/data/civ2civ3/units.ruleset index 18ae6ccadb..4bc5765428 100644 --- a/data/civ2civ3/units.ruleset +++ b/data/civ2civ3/units.ruleset @@ -331,7 +331,8 @@ flags = "Unreachable", "DoesntOccupyTile", "CanPillage", ; multiplication with 2/3, etc. ; Effectively increases *attack* by value percent. ; Bonus is defined in attackers entry. -; "LowFirepower" = Defender firepower is reduced to value 1 when +; "LowFirepower" = Defender firepower is reduced to low firepower +; value defined in game.ruleset when ; ever this has non-zero value. ; Bonus is defined in attackers entry. ; "CityDefensePct" = In a city, instead of "Defend_Bonus" effect diff --git a/data/classic/game.ruleset b/data/classic/game.ruleset index db54b9003a..cbb7679dd4 100644 --- a/data/classic/game.ruleset +++ b/data/classic/game.ruleset @@ -251,6 +251,29 @@ combat_odds_scaled_veterancy = FALSE ; Even after this unit gets at least one bombard round. damage_reduces_bombard_rate = TRUE +; When the attacker has BadWallAttacker flag, and there`s +; positive DefendBonus effect applied to the attack, attacker`s +; firepower gets reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_badwallattacker = 1 + +; When the defender has BadCityDefender flag, and it`s +; defending on a city tile, attacker`s firepower is doubled +; and defenders firepower is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_pearl_harbour = 1 + +; When the opponent has LowFirepower combat bonus against +; a unit, it`s firepower is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_combat_bonus = 1 + +; When a unit capable of attacking NonNative tiles does such an +; attack against NonNatBombardTgt unit, firepower of both sides +; is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_nonnat_bombard = 1 + ; Percentage of population lost by a city after nuclear attak. If set to ; 100 city is destroyed along with all the units. If set to 0 city does not ; loose population. Any value below 50 means the city can never be diff --git a/data/classic/units.ruleset b/data/classic/units.ruleset index de7d2df8e2..c60e46f848 100644 --- a/data/classic/units.ruleset +++ b/data/classic/units.ruleset @@ -303,7 +303,8 @@ flags = "Unreachable", "DoesntOccupyTile", "HutFrighten" ; multiplication with 2/3, etc. ; Effectively increases *attack* by value percent. ; Bonus is defined in attackers entry. -; "LowFirepower" = Defender firepower is reduced to value 1 when +; "LowFirepower" = Defender firepower is reduced to low firepower +; value defined in game.ruleset when ; ever this has non-zero value. ; Bonus is defined in attackers entry. ; "CityDefensePct" = In a city, instead of "Defend_Bonus" effect diff --git a/data/experimental/game.ruleset b/data/experimental/game.ruleset index 6f2067f743..7e40cb6c98 100644 --- a/data/experimental/game.ruleset +++ b/data/experimental/game.ruleset @@ -259,6 +259,29 @@ combat_odds_scaled_veterancy = TRUE ; Even after this unit gets at least one bombard round. damage_reduces_bombard_rate = TRUE +; When the attacker has BadWallAttacker flag, and there`s +; positive DefendBonus effect applied to the attack, attacker`s +; firepower gets reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_badwallattacker = 1 + +; When the defender has BadCityDefender flag, and it`s +; defending on a city tile, attacker`s firepower is doubled +; and defenders firepower is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_pearl_harbour = 1 + +; When the opponent has LowFirepower combat bonus against +; a unit, it`s firepower is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_combat_bonus = 1 + +; When a unit capable of attacking NonNative tiles does such an +; attack against NonNatBombardTgt unit, firepower of both sides +; is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_nonnat_bombard = 1 + ; Percentage of population lost by a city after nuclear attak. If set to ; 100 city is destroyed along with all the units. If set to 0 city does not ; loose population. Any value below 50 means the city can never be diff --git a/data/experimental/units.ruleset b/data/experimental/units.ruleset index 1fb59f7442..e3259bafbb 100644 --- a/data/experimental/units.ruleset +++ b/data/experimental/units.ruleset @@ -315,7 +315,8 @@ flags = "Unreachable", "DoesntOccupyTile", "HutFrighten" ; multiplication with 2/3, etc. ; Effectively increases *attack* by value percent. ; Bonus is defined in attackers entry. -; "LowFirepower" = Defender firepower is reduced to value 1 when +; "LowFirepower" = Defender firepower is reduced to low firepower +; value defined in game.ruleset when ; ever this has non-zero value. ; Bonus is defined in attackers entry. ; "CityDefensePct" = In a city, instead of "Defend_Bonus" effect diff --git a/data/granularity/game.ruleset b/data/granularity/game.ruleset index 56233cd265..d5f3e973ac 100644 --- a/data/granularity/game.ruleset +++ b/data/granularity/game.ruleset @@ -246,6 +246,29 @@ combat_odds_scaled_veterancy = TRUE ; Even after this unit gets at least one bombard round. damage_reduces_bombard_rate = TRUE +; When the attacker has BadWallAttacker flag, and there`s +; positive DefendBonus effect applied to the attack, attacker`s +; firepower gets reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_badwallattacker = 1 + +; When the defender has BadCityDefender flag, and it`s +; defending on a city tile, attacker`s firepower is doubled +; and defenders firepower is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_pearl_harbour = 1 + +; When the opponent has LowFirepower combat bonus against +; a unit, it`s firepower is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_combat_bonus = 1 + +; When a unit capable of attacking NonNative tiles does such an +; attack against NonNatBombardTgt unit, firepower of both sides +; is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_nonnat_bombard = 1 + ; Percentage of population lost by a city after nuclear attak. If set to ; 100 city is destroyed along with all the units. If set to 0 city does not ; loose population. Any value below 50 means the city can never be diff --git a/data/granularity/units.ruleset b/data/granularity/units.ruleset index 44f62330c2..8e11149d26 100644 --- a/data/granularity/units.ruleset +++ b/data/granularity/units.ruleset @@ -241,7 +241,8 @@ flags = "TerrainSpeed" ; multiplication with 2/3, etc. ; Effectively increases *attack* by value percent. ; Bonus is defined in attackers entry. -; "LowFirepower" = Defender firepower is reduced to value 1 when +; "LowFirepower" = Defender firepower is reduced to low firepower +; value defined in game.ruleset when ; ever this has non-zero value. ; Bonus is defined in attackers entry. ; "CityDefensePct" = In a city, instead of "Defend_Bonus" effect diff --git a/data/multiplayer/game.ruleset b/data/multiplayer/game.ruleset index 340e8f5658..58df992622 100644 --- a/data/multiplayer/game.ruleset +++ b/data/multiplayer/game.ruleset @@ -254,6 +254,29 @@ combat_odds_scaled_veterancy = TRUE ; Even after this unit gets at least one bombard round. damage_reduces_bombard_rate = TRUE +; When the attacker has BadWallAttacker flag, and there`s +; positive DefendBonus effect applied to the attack, attacker`s +; firepower gets reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_badwallattacker = 1 + +; When the defender has BadCityDefender flag, and it`s +; defending on a city tile, attacker`s firepower is doubled +; and defenders firepower is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_pearl_harbour = 1 + +; When the opponent has LowFirepower combat bonus against +; a unit, it`s firepower is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_combat_bonus = 1 + +; When a unit capable of attacking NonNative tiles does such an +; attack against NonNatBombardTgt unit, firepower of both sides +; is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_nonnat_bombard = 1 + ; Percentage of population lost by a city after nuclear attak. If set to ; 100 city is destroyed along with all the units. If set to 0 city does not ; loose population. Any value below 50 means the city can never be diff --git a/data/multiplayer/units.ruleset b/data/multiplayer/units.ruleset index 9ead544342..277e452258 100644 --- a/data/multiplayer/units.ruleset +++ b/data/multiplayer/units.ruleset @@ -303,7 +303,8 @@ flags = "Unreachable", "DoesntOccupyTile", "HutFrighten" ; multiplication with 2/3, etc. ; Effectively increases *attack* by value percent. ; Bonus is defined in attackers entry. -; "LowFirepower" = Defender firepower is reduced to value 1 when +; "LowFirepower" = Defender firepower is reduced to low firepower +; value defined in game.ruleset when ; ever this has non-zero value. ; Bonus is defined in attackers entry. ; "CityDefensePct" = In a city, instead of "Defend_Bonus" effect diff --git a/data/ruledit/comments-3.1.txt b/data/ruledit/comments-3.1.txt index 77c6752070..460b489dda 100644 --- a/data/ruledit/comments-3.1.txt +++ b/data/ruledit/comments-3.1.txt @@ -418,8 +418,8 @@ utypes = "\ ; multiplication with 2/3, etc.\n\ ; Effectively increases *attack* by value percent.\n\ ; Bonus is defined in attackers entry.\n\ -; \"LowFirepower\" = Defender firepower is reduced to value 1 when\n\ -; ever this has non-zero value.\n\ +; \"LowFirepower\" = Defender firepower is reduced to low firepower\n\ +; value defined in game.ruleset when\n\ ; Bonus is defined in attackers entry.\n\ ; \"CityDefensePct\" = In a city, instead of \"Defend_Bonus\" effect\n\ ; uses this bonus.\n\ diff --git a/data/sandbox/game.ruleset b/data/sandbox/game.ruleset index 04e158bdac..1bf3a165d1 100644 --- a/data/sandbox/game.ruleset +++ b/data/sandbox/game.ruleset @@ -254,6 +254,29 @@ combat_odds_scaled_veterancy = TRUE ; Even after this unit gets at least one bombard round. damage_reduces_bombard_rate = TRUE +; When the attacker has BadWallAttacker flag, and there`s +; positive DefendBonus effect applied to the attack, attacker`s +; firepower gets reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_badwallattacker = 1 + +; When the defender has BadCityDefender flag, and it`s +; defending on a city tile, attacker`s firepower is doubled +; and defenders firepower is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_pearl_harbour = 1 + +; When the opponent has LowFirepower combat bonus against +; a unit, it`s firepower is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_combat_bonus = 1 + +; When a unit capable of attacking NonNative tiles does such an +; attack against NonNatBombardTgt unit, firepower of both sides +; is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_nonnat_bombard = 1 + ; Percentage of population lost by a city after nuclear attak. If set to ; 100 city is destroyed along with all the units. If set to 0 city does not ; loose population. Any value below 50 means the city can never be diff --git a/data/sandbox/units.ruleset b/data/sandbox/units.ruleset index eda7ada185..e0b585df95 100644 --- a/data/sandbox/units.ruleset +++ b/data/sandbox/units.ruleset @@ -344,7 +344,8 @@ flags = "Unreachable", "DoesntOccupyTile", "CanPillage", ; multiplication with 2/3, etc. ; Effectively increases *attack* by value percent. ; Bonus is defined in attackers entry. -; "LowFirepower" = Defender firepower is reduced to value 1 when +; "LowFirepower" = Defender firepower is reduced to low firepower +; value defined in game.ruleset when ; ever this has non-zero value. ; Bonus is defined in attackers entry. ; "CityDefensePct" = In a city, instead of "Defend_Bonus" effect diff --git a/data/stub/game.ruleset b/data/stub/game.ruleset index b9047189ba..fb665699e8 100644 --- a/data/stub/game.ruleset +++ b/data/stub/game.ruleset @@ -238,6 +238,29 @@ combat_odds_scaled_veterancy = FALSE ; Even after this unit gets at least one bombard round. damage_reduces_bombard_rate = TRUE +; When the attacker has BadWallAttacker flag, and there`s +; positive DefendBonus effect applied to the attack, attacker`s +; firepower gets reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_badwallattacker = 1 + +; When the defender has BadCityDefender flag, and it`s +; defending on a city tile, attacker`s firepower is doubled +; and defenders firepower is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_pearl_harbour = 1 + +; When the opponent has LowFirepower combat bonus against +; a unit, it`s firepower is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_combat_bonus = 1 + +; When a unit capable of attacking NonNative tiles does such an +; attack against NonNatBombardTgt unit, firepower of both sides +; is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_nonnat_bombard = 1 + ; Percentage of population lost by a city after nuclear attak. If set to ; 100 city is destroyed along with all the units. If set to 0 city does not ; loose population. Any value below 50 means the city can never be diff --git a/data/stub/units.ruleset b/data/stub/units.ruleset index 10d60b666e..b34b726093 100644 --- a/data/stub/units.ruleset +++ b/data/stub/units.ruleset @@ -225,7 +225,8 @@ flags = "" ; multiplication with 2/3, etc. ; Effectively increases *attack* by value percent. ; Bonus is defined in attackers entry. -; "LowFirepower" = Defender firepower is reduced to value 1 when +; "LowFirepower" = Defender firepower is reduced to low firepower +; value defined in game.ruleset when ; ever this has non-zero value. ; Bonus is defined in attackers entry. ; "CityDefensePct" = In a city, instead of "Defend_Bonus" effect diff --git a/data/webperimental/game.ruleset b/data/webperimental/game.ruleset index 872e44b469..4294f404b7 100644 --- a/data/webperimental/game.ruleset +++ b/data/webperimental/game.ruleset @@ -255,6 +255,29 @@ combat_odds_scaled_veterancy = TRUE ; Even after this unit gets at least one bombard round. damage_reduces_bombard_rate = TRUE +; When the attacker has BadWallAttacker flag, and there`s +; positive DefendBonus effect applied to the attack, attacker`s +; firepower gets reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_badwallattacker = 1 + +; When the defender has BadCityDefender flag, and it`s +; defending on a city tile, attacker`s firepower is doubled +; and defenders firepower is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_pearl_harbour = 1 + +; When the opponent has LowFirepower combat bonus against +; a unit, it`s firepower is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_combat_bonus = 1 + +; When a unit capable of attacking NonNative tiles does such an +; attack against NonNatBombardTgt unit, firepower of both sides +; is reduced to this value. +; If firepower is already lower than this, it won`t be affected. +low_firepower_nonnat_bombard = 1 + ; Percentage of population lost by a city after nuclear attak. If set to ; 100 city is destroyed along with all the units. If set to 0 city does not ; loose population. Any value below 50 means the city can never be diff --git a/data/webperimental/units.ruleset b/data/webperimental/units.ruleset index 945dda9711..1b36109e4d 100644 --- a/data/webperimental/units.ruleset +++ b/data/webperimental/units.ruleset @@ -307,7 +307,8 @@ flags = "Unreachable", "DoesntOccupyTile", "HutFrighten" ; multiplication with 2/3, etc. ; Effectively increases *attack* by value percent. ; Bonus is defined in attackers entry. -; "LowFirepower" = Defender firepower is reduced to value 1 when +; "LowFirepower" = Defender firepower is reduced to low firepower +; value defined in game.ruleset when ; ever this has non-zero value. ; Bonus is defined in attackers entry. ; "CityDefensePct" = In a city, instead of "Defend_Bonus" effect diff --git a/fc_version b/fc_version index 9cff1487e2..29ea95e013 100755 --- a/fc_version +++ b/fc_version @@ -56,7 +56,7 @@ DEFAULT_FOLLOW_TAG=S3_1 # - No new mandatory capabilities can be added to the release branch; doing # so would break network capability of supposedly "compatible" releases. # -NETWORK_CAPSTRING="+Freeciv.Devel-3.1-2021.Dec.10" +NETWORK_CAPSTRING="+Freeciv.Devel-3.1-2021.Dec.25" FREECIV_DISTRIBUTOR="" diff --git a/server/ruleset.c b/server/ruleset.c index e7a1cc96d0..54217fa700 100644 --- a/server/ruleset.c +++ b/server/ruleset.c @@ -7343,6 +7343,19 @@ static bool load_ruleset_game(struct section_file *file, bool act, = secfile_lookup_bool_default(file, default_drbr, "combat_rules.damage_reduces_bombard_rate"); + game.info.low_firepower_badwallattacker + = secfile_lookup_int_default(file, 1, + "combat_rules.low_firepower_badwallattacker"); + game.info.low_firepower_pearl_harbour + = secfile_lookup_int_default(file, 1, + "combat_rules.low_firepower_pearl_harbour"); + game.info.low_firepower_combat_bonus + = secfile_lookup_int_default(file, 1, + "combat_rules.low_firepower_combat_bonus"); + game.info.low_firepower_nonnat_bombard + = secfile_lookup_int_default(file, 1, + "combat_rules.low_firepower_nonnat_bombard"); + game.info.nuke_pop_loss_pct = secfile_lookup_int_default_min_max(file, RS_DEFAULT_NUKE_POP_LOSS_PCT, RS_MIN_NUKE_POP_LOSS_PCT, diff --git a/tools/ruleutil/rulesave.c b/tools/ruleutil/rulesave.c index 47be9bc9f3..cdffbf4191 100644 --- a/tools/ruleutil/rulesave.c +++ b/tools/ruleutil/rulesave.c @@ -1372,6 +1372,14 @@ static bool save_game_ruleset(const char *filename, const char *name) save_default_bool(sfile, game.info.damage_reduces_bombard_rate, RS_DEFAULT_DAMAGE_REDUCES_BOMBARD_RATE, "combat_rules.damage_reduces_bombard_rate", NULL); + save_default_int(sfile, game.info.low_firepower_badwallattacker, 1, + "combat_rules.low_firepower_badwallattacker", NULL); + save_default_int(sfile, game.info.low_firepower_pearl_harbour, 1, + "combat_rules.low_firepower_pearl_harbour", NULL); + save_default_int(sfile, game.info.low_firepower_combat_bonus, 1, + "combat_rules.low_firepower_combat_bonus", NULL); + save_default_int(sfile, game.info.low_firepower_nonnat_bombard, 1, + "combat_rules.low_firepower_nonnat_bombard", NULL); save_default_int(sfile, game.info.nuke_pop_loss_pct, RS_DEFAULT_NUKE_POP_LOSS_PCT, "combat_rules.nuke_pop_loss_pct", NULL); -- 2.34.1