From f6448df1a46b4ffb1166efbd2757826e4ccc0368 Mon Sep 17 00:00:00 2001 From: Sveinung Kvilhaugsvik Date: Fri, 12 Mar 2021 15:38:04 +0100 Subject: [PATCH 13/13] sandbox: demonstrate user effects. Decide if "Use Ancient Transportation Network" should be able to conquer a city or an extra at its target tile based on User_Effect_1 and User_Effect_2. See osdn #41750 --- data/sandbox/effects.ruleset | 60 ++++++++++++++++++++++++++++++++++++ data/sandbox/script.lua | 6 +++- 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/data/sandbox/effects.ruleset b/data/sandbox/effects.ruleset index f3ea4067dd..73135e38ce 100644 --- a/data/sandbox/effects.ruleset +++ b/data/sandbox/effects.ruleset @@ -4523,6 +4523,66 @@ reqs = "Action", "User Action 2", "Local", TRUE } +[effect_use_ancient_transportation_network_can_conquer_city] +type = "User_Effect_1" +value = 1 +reqs = + { "type", "name", "range", "present" + ; sandbox doesn't have animal barbarians yet + "UnitClassFlag", "CanOccupyCity", "Local", TRUE + "UnitFlag", "NonMil", "Local", FALSE + "DiplRel", "War", "Local", TRUE + "Building", "Treuga Dei", "World", FALSE + } + +[effect_use_ancient_transportation_network_can_conquer_city_despite_treuga_dei] +type = "User_Effect_1" +value = 1 +reqs = + { "type", "name", "range", "present", "survives" + ; sandbox doesn't have animal barbarians yet + "UnitClassFlag", "CanOccupyCity", "Local", TRUE, FALSE + "UnitFlag", "NonMil", "Local", FALSE, FALSE + "DiplRel", "War", "Local", TRUE, FALSE + "Tech", "Communism", "World", TRUE, TRUE + } + +[effect_use_ancient_transportation_network_can_conquer_extra_war] +type = "User_Effect_2" +value = 1 +reqs = + { "type", "name", "range", "present" + "DiplRel", "War", "Local", TRUE + "Building", "Treuga Dei", "World", FALSE + } + +[effect_use_ancient_transportation_network_can_conquer_extra_war_despite_treuga_dei] +type = "User_Effect_2" +value = 1 +reqs = + { "type", "name", "range", "present", "survives" + "DiplRel", "War", "Local", TRUE, FALSE + "Tech", "Communism", "World", TRUE, TRUE + } + +[effect_use_ancient_transportation_network_can_conquer_extra_unowned] +type = "User_Effect_2" +value = 1 +reqs = + { "type", "name", "range", "present" + "CityTile", "Extras Owned", "Local", FALSE + "Building", "Treuga Dei", "World", FALSE + } + +[effect_use_ancient_transportation_network_can_conquer_extra_unowned_despite_treuga_dei] +type = "User_Effect_2" +value = 1 +reqs = + { "type", "name", "range", "present", "survives" + "CityTile", "Extras Owned", "Local", FALSE, FALSE + "Tech", "Communism", "World", TRUE, TRUE + } + [effect_action_success_move_cost_bombard] type = "Action_Success_Actor_Move_Cost" value = 65535 diff --git a/data/sandbox/script.lua b/data/sandbox/script.lua index cacead1d48..a931207ee9 100644 --- a/data/sandbox/script.lua +++ b/data/sandbox/script.lua @@ -461,6 +461,10 @@ signal.connect("action_started_unit_unit", "action_started_unit_unit_callback") -- Use Ancient Transportation Network function transport_network(action, actor, target) local actor_name = actor.utype:name_translation() + local invade_city_val = effects.unit_bonus(actor, target.owner, + "User_Effect_1") + local invade_extra_val = effects.unit_vs_tile_bonus(actor, target, + "User_Effect_2") local survived = actor:teleport(target, -- allow transport to transport find.transport_unit(actor.owner, @@ -468,7 +472,7 @@ function transport_network(action, actor, target) true, -- assume cities and castles considered -- the ancient hub when they were built - false, false, + invade_city_val > 0, invade_extra_val > 0, -- a unit appearing from the Ancient -- Transportation Network is scary to see false, true) -- 2.20.1