From 2388b1c259308878df3730f9f80c7de8160dc6ea Mon Sep 17 00:00:00 2001 From: Sveinung Kvilhaugsvik Date: Mon, 8 Feb 2021 06:29:08 +0100 Subject: [PATCH] Fix "Conquer Extras" disembark-punishments. Make it impossible to avoid disembark punishments by disembarking to a hut by adding the punishments to "Conquer Extras" too. - Make "Conquer Extras" actions block "Transport Disembark" actions. - Handle "Conquer Extras" in the slow_invasion ruleset upgrade code for 3.0 rulesets. - Add disembark-punishments to the existing rulesets. See osdn #41467 --- data/classic/effects.ruleset | 9 ++++ data/classic/game.ruleset | 44 +++++++++++++++---- data/experimental/effects.ruleset | 9 ++++ data/experimental/game.ruleset | 61 +++++++++++++++++++++++--- data/multiplayer/effects.ruleset | 9 ++++ data/multiplayer/game.ruleset | 44 +++++++++++++++---- data/sandbox/effects.ruleset | 9 ++++ data/sandbox/game.ruleset | 71 ++++++++++++++++++++++++++++--- server/rscompat.c | 15 ------- server/rssanity.c | 1 + 10 files changed, 231 insertions(+), 41 deletions(-) diff --git a/data/classic/effects.ruleset b/data/classic/effects.ruleset index e6f86c7cad..e31acad3e9 100644 --- a/data/classic/effects.ruleset +++ b/data/classic/effects.ruleset @@ -2606,6 +2606,15 @@ reqs = "UnitState", "OnNativeTile", "Local", TRUE } +[effect_action_success_move_cost_conquer_extras_from_non_native] +type = "Action_Success_Actor_Move_Cost" +value = 65535 +reqs = + { "type", "name", "range", "present" + "Action", "Conquer Extras 2", "Local", TRUE + "UnitState", "OnNativeTile", "Local", TRUE + } + [effect_unit_shield_value_recycle] type = "Unit_Shield_Value_Pct" value = -50 diff --git a/data/classic/game.ruleset b/data/classic/game.ruleset index 7440a4b045..ec4d2b6530 100644 --- a/data/classic/game.ruleset +++ b/data/classic/game.ruleset @@ -270,7 +270,8 @@ conquer_city_2_blocked_by = "Explode Nuclear", "Nuke City", "Nuke Units", ; Forbid regular unit move if one of the actions below is legal. move_is_blocked_by = "Transport Disembark", "Transport Disembark 2", - "Conquer Extras", "Enter Hut", "Enter Hut 2", + "Conquer Extras", "Conquer Extras 2", + "Enter Hut", "Enter Hut 2", "Frighten Hut", "Frighten Hut 2" ; If poison_empties_food_stock is set to TRUE a successful "Poison City" @@ -459,6 +460,9 @@ ui_name_conquer_city_2 = _("%sConquer City from non native%s") ; /* TRANS: _Capture Fortress (100% chance of success). */ ui_name_conquer_extras = _("%sCapture Fortress%s") +; /* TRANS: _Capture Fortress from non native (100% chance of success). */ +ui_name_conquer_extras_2 = _("%sCapture Fortress from non native%s") + ; /* TRANS: _Transform Terrain (3% chance of success). */ ui_name_transform_terrain = _("%sTransform Terrain%s") @@ -538,12 +542,13 @@ ui_name_frighten_hut_2 = _("Frighten %sHut%s") ; "Transport Disembark 2" is "Transport Disembark" but from a non native ; tile. "Conquer City 2" has the same relation to "Conquer City". So is -; "Enter Hut 2" for "Enter Hut" and "Frighten Hut 2" for "Frighten Hut". +; "Enter Hut 2" for "Enter Hut", "Frighten Hut 2" for "Frighten Hut" and +; "Conquer Extras" for "Conquer Extras 2". ; The version from the non native tile and the native tile version won't ; appear in the same action selection dialog given their opposite ; requirements. Avoid double entries in the auto help by silencing it. quiet_actions = "Transport Disembark 2", "Conquer City 2", "Enter Hut 2", - "Frighten Hut 2" + "Frighten Hut 2", "Conquer Extras 2" ; /* <-- avoid gettext warnings ; @@ -1294,19 +1299,42 @@ actor_reqs = "DiplRel", "Never met", "Local", FALSE } -[actionenabler_claim_extra_war] +[actionenabler_claim_extra_war_from_native_tile] action = "Conquer Extras" actor_reqs = - { "type", "name", "range" - "MinMoveFrags", "1", "Local" - "DiplRel", "War", "Local" + { "type", "name", "range" + "MinMoveFrags", "1", "Local" + "DiplRel", "War", "Local" + "UnitState", "OnNativeTile", "Local" + } + +[actionenabler_claim_extra_war_from_non_native] +action = "Conquer Extras 2" +actor_reqs = + { "type", "name", "range", "present" + "MinMoveFrags", "1", "Local", TRUE + "DiplRel", "War", "Local", TRUE + "UnitState", "OnNativeTile", "Local", FALSE } -[actionenabler_claim_extra_unowned] +[actionenabler_claim_extra_unowned_from_native_tile] action = "Conquer Extras" actor_reqs = { "type", "name", "range", "present" "MinMoveFrags", "1", "Local", TRUE + "UnitState", "OnNativeTile", "Local", TRUE + } +target_reqs = + { "type", "name", "range", "present" + "CityTile", "Extras Owned", "Local", FALSE + } + +[actionenabler_claim_extra_unowned_from_non_native] +action = "Conquer Extras 2" +actor_reqs = + { "type", "name", "range", "present" + "MinMoveFrags", "1", "Local", TRUE + "UnitState", "OnNativeTile", "Local", FALSE } target_reqs = { "type", "name", "range", "present" diff --git a/data/experimental/effects.ruleset b/data/experimental/effects.ruleset index 9ce343f63b..aaee42d1d2 100644 --- a/data/experimental/effects.ruleset +++ b/data/experimental/effects.ruleset @@ -2989,6 +2989,15 @@ reqs = "UnitState", "OnNativeTile", "Local", TRUE } +[effect_action_success_move_cost_conquer_extras_from_non_native] +type = "Action_Success_Actor_Move_Cost" +value = 65535 +reqs = + { "type", "name", "range", "present" + "Action", "Conquer Extras 2", "Local", TRUE + "UnitState", "OnNativeTile", "Local", TRUE + } + [effect_unit_shield_value_recycle] type = "Unit_Shield_Value_Pct" value = -50 diff --git a/data/experimental/game.ruleset b/data/experimental/game.ruleset index 0dd85e0baa..0b44faa422 100644 --- a/data/experimental/game.ruleset +++ b/data/experimental/game.ruleset @@ -275,7 +275,8 @@ conquer_city_2_blocked_by = "Explode Nuclear", "Nuke City", "Nuke Units", ; Forbid regular unit move if one of the actions below is legal. move_is_blocked_by = "Transport Disembark", "Transport Disembark 2", - "Conquer Extras", "Enter Hut", "Enter Hut 2", + "Conquer Extras", "Conquer Extras 2", + "Enter Hut", "Enter Hut 2", "Frighten Hut", "Frighten Hut 2" ; If poison_empties_food_stock is set to TRUE a successful "Poison City" @@ -464,6 +465,9 @@ ui_name_conquer_city_2 = _("%sConquer City from non native%s") ; /* TRANS: _Capture Fortress (100% chance of success). */ ui_name_conquer_extras = _("%sCapture Fortress%s") +; /* TRANS: _Capture Fortress from non native (100% chance of success). */ +ui_name_conquer_extras_2 = _("%sCapture Fortress from non native%s") + ; /* TRANS: _Transform Terrain (3% chance of success). */ ui_name_transform_terrain = _("%sTransform Terrain%s") @@ -543,12 +547,13 @@ ui_name_frighten_hut_2 = _("Frighten %sHut%s") ; "Transport Disembark 2" is "Transport Disembark" but from a non native ; tile. "Conquer City 2" has the same relation to "Conquer City". So is -; "Enter Hut 2" for "Enter Hut" and "Frighten Hut 2" for "Frighten Hut". +; "Enter Hut 2" for "Enter Hut" and "Frighten Hut 2" for "Frighten Hut" and +; "Conquer Extras" for "Conquer Extras 2". ; The version from the non native tile and the native tile version won't ; appear in the same action selection dialog given their opposite ; requirements. Avoid double entries in the auto help by silencing it. quiet_actions = "Transport Disembark 2", "Conquer City 2", "Enter Hut 2", - "Frighten Hut 2" + "Frighten Hut 2", "Conquer Extras 2" ; /* <-- avoid gettext warnings ; @@ -1341,19 +1346,65 @@ actor_reqs = "DiplRel", "Never met", "Local", FALSE } -[actionenabler_claim_extra_war] +[actionenabler_claim_extra_war_from_native_tile] +action = "Conquer Extras" +actor_reqs = + { "type", "name", "range" + "MinMoveFrags", "1", "Local" + "DiplRel", "War", "Local" + "UnitState", "OnNativeTile", "Local" + } + +[actionenabler_claim_extra_war_from_native_city] action = "Conquer Extras" actor_reqs = { "type", "name", "range" "MinMoveFrags", "1", "Local" "DiplRel", "War", "Local" + "CityTile", "Center", "Local" } -[actionenabler_claim_extra_unowned] +[actionenabler_claim_extra_war_from_non_native] +action = "Conquer Extras 2" +actor_reqs = + { "type", "name", "range", "present" + "MinMoveFrags", "1", "Local", TRUE + "DiplRel", "War", "Local", TRUE + "UnitState", "OnNativeTile", "Local", FALSE + "CityTile", "Center", "Local", FALSE + } + +[actionenabler_claim_extra_unowned_from_native_tile] action = "Conquer Extras" actor_reqs = { "type", "name", "range", "present" "MinMoveFrags", "1", "Local", TRUE + "UnitState", "OnNativeTile", "Local", TRUE + } +target_reqs = + { "type", "name", "range", "present" + "CityTile", "Extras Owned", "Local", FALSE + } + +[actionenabler_claim_extra_unowned_from_native_city] +action = "Conquer Extras" +actor_reqs = + { "type", "name", "range", "present" + "MinMoveFrags", "1", "Local", TRUE + "CityTile", "Center", "Local", TRUE + } +target_reqs = + { "type", "name", "range", "present" + "CityTile", "Extras Owned", "Local", FALSE + } + +[actionenabler_claim_extra_unowned_from_non_native] +action = "Conquer Extras 2" +actor_reqs = + { "type", "name", "range", "present" + "MinMoveFrags", "1", "Local", TRUE + "UnitState", "OnNativeTile", "Local", FALSE + "CityTile", "Center", "Local", FALSE } target_reqs = { "type", "name", "range", "present" diff --git a/data/multiplayer/effects.ruleset b/data/multiplayer/effects.ruleset index 38dd76263e..1e99fd424f 100644 --- a/data/multiplayer/effects.ruleset +++ b/data/multiplayer/effects.ruleset @@ -2633,6 +2633,15 @@ reqs = "UnitState", "OnNativeTile", "Local", TRUE } +[effect_action_success_move_cost_conquer_extras_from_non_native] +type = "Action_Success_Actor_Move_Cost" +value = 65535 +reqs = + { "type", "name", "range", "present" + "Action", "Conquer Extras 2", "Local", TRUE + "UnitState", "OnNativeTile", "Local", TRUE + } + [effect_unit_shield_value_recycle] type = "Unit_Shield_Value_Pct" value = -50 diff --git a/data/multiplayer/game.ruleset b/data/multiplayer/game.ruleset index eeb466bf42..5ad84994c5 100644 --- a/data/multiplayer/game.ruleset +++ b/data/multiplayer/game.ruleset @@ -270,7 +270,7 @@ conquer_city_2_blocked_by = "Explode Nuclear", "Nuke City", "Nuke Units", ; Forbid regular unit move if one of the actions below is legal. move_is_blocked_by = "Transport Disembark", "Transport Disembark 2", - "Conquer Extras" + "Conquer Extras", "Conquer Extras 2" ; If poison_empties_food_stock is set to TRUE a successful "Poison City" ; or "Poison City Escape" will empty the food stock. @@ -452,6 +452,9 @@ ui_name_conquer_city_2 = _("%sConquer City from non native%s") ; /* TRANS: _Capture Fortress (100% chance of success). */ ui_name_conquer_extras = _("%sCapture Fortress%s") +; /* TRANS: _Capture Fortress from non native (100% chance of success). */ +ui_name_conquer_extras_2 = _("%sCapture Fortress from non native%s") + ; /* TRANS: _Transform Terrain (3% chance of success). */ ui_name_transform_terrain = _("%sTransform Terrain%s") @@ -518,11 +521,13 @@ ui_name_transport_embark = _("%sEmbark%s") ; Can make the help text less redundant when you document it your self. ; "Transport Disembark 2" is "Transport Disembark" but from a non native -; tile. "Conquer City 2" has the same relation to "Conquer City". +; tile. "Conquer City 2" has the same relation to "Conquer City". So is +; "Conquer Extras" for "Conquer Extras 2". ; The version from the non native tile and the native tile version won't ; appear in the same action selection dialog given their opposite ; requirements. Avoid double entries in the auto help by silencing it. -quiet_actions = "Transport Disembark 2", "Conquer City 2" +quiet_actions = "Transport Disembark 2", "Conquer City 2", + "Conquer Extras 2" ; /* <-- avoid gettext warnings ; @@ -1238,19 +1243,42 @@ actor_reqs = "DiplRel", "Never met", "Local", FALSE } -[actionenabler_claim_extra_war] +[actionenabler_claim_extra_war_from_native_tile] action = "Conquer Extras" actor_reqs = - { "type", "name", "range" - "MinMoveFrags", "1", "Local" - "DiplRel", "War", "Local" + { "type", "name", "range" + "MinMoveFrags", "1", "Local" + "DiplRel", "War", "Local" + "UnitState", "OnNativeTile", "Local" + } + +[actionenabler_claim_extra_war_from_non_native] +action = "Conquer Extras 2" +actor_reqs = + { "type", "name", "range", "present" + "MinMoveFrags", "1", "Local", TRUE + "DiplRel", "War", "Local", TRUE + "UnitState", "OnNativeTile", "Local", FALSE } -[actionenabler_claim_extra_unowned] +[actionenabler_claim_extra_unowned_from_native_tile] action = "Conquer Extras" actor_reqs = { "type", "name", "range", "present" "MinMoveFrags", "1", "Local", TRUE + "UnitState", "OnNativeTile", "Local", TRUE + } +target_reqs = + { "type", "name", "range", "present" + "CityTile", "Extras Owned", "Local", FALSE + } + +[actionenabler_claim_extra_unowned_from_non_native] +action = "Conquer Extras 2" +actor_reqs = + { "type", "name", "range", "present" + "MinMoveFrags", "1", "Local", TRUE + "UnitState", "OnNativeTile", "Local", FALSE } target_reqs = { "type", "name", "range", "present" diff --git a/data/sandbox/effects.ruleset b/data/sandbox/effects.ruleset index b7b08355a9..1c72af118b 100644 --- a/data/sandbox/effects.ruleset +++ b/data/sandbox/effects.ruleset @@ -4519,6 +4519,15 @@ reqs = "UnitState", "OnNativeTile", "Local", TRUE } +[effect_action_success_move_cost_conquer_extras_from_non_native] +type = "Action_Success_Actor_Move_Cost" +value = 65535 +reqs = + { "type", "name", "range", "present" + "Action", "Conquer Extras 2", "Local", TRUE + "UnitState", "OnNativeTile", "Local", TRUE + } + [effect_unit_shield_value_recycle] type = "Unit_Shield_Value_Pct" value = -50 diff --git a/data/sandbox/game.ruleset b/data/sandbox/game.ruleset index 8dc58d776a..cc27978e52 100644 --- a/data/sandbox/game.ruleset +++ b/data/sandbox/game.ruleset @@ -287,7 +287,8 @@ conquer_city_2_blocked_by = "Capture Units", "Bombard", ; Forbid regular unit move if one of the actions below is legal. move_is_blocked_by = "Transport Disembark", "Transport Disembark 2", - "Conquer Extras", "Enter Hut", "Enter Hut 2", + "Conquer Extras", "Conquer Extras 2", + "Enter Hut", "Enter Hut 2", "Frighten Hut", "Frighten Hut 2" ; If poison_empties_food_stock is set to TRUE a successful "Poison City" @@ -488,6 +489,9 @@ ui_name_conquer_city_2 = _("%sConquer City from non native%s") ; /* TRANS: _Storm the Castle (100% chance of success). */ ui_name_conquer_extras = _("%sStorm the Castle%s") +; /* TRANS: _Storm the Castle from non native (100% chance of success). */ +ui_name_conquer_extras_2 = _("%sStorm the Castle from non native%s") + ; /* TRANS: _Transform Terrain (3% chance of success). */ ui_name_transform_terrain = _("%sTransform Terrain%s") @@ -575,12 +579,13 @@ user_action_1_actor_consuming_always = FALSE ; "Transport Disembark 2" is "Transport Disembark" but from a non native ; tile. "Conquer City 2" has the same relation to "Conquer City". So is -; "Enter Hut 2" for "Enter Hut" and "Frighten Hut 2" for "Frighten Hut". +; "Enter Hut 2" for "Enter Hut", "Frighten Hut 2" for "Frighten Hut" and +; "Conquer Extras" for "Conquer Extras 2". ; The version from the non native tile and the native tile version won't ; appear in the same action selection dialog given their opposite ; requirements. Avoid double entries in the auto help by silencing it. quiet_actions = "Transport Disembark 2", "Conquer City 2", "Enter Hut 2", - "Frighten Hut 2" + "Frighten Hut 2", "Conquer Extras 2" ; /* <-- avoid gettext warnings ; @@ -1513,7 +1518,20 @@ target_reqs = "Terrain", "Deep Ocean", "Local", TRUE } -[actionenabler_claim_extra_foreign] +[actionenabler_claim_extra_foreign_from_native_tile] +action = "Conquer Extras" +actor_reqs = + { "type", "name", "range", "present" + "MinMoveFrags", "1", "Local", TRUE + "DiplRel", "Foreign", "Local", TRUE + "DiplRel", "Peace", "Local", FALSE + "DiplRel", "Alliance", "Local", FALSE + "DiplRel", "Team", "Local", FALSE + "UnitFlag", "NonMil", "Local", FALSE + "UnitState", "OnNativeTile", "Local", TRUE + } + +[actionenabler_claim_extra_foreign_from_native_city] action = "Conquer Extras" actor_reqs = { "type", "name", "range", "present" @@ -1523,14 +1541,57 @@ actor_reqs = "DiplRel", "Alliance", "Local", FALSE "DiplRel", "Team", "Local", FALSE "UnitFlag", "NonMil", "Local", FALSE + "CityTile", "Center", "Local", TRUE + } + +[actionenabler_claim_extra_foreign_from_non_native] +action = "Conquer Extras 2" +actor_reqs = + { "type", "name", "range", "present" + "MinMoveFrags", "1", "Local", TRUE + "DiplRel", "Foreign", "Local", TRUE + "DiplRel", "Peace", "Local", FALSE + "DiplRel", "Alliance", "Local", FALSE + "DiplRel", "Team", "Local", FALSE + "UnitFlag", "NonMil", "Local", FALSE + "UnitState", "OnNativeTile", "Local", FALSE + "CityTile", "Center", "Local", FALSE + } + +[actionenabler_claim_extra_unowned_from_native_tile] +action = "Conquer Extras" +actor_reqs = + { "type", "name", "range", "present" + "MinMoveFrags", "1", "Local", TRUE + "UnitFlag", "NonMil", "Local", FALSE + "UnitState", "OnNativeTile", "Local", TRUE + } +target_reqs = + { "type", "name", "range", "present" + "CityTile", "Extras Owned", "Local", FALSE } -[actionenabler_claim_extra_unowned] +[actionenabler_claim_extra_unowned_from_native_city] action = "Conquer Extras" actor_reqs = { "type", "name", "range", "present" "MinMoveFrags", "1", "Local", TRUE "UnitFlag", "NonMil", "Local", FALSE + "CityTile", "Center", "Local", TRUE + } +target_reqs = + { "type", "name", "range", "present" + "CityTile", "Extras Owned", "Local", FALSE + } + +[actionenabler_claim_extra_unowned_from_non_native] +action = "Conquer Extras 2" +actor_reqs = + { "type", "name", "range", "present" + "MinMoveFrags", "1", "Local", TRUE + "UnitFlag", "NonMil", "Local", FALSE + "UnitState", "OnNativeTile", "Local", FALSE + "CityTile", "Center", "Local", FALSE } target_reqs = { "type", "name", "range", "present" diff --git a/server/rscompat.c b/server/rscompat.c index 33e57b1d9f..12f3ba38e2 100644 --- a/server/rscompat.c +++ b/server/rscompat.c @@ -784,21 +784,6 @@ void rscompat_postprocess(struct rscompat_info *info) enabler->action = ACTION_TRANSPORT_UNLOAD; action_enabler_add(enabler); - enabler = action_enabler_new(); - enabler->action = ACTION_CONQUER_EXTRAS; - e_req = req_from_values(VUT_DIPLREL, REQ_RANGE_LOCAL, - FALSE, TRUE, TRUE, DS_WAR); - requirement_vector_append(&enabler->actor_reqs, e_req); - action_enabler_add(enabler); - - enabler = action_enabler_new(); - enabler->action = ACTION_CONQUER_EXTRAS; - e_req = req_from_values(VUT_CITYTILE, REQ_RANGE_LOCAL, - FALSE, FALSE, TRUE, - CITYT_EXTRAS_OWNED); - requirement_vector_append(&enabler->target_reqs, e_req); - action_enabler_add(enabler); - /* Update action enablers. */ rscompat_enablers_add_obligatory_hard_reqs(); action_enablers_iterate(ae) { diff --git a/server/rssanity.c b/server/rssanity.c index 99414d39c5..826caea4f1 100644 --- a/server/rssanity.c +++ b/server/rssanity.c @@ -1362,6 +1362,7 @@ bool autoadjust_ruleset_data(void) /* Hard code that the ability to enter or frighten a hut blocks * regular disembarking. */ + { ACTRES_TRANSPORT_DISEMBARK, ACTRES_CONQUER_EXTRAS }, { ACTRES_TRANSPORT_DISEMBARK, ACTRES_HUT_ENTER }, { ACTRES_TRANSPORT_DISEMBARK, ACTRES_HUT_FRIGHTEN }, }; -- 2.20.1