From 3367aec56e94795c032fea6ca186ab979359978e Mon Sep 17 00:00:00 2001 From: Christopher Brown Date: Sun, 8 Oct 2023 15:23:45 +1000 Subject: [PATCH 1/2] Ignore beasts in player areas for Russia's loss condition. For Unconstrained Fangs' prepared beasts. --- objects/1ea4cf/script.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/objects/1ea4cf/script.lua b/objects/1ea4cf/script.lua index 0802a481c..0a8a74630 100644 --- a/objects/1ea4cf/script.lua +++ b/objects/1ea4cf/script.lua @@ -201,11 +201,14 @@ function checkLoss() local count = 0 local beasts = getObjectsWithTag("Beasts") for _,obj in pairs(beasts) do - local quantity = obj.getQuantity() - if quantity == -1 then - count = count + 1 - else - count = count + quantity + -- Beast is not in player area + if #obj.getZones() == 0 then + local quantity = obj.getQuantity() + if quantity == -1 then + count = count + 1 + else + count = count + quantity + end end end if not Global.getVar("SetupChecker").call("isSpiritPickable", {guid="165f82"}) then From c575da1ba01b989867b00dfd90b16018a231c347 Mon Sep 17 00:00:00 2001 From: Christopher Brown Date: Mon, 16 Oct 2023 13:48:08 +1000 Subject: [PATCH 2/2] Make Russia account for the Endless Dark in a player area. When checking Russia's loss condition, if a beast is in the player area, raycast from it to see if it's over an island tile, and count it if it is. This allows people to keep the Endless Dark in the player area. --- objects/1ea4cf/script.lua | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/objects/1ea4cf/script.lua b/objects/1ea4cf/script.lua index 0a8a74630..e85d588d4 100644 --- a/objects/1ea4cf/script.lua +++ b/objects/1ea4cf/script.lua @@ -201,8 +201,22 @@ function checkLoss() local count = 0 local beasts = getObjectsWithTag("Beasts") for _,obj in pairs(beasts) do - -- Beast is not in player area - if #obj.getZones() == 0 then + -- Count the beast if it's not in a player area, or if it is in a player area but over the island (e.g. the Endless Dark) + local isOnIsland = (#obj.getZones() == 0) + if not isOnIsland then + local hits = Physics.cast({ + origin = obj.getBounds().center, + direction = Vector(0,-1,0), + max_distance = 6, + }) + for _,v in pairs(hits) do + if v.hit_object ~= obj and Global.call("isIsland", {obj=v.hit_object}) then + isOnIsland = true + break + end + end + end + if isOnIsland then local quantity = obj.getQuantity() if quantity == -1 then count = count + 1