From 2f0e3ab4f7db76cd5b68dafafc09aca180ece5c5 Mon Sep 17 00:00:00 2001 From: Sveinung Kvilhaugsvik Date: Mon, 22 Feb 2021 14:30:30 +0100 Subject: [PATCH] Action escape movement cost to the ruleset. Move the movement cost of escaping to the nearest city after performing a spy action to the ruleset. See osdn #41628 --- data/civ2/effects.ruleset | 81 ++++++++++++++++++++++++++ data/civ2civ3/effects.ruleset | 70 +++++++++++++++++++++++ data/classic/effects.ruleset | 70 +++++++++++++++++++++++ data/experimental/effects.ruleset | 70 +++++++++++++++++++++++ data/multiplayer/effects.ruleset | 70 +++++++++++++++++++++++ data/sandbox/effects.ruleset | 84 +++++++++++++++++++++++++++ data/webperimental/effects.ruleset | 91 ++++++++++++++++++++++++++++++ server/diplomats.c | 6 +- server/rscompat.c | 19 +++++++ 9 files changed, 559 insertions(+), 2 deletions(-) diff --git a/data/civ2/effects.ruleset b/data/civ2/effects.ruleset index a9096bc127..6d9b57c8ca 100644 --- a/data/civ2/effects.ruleset +++ b/data/civ2/effects.ruleset @@ -2477,6 +2477,87 @@ reqs = "Action", "Establish Embassy", "Local", TRUE } +[effect_action_success_establish_embassy] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Establish Embassy","Local",TRUE +} + +[effect_action_success_investigate_city] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Investigate City","Local",TRUE +} + +[effect_action_success_poison_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Poison City Escape","Local",TRUE +} + +[effect_action_success_sabotage_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Sabotage City Escape","Local",TRUE +} + +[effect_action_success_targeted_sabotage_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Targeted Sabotage City Escape","Local",TRUE +} + +[effect_action_success_sabotage_city_production_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Sabotage City Production Escape","Local",TRUE +} + +[effect_action_success_steal_tech_escape_expected] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Steal Tech Escape Expected","Local",TRUE +} + +[effect_action_success_targeted_steal_tech_escape_expected] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Targeted Steal Tech Escape Expected","Local",TRUE +} + +[effect_action_success_incite_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Incite City Escape","Local",TRUE +} + +[effect_action_success_unit_sabotage] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs = + { + "type", "name", "range", "quiet" + "Action", "Sabotage Unit Escape", "Local", TRUE + } + +[effect_action_success_suitcase_nuke] +type = "Action_Success_Actor_Move_Cost" +value = 65535 +reqs = + { + "type", "name", "range", "quiet" + "Action", "Suitcase Nuke Escape", "Local", TRUE + } + [effect_action_success_move_cost_investigate] type = "Action_Success_Actor_Move_Cost" value = 1 diff --git a/data/civ2civ3/effects.ruleset b/data/civ2civ3/effects.ruleset index 4099fb71e6..cfb63f7d67 100644 --- a/data/civ2civ3/effects.ruleset +++ b/data/civ2civ3/effects.ruleset @@ -4227,6 +4227,76 @@ reqs = "BuildingGenus", "GreatWonder", "Local" } +[effect_action_success_establish_embassy] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Establish Embassy","Local",TRUE +} + +[effect_action_success_investigate_city] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Investigate City","Local",TRUE +} + +[effect_action_success_poison_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Poison City Escape","Local",TRUE +} + +[effect_action_success_sabotage_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Sabotage City Escape","Local",TRUE +} + +[effect_action_success_targeted_sabotage_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Targeted Sabotage City Escape","Local",TRUE +} + +[effect_action_success_sabotage_city_production_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Sabotage City Production Escape","Local",TRUE +} + +[effect_action_success_steal_tech_escape_expected] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Steal Tech Escape Expected","Local",TRUE +} + +[effect_action_success_targeted_steal_tech_escape_expected] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Targeted Steal Tech Escape Expected","Local",TRUE +} + +[effect_action_success_incite_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Incite City Escape","Local",TRUE +} + +[effect_action_success_sabotage_unit_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Sabotage Unit Escape","Local",TRUE +} + [effect_action_success_move_cost_embassy] type = "Action_Success_Actor_Move_Cost" value = 1 diff --git a/data/classic/effects.ruleset b/data/classic/effects.ruleset index 9af0199b10..7093486473 100644 --- a/data/classic/effects.ruleset +++ b/data/classic/effects.ruleset @@ -2500,6 +2500,76 @@ reqs = "BuildingGenus", "GreatWonder", "Local" } +[effect_action_success_establish_embassy] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Establish Embassy","Local",TRUE +} + +[effect_action_success_investigate_city] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Investigate City","Local",TRUE +} + +[effect_action_success_poison_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Poison City Escape","Local",TRUE +} + +[effect_action_success_sabotage_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Sabotage City Escape","Local",TRUE +} + +[effect_action_success_targeted_sabotage_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Targeted Sabotage City Escape","Local",TRUE +} + +[effect_action_success_sabotage_city_production_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Sabotage City Production Escape","Local",TRUE +} + +[effect_action_success_steal_tech_escape_expected] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Steal Tech Escape Expected","Local",TRUE +} + +[effect_action_success_targeted_steal_tech_escape_expected] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Targeted Steal Tech Escape Expected","Local",TRUE +} + +[effect_action_success_incite_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Incite City Escape","Local",TRUE +} + +[effect_action_success_sabotage_unit_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Sabotage Unit Escape","Local",TRUE +} + [effect_action_success_move_cost_embassy] type = "Action_Success_Actor_Move_Cost" value = 1 diff --git a/data/experimental/effects.ruleset b/data/experimental/effects.ruleset index 7ae43723e5..78ad774f2f 100644 --- a/data/experimental/effects.ruleset +++ b/data/experimental/effects.ruleset @@ -2953,6 +2953,76 @@ reqs = "UnitFlag", "OneAttack", "Local", TRUE } +[effect_action_success_establish_embassy] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Establish Embassy","Local",TRUE +} + +[effect_action_success_investigate_city] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Investigate City","Local",TRUE +} + +[effect_action_success_poison_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Poison City Escape","Local",TRUE +} + +[effect_action_success_sabotage_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Sabotage City Escape","Local",TRUE +} + +[effect_action_success_targeted_sabotage_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Targeted Sabotage City Escape","Local",TRUE +} + +[effect_action_success_sabotage_city_production_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Sabotage City Production Escape","Local",TRUE +} + +[effect_action_success_steal_tech_escape_expected] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Steal Tech Escape Expected","Local",TRUE +} + +[effect_action_success_targeted_steal_tech_escape_expected] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Targeted Steal Tech Escape Expected","Local",TRUE +} + +[effect_action_success_incite_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Incite City Escape","Local",TRUE +} + +[effect_action_success_sabotage_unit_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Sabotage Unit Escape","Local",TRUE +} + [effect_unit_shield_value_recycle] type = "Unit_Shield_Value_Pct" value = -50 diff --git a/data/multiplayer/effects.ruleset b/data/multiplayer/effects.ruleset index 9cfd29b26c..b7d2ff0fb9 100644 --- a/data/multiplayer/effects.ruleset +++ b/data/multiplayer/effects.ruleset @@ -2597,6 +2597,76 @@ reqs = "UnitFlag", "OneAttack", "Local", TRUE } +[effect_action_success_establish_embassy] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Establish Embassy","Local",TRUE +} + +[effect_action_success_investigate_city] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Investigate City","Local",TRUE +} + +[effect_action_success_poison_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Poison City Escape","Local",TRUE +} + +[effect_action_success_sabotage_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Sabotage City Escape","Local",TRUE +} + +[effect_action_success_targeted_sabotage_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Targeted Sabotage City Escape","Local",TRUE +} + +[effect_action_success_sabotage_city_production_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Sabotage City Production Escape","Local",TRUE +} + +[effect_action_success_steal_tech_escape_expected] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Steal Tech Escape Expected","Local",TRUE +} + +[effect_action_success_targeted_steal_tech_escape_expected] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Targeted Steal Tech Escape Expected","Local",TRUE +} + +[effect_action_success_incite_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Incite City Escape","Local",TRUE +} + +[effect_action_success_sabotage_unit_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Sabotage Unit Escape","Local",TRUE +} + [effect_unit_shield_value_recycle] type = "Unit_Shield_Value_Pct" value = -50 diff --git a/data/sandbox/effects.ruleset b/data/sandbox/effects.ruleset index 72a0ed69da..0baffbfd25 100644 --- a/data/sandbox/effects.ruleset +++ b/data/sandbox/effects.ruleset @@ -4365,6 +4365,90 @@ reqs = "BuildingGenus", "GreatWonder", "Local" } +[effect_success_move_cost_establish_embassy] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Establish Embassy","Local",TRUE +} + +[effect_success_move_cost_investigate_city] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Investigate City","Local",TRUE +} + +[effect_success_move_cost_poison_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Poison City Escape","Local",TRUE +} + +[effect_success_move_cost_sabotage_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Sabotage City Escape","Local",TRUE +} + +[effect_success_move_cost_targeted_sabotage_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Targeted Sabotage City Escape","Local",TRUE +} + +[effect_success_move_cost_sabotage_city_production_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Sabotage City Production Escape","Local",TRUE +} + +[effect_success_move_cost_steal_tech_escape_expected] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Steal Tech Escape Expected","Local",TRUE +} + +[effect_success_move_cost_targeted_steal_tech_escape_expected] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Targeted Steal Tech Escape Expected","Local",TRUE +} + +[effect_success_move_cost_incite_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Incite City Escape","Local",TRUE +} + +[effect_success_move_cost_sabotage_unit_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Sabotage Unit Escape","Local",TRUE +} + +[effect_success_move_cost_steal_maps_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Steal Maps Escape","Local",TRUE +} + +[effect_success_move_cost_steal_gold_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Steal Gold Escape","Local",TRUE +} + [effect_action_success_move_cost_embassy] type = "Action_Success_Actor_Move_Cost" value = 1 diff --git a/data/webperimental/effects.ruleset b/data/webperimental/effects.ruleset index 2c3468f9bd..bd36b2dbf9 100644 --- a/data/webperimental/effects.ruleset +++ b/data/webperimental/effects.ruleset @@ -2717,6 +2717,97 @@ reqs = "BuildingGenus", "GreatWonder", "Local" } +[effect_action_success_move_cost_establish_embassy] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Establish Embassy","Local",TRUE +} + +[effect_action_success_move_cost_investigate_city] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Investigate City","Local",TRUE +} + +[effect_action_success_move_cost_poison_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Poison City Escape","Local",TRUE +} + +[effect_action_success_move_cost_steal_gold_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Steal Gold Escape","Local",TRUE +} + +[effect_action_success_move_cost_sabotage_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Sabotage City Escape","Local",TRUE +} + +[effect_action_success_move_cost_targeted_sabotage_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Targeted Sabotage City Escape","Local",TRUE +} + +[effect_action_success_move_cost_sabotage_city_production_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Sabotage City Production Escape","Local",TRUE +} + +[effect_action_success_move_cost_steal_tech_escape_expected] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Steal Tech Escape Expected","Local",TRUE +} + +[effect_action_success_move_cost_targeted_steal_tech_escape_expected] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Targeted Steal Tech Escape Expected","Local",TRUE +} + +[effect_action_success_move_cost_incite_city_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Incite City Escape","Local",TRUE +} + +[effect_action_success_move_cost_sabotage_unit_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Sabotage Unit Escape","Local",TRUE +} + +[effect_action_success_move_cost_steal_maps_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Steal Maps Escape","Local",TRUE +} + +[effect_action_success_move_cost_suitcase_nuke_escape] +type="Action_Success_Actor_Move_Cost" +value=65535 +reqs={"type","name","range","quiet" + "Action","Suitcase Nuke Escape","Local",TRUE +} + [effect_action_success_move_cost_embassy] type = "Action_Success_Actor_Move_Cost" value = 1 diff --git a/server/diplomats.c b/server/diplomats.c index d82d605fa2..4583e400bd 100644 --- a/server/diplomats.c +++ b/server/diplomats.c @@ -2163,8 +2163,10 @@ static void diplomat_escape_full(struct player *pplayer, notify_unit_experience(pdiplomat); } - /* being teleported costs all movement */ - if (!teleport_unit_to_city (pdiplomat, spyhome, -1, FALSE)) { + if (!teleport_unit_to_city (pdiplomat, spyhome, + /* Handled by the ruleset. */ + 0, + FALSE)) { send_unit_info(NULL, pdiplomat); log_error("Bug in diplomat_escape: Spy can't teleport."); return; diff --git a/server/rscompat.c b/server/rscompat.c index 7b954ebaa6..0c31221056 100644 --- a/server/rscompat.c +++ b/server/rscompat.c @@ -721,6 +721,25 @@ void rscompat_postprocess(struct rscompat_info *info) effect_req_append(peffect, req_from_str("UnitFlag", "Local", FALSE, TRUE, TRUE, "OneAttack")); + /* Post successful action move fragment loss for spy post action escape + * has moved to the ruleset. */ + action_iterate(act_id) { + struct action *paction = action_by_number(act_id); + + if (paction->actor.is_unit.moves_actor != MAK_ESCAPE + || paction->actor_consuming_always) { + /* Not relevant. */ + continue; + } + + peffect = effect_new(EFT_ACTION_SUCCESS_MOVE_COST, + MAX_MOVE_FRAGS, NULL); + /* The reduction only applies to this action. */ + effect_req_append(peffect, req_from_str("Action", "Local", + FALSE, TRUE, TRUE, + action_rule_name(paction))); + } action_iterate_end; + /* Post successful action move fragment loss for targets of * "Paradrop Unit" has moved to the Action_Success_Actor_Move_Cost * effect. */ -- 2.20.1