Skip to content

Commit

Permalink
Merge pull request #1 from Br00ty/update-testing
Browse files Browse the repository at this point in the history
update logic, fix recursions
  • Loading branch information
Br00ty authored Oct 23, 2023
2 parents b3f63b0 + ea7ab45 commit 67e4c38
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 71 deletions.
17 changes: 8 additions & 9 deletions locations/locations.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@
{
"name": "Rafters",
"access_rules": [
"$dungeon_strong_eyes,cling",
"$dungeon_strong_eyes,$can_slidejump,$Getkicks|3",
"$dungeon_strong_eyes,$Getkicks|3,sunsetter"
"$dungeon_strong_eyes|true,[$dungeon_strong_eyes],cling",
"$dungeon_strong_eyes|true,[$dungeon_strong_eyes],$can_slidejump,$Getkicks|3",
"$dungeon_strong_eyes|true,[$dungeon_strong_eyes],$Getkicks|3,sunsetter"
],
"sections": [
{
Expand All @@ -83,7 +83,7 @@
},
{
"name": "Strong Eyes",
"access_rules": ["$dungeon_strong_eyes"],
"access_rules": ["$dungeon_strong_eyes|true,[$dungeon_strong_eyes]"],
"sections": [
{
"item_count": 1,
Expand Down Expand Up @@ -120,8 +120,8 @@
{
"name": "Past Poles",
"access_rules": [
"$dungeon_strong_eyes,$Getkicks|3",
"$dungeon_strong_eyes,cling"
"$dungeon_strong_eyes|true,[$dungeon_strong_eyes],$Getkicks|3",
"$dungeon_strong_eyes|true,[$dungeon_strong_eyes],cling"
],
"sections": [
{
Expand Down Expand Up @@ -419,11 +419,10 @@
{
"name": "Strikebreak",
"access_rules": [
"$keep_main,slide,$can_slidejump",
"$keep_main,$can_slidejump",
"$keep_main,slide,$Getkicks|1",
"$keep_main,slide,cling",
"$keep_main,$can_strikebreak,$can_slidejump",
"$keep_main,$can_strikebreak,$Getkicks|3",
"$keep_main,$can_strikebreak,$Getkicks|1",
"$keep_main,$can_strikebreak,cling"
],
"sections": [
Expand Down
174 changes: 112 additions & 62 deletions scripts/logic/logic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,50 +75,53 @@ end
-- Quick Functions
function has_small_keys(n)
-- print("has_small_keys")
return has("smallkey",6)
return has("smallkey",7)
end

function can_bounce(n)
-- print("can_bounce")
return breaker() and ascendant()
return breaker(n) and ascendant(n)
end

function more_kicks(n)
-- print("more_kicks")
return greaves() and heliacal()
return greaves(n) and heliacal(n)
end

function can_slidejump(n)
-- print("can_slidejump")
return slide() and solar()
return slide(n) and solar(n)
end

function navigate_darkrooms(n)
-- print("navigate_darkrooms")
return (breaker() or ascendant())
return (breaker(n) or ascendant(n))
end

function can_strikebreak(n)
-- print("can_strikebreak")
return breaker() and strikebreak()
return breaker(n) and strikebreak(n)
end

function can_soulcutter(n)
-- print("can_soulcutter")
return breaker() and strikebreak() and cutter()
return breaker(n) and strikebreak(n) and cutter(n)
end

function can_sunsetter(n)
-- print("can_sunsetter")
return breaker() and sunsetter()
return breaker(n) and sunsetter(n)
end

function can_attack(n)
-- print("can_sunsetter")
return breaker() or sunsetter()
return breaker(n) or sunsetter(n)
end

function Kickorplunge(count)
function Kickorplunge(count, n)
if n == nil then; n = 0; end
if n > 10 then; return false; end -- detect 10th step when trying to resolve and abort
n = n + 1
local total = 0
if has("greaves") then
total = total + 3
Expand All @@ -131,7 +134,10 @@ function Kickorplunge(count)
return (total >= count)
end

function Getkicks(count)
function Getkicks(count, n)
if n == nil then; n = 0; end
if n > 10 then; return false; end -- detect 10th step when trying to resolve and abort
n = n + 1
local kicks = 0
if has("greaves") then
kicks = kicks + 3
Expand All @@ -142,134 +148,157 @@ function Getkicks(count)
end

-- Region functions
function dungeon_strong_eyes(n)
-- Dungeon
function dungeon_mirror(n)
if n == nil then; n = 0; end
if n > 10 then; return false; end -- detect 10th step when trying to resolve and abort
n = n + 1
-- print("dungeon_strong_eyes")
return slide(n) and breaker(n)
--print("dungeon_mirror")
return breaker(n)
end

function dungeon_strong_eyes(outOflogic, n)
if n == nil then; n = 0; end
if n > 10 then; return false; end -- detect 10th step when trying to resolve and abort
n = n + 1
if outOflogic then
return (slide(n) and breaker(n)) or (has("smallkey",1) and (empty_bailey(n) or Castle_spiral_climb(n)) and dungeon_mirror(n))
end
--print("dungeon_strong_eyes")
return (slide(n) and dungeon_mirror(n)) or (has_small_keys(n) and (empty_bailey(n) or Castle_spiral_climb(n)) and dungeon_mirror(n))
end

-- Underbelly
function underbelly_main(n)
if n == nil then; n = 0; end
if n > 10 then; return false; end -- detect 10th step when trying to resolve and abort
n = n + 1
-- print("underbelly_main")
--print("underbelly_main")
return breaker(n) or (sunsetter(n) and (tower_remains(n) or underbelly_hole(n)))
end

function underbelly_hole(n)
if n == nil then; n = 0; end
if n > 10 then; return false; end -- detect 10th step when trying to resolve and abort
n = n + 1
--print("underbelly_hole")
return Kickorplunge(1) and ((cling(n) and theatre_main(n)) or ((has_small_keys(n) and dungeon_strong_eyes(n)) or Castle_spiral_climb(n)))
--return Kickorplunge(1) and keep_main(n)
end

-- Theatre
function theatre_main(n)
if n == nil then; n = 0; end
if n > 10 then; return false; end -- detect 10th step when trying to resolve and abort
n = n + 1
-- print("theatre_main")
return (cling(n) and (greaves(n) or can_slidejump(n))) or
(cling(n) and (greaves(n) or can_slidejump(n)) and keep_main(n)) or
--print("theatre_main")
return (cling(n) and (Getkicks(3) or can_slidejump(n)) and dungeon_mirror(n)) or
(cling(n) and (Getkicks(3) or can_slidejump(n)) and ((has_small_keys(n) and dungeon_strong_eyes(n)) or ((sunsetter(n) or breaker(n)) and (breaker(n) or (sunsetter(n) and tower_remains(n)))) or Castle_spiral_climb(n))) or -- castle_sansa() = reduced keep_main() rule, and then reduced castle_sansa more to help more recurssions
((sunsetter(n) and cling(n)) or (sunsetter(n) and Getkicks(4)) and theatre_pillar(n)) or
Theatre_front(n)
end

function castle_sansa(outOflogic, n)
function theatre_pillar(n)
if n == nil then; n = 0; end
if n > 10 then; return false; end -- detect 10th step when trying to resolve and abort
n = n + 1
if outOflogic then
return (has("smallkey",1) and dungeon_strong_eyes(n)) or empty_bailey(n) or Castle_spiral_climb(n)
end
-- print("castle_sansa")
return (has_small_keys(n) and dungeon_strong_eyes(n)) or empty_bailey(n) or Castle_spiral_climb(n)
--print("theatre_pillar")
return (empty_bailey(n)) or (Normal(n) and (Kickorplunge(2) or (cling(n) and Kickorplunge(1))) and castle_sansa(n)) or
(Hard(n) and (cling(n) or (Kickorplunge(1))) and castle_sansa(n)) or
((Expert(n) or Lunatic(n)) and (cling(n) or slide(n) or Kickorplunge(1)) and castle_sansa(n))
end

-- Library
function library_main(n)
if n == nil then; n = 0; end
if n > 10 then; return false; end -- detect 10th step when trying to resolve and abort
n = n + 1
-- print("library_main")
--print("library_main")
return (Normal(n) and (breaker(n) or (Knows_obscure(n) and can_attack(n))) and castle_sansa(n)) or
(Expert(n) and can_attack(n) and castle_sansa(n))
end

function keep_main(n)
if n == nil then; n = 0; end
if n > 10 then; return false; end -- detect 10th step when trying to resolve and abort
n = n + 1
-- print("keep_main")
return (cling(n) and theatre_main(n)) or castle_sansa(n)
end

function empty_bailey(n)
function library_locked(n)
if n == nil then; n = 0; end
if n > 10 then; return false; end -- detect 10th step when trying to resolve and abort
n = n + 1
-- print("empty_bailey")
return (sunsetter(n) or breaker(n)) and underbelly_main(n)
--print("library_locked")
return library_main(n) --and has_small_keys(n) --removed for yellow checks
end

function theatre_pillar(n)
-- Keep
function keep_main(n)
if n == nil then; n = 0; end
if n > 10 then; return false; end -- detect 10th step when trying to resolve and abort
n = n + 1
-- print("theatre_pillar")
return (empty_bailey(n)) or (Normal(n) and (Kickorplunge(2) or (cling(n) and Kickorplunge(1))) and castle_sansa(n)) or
(Hard(n) and (cling(n) or (Kickorplunge(1))) and castle_sansa(n)) or
((Expert(n) or Lunatic(n)) and (cling(n) or slide(n) or Kickorplunge(1)) and castle_sansa(n))
--print("keep_main")
return (cling(n) and theatre_main(n)) or castle_sansa(n)
end

function keep_sunsetter(n)
if n == nil then; n = 0; end
if n > 10 then; return false; end -- detect 10th step when trying to resolve and abort
n = n + 1
-- print("keep_sunsetter")
--print("keep_sunsetter")
return (cling(n) or has_small_keys(n) or greaves(n)) and keep_main(n)
end

function library_locked(n)
-- Bailey
function empty_bailey(n)
if n == nil then; n = 0; end
if n > 10 then; return false; end -- detect 10th step when trying to resolve and abort
n = n + 1
-- print("library_locked")
return library_main(n) --and has_small_keys() --removed for yellow checks
--print("empty_bailey")
return (sunsetter(n) or breaker(n)) and (breaker(n) or (sunsetter(n) and underbelly_hole(n))) -- reduced underbelly_main to `breaker(n) or (sunsetter(n) and (tower_remains(n) or underbelly_hole(n)))` and then removed the 'tower_remains' to help eliminate recurssions
--return (sunsetter(n) or breaker(n)) and underbelly_main(n)
end

function underbelly_hole(n)
-- Tower
function tower_remains(n)
if n == nil then; n = 0; end
if n > 10 then; return false; end -- detect 10th step when trying to resolve and abort
n = n + 1
-- print("underbelly_hole")
return Kickorplunge(1) and keep_main(n)
--print("tower_remains")
return (cling(n) or Getkicks(1) or (slide(n) and sunsetter(n))) and empty_bailey(n)
end

function tower_remains(n)
function the_great_door(n)
if n == nil then; n = 0; end
if n > 10 then; return false; end -- detect 10th step when trying to resolve and abort
n = n + 1
-- print("tower_remains")
return (cling(n) or Getkicks(1) or (slide(n) and sunsetter(n))) and empty_bailey(n)
--print("the_great_door")
return cling(n) and Getkicks(3) and tower_remains(n)
end

function the_great_door(n)
-- Castle
function castle_sansa(outOflogic, n)
if n == nil then; n = 0; end
if n > 10 then; return false; end -- detect 10th step when trying to resolve and abort
n = n + 1
-- print("the_great_door")
return cling(n) and Getkicks(3) and tower_remains(n)
if outOflogic then
return (has("smallkey",1) and dungeon_strong_eyes(n)) or empty_bailey(n) or Castle_spiral_climb(n)
end
--print("castle_sansa")
return (has_small_keys(n) and dungeon_strong_eyes(n)) or empty_bailey(n) or Castle_spiral_climb(n)
end

function Castle_spiral_climb(n)
if n == nil then; n = 0; end
if n > 10 then; return false; end -- detect 10th step when trying to resolve and abort
n = n + 1
return (Normal(n) and (Getkicks(2) or (cling(n) and sunsetter(n))) and castle_sansa(n)) or
--print("Castle_spiral_climb")
return (Normal(n) and (Getkicks(2) or (cling(n) and sunsetter(n))) and ((has_small_keys(n) and dungeon_strong_eyes(n)) or empty_bailey(n))) or -- reduced castle_sansa
(Normal(n) and (cling(n) or (Getkicks(4) and sunsetter(n))) and Scythe_corridor(n)) or
(Hard(n) and (cling(n) or Kickorplunge(2) or (can_slidejump(n) and sunsetter(n))) and castle_sansa(n)) or
((Hard(n) or Expert(n) or Lunatic(n)) and (cling(n) or (Getkicks(3))) and Scythe_corridor(n)) or
((Expert(n) or Lunatic(n)) and (cling(n) or slide(n) or Kickorplunge(2)) and castle_sansa(n))
(Hard(n) and (cling(n) or Kickorplunge(2) or (can_slidejump(n) and sunsetter(n))) and ((has_small_keys(n) and dungeon_strong_eyes(n)) or empty_bailey(n))) or -- reduced castle_sansa
(Hard(n) and (cling(n) or Getkicks(3)) and Scythe_corridor(n)) or
(Expert(n) and (cling(n) or slide(n) or Kickorplunge(2)) and ((has_small_keys(n) and dungeon_strong_eyes(n)) or empty_bailey(n))) -- reduced castle_sansa
end

function Castle_high_climb(n)
if n == nil then; n = 0; end
if n > 10 then; return false; end -- detect 10th step when trying to resolve and abort
n = n + 1
--print("Castle_high_climb")
return (Normal(n) and ((Getkicks(3) and sunsetter(n)) or (breaker(n) and Getkicks(1)) or (Knows_obscure(n) and sunsetter(n) and Getkicks(1))) and Castle_spiral_climb(n)) or
(Normal(n) and (cling(n) or Getkicks(4) or (Getkicks(2) and sunsetter(n)) or (Getkicks(1) and sunsetter(n) and can_slidejump(n))) and Scythe_corridor(n)) or
(Hard(n) and (cling(n) or Kickorplunge(3) or (breaker(n) and Getkicks(1)) or (Knows_obscure(n) and sunsetter(n) and Getkicks(1)) or (Knows_obscure(n) and can_attack(n) and can_slidejump(n))) and Castle_spiral_climb(n)) or
Expand All @@ -282,6 +311,7 @@ function Scythe_corridor(n)
if n == nil then; n = 0; end
if n > 10 then; return false; end -- detect 10th step when trying to resolve and abort
n = n + 1
--print("Scythe_corridor")
return (Normal(n) and cling(n) and Castle_spiral_climb(n)) or
(Normal(n) and (cling(n) or (can_slidejump(n) and Getkicks(1)) or Getkicks(4)) and Theatre_front(n)) or
(Expert(n) and (cling(n) or Kickorplunge(4)) and Castle_spiral_climb(n)) or
Expand All @@ -290,20 +320,40 @@ function Scythe_corridor(n)
(Lunatic(n) and (cling(n) or slide(n) or Getkicks(3)) and Theatre_front(n))
end

--function Theatre_front(n)
--if n == nil then; n = 0; end
--if n > 10 then; return false; end -- detect 10th step when trying to resolve and abort
--n = n + 1
--return (Normal(n) and cling(n) and Kickorplunge(2) and Scythe_corridor(n)) or
--(Hard(n) and cling(n) and Scythe_corridor(n)) or
--(Expert(n) and (cling(n) or (slide(n) and Getkicks(2))) and Scythe_corridor(n)) or
--(Lunatic(n) and (cling(n) or (slide(n) and Kickorplunge(2))) and Scythe_corridor(n))
--end

function Theatre_front(n)
if n == nil then; n = 0; end
if n > 10 then; return false; end -- detect 10th step when trying to resolve and abort
n = n + 1
return (Normal(n) and cling(n) and Kickorplunge(2) and Scythe_corridor(n)) or
(Hard(n) and cling(n) and Scythe_corridor(n)) or
(Expert(n) and (cling(n) or (slide(n) and Getkicks(2))) and Scythe_corridor(n)) or
(Lunatic(n) and (cling(n) or (slide(n) and Kickorplunge(2))) and Scythe_corridor(n))
--print("Theatre_front")
return (Normal(n) and cling(n) and Kickorplunge(2) and ((Normal(n) and cling(n) and Castle_spiral_climb(n)) or -- "reduced" Scythe_corridor to help with recurssions. see old code above
(Expert(n) and (cling(n) or Kickorplunge(4)) and Castle_spiral_climb(n)) or
(Lunatic(n) and (cling(n) or Getkicks(3)) and Castle_spiral_climb(n)))) or
(Hard(n) and cling(n) and ((Normal(n) and cling(n) and Castle_spiral_climb(n)) or -- "reduced" Scythe_corridor to help with recurssions. see old code above
(Expert(n) and (cling(n) or Kickorplunge(4)) and Castle_spiral_climb(n)) or
(Lunatic(n) and (cling(n) or Getkicks(3)) and Castle_spiral_climb(n)))) or
(Expert(n) and (cling(n) or (slide(n) and Getkicks(2))) and ((Normal(n) and cling(n) and Castle_spiral_climb(n)) or -- "reduced" Scythe_corridor to help with recurssions. see old code above
(Expert(n) and (cling(n) or Kickorplunge(4)) and Castle_spiral_climb(n)) or
(Lunatic(n) and (cling(n) or Getkicks(3)) and Castle_spiral_climb(n)))) or
(Lunatic(n) and (cling(n) or (slide(n) and Kickorplunge(2))) and ((Normal(n) and cling(n) and Castle_spiral_climb(n)) or -- "reduced" Scythe_corridor to help with recurssions. see old code above
(Expert(n) and (cling(n) or Kickorplunge(4)) and Castle_spiral_climb(n)) or
(Lunatic(n) and (cling(n) or Getkicks(3)) and Castle_spiral_climb(n))))
end

function Castle_moon_room(n)
if n == nil then; n = 0; end
if n > 10 then; return false; end -- detect 10th step when trying to resolve and abort
n = n + 1
--print("Castle_moon_room")
return (Normal(n) and (cling(n) or (can_slidejump(n) and Kickorplunge(2))) and Theatre_front(n)) or
(Hard(n) and (cling(n) or (can_slidejump(n) and Kickorplunge(2)) or Getkicks(4)) and Theatre_front(n)) or
(Expert(n) and (cling(n) or slide(n) or Getkicks(4)) and Theatre_front(n))
Expand Down

0 comments on commit 67e4c38

Please sign in to comment.