Skip to content

Commit

Permalink
fix: Allow following specialized rune level plans
Browse files Browse the repository at this point in the history
With recent changes to stair exploration in a18a5b1, branch-specific
plans for navigating to the rune for Swamp were no longer properly
triggered. Instead the level exploration code was resetting stair
exploration, which made it hard for qw to make much progress, since it
had to travel up and try stairs before proceeding further into the cloud
generators. This commit has the exploration code not perform a reset if
we've autoexplored the rune level and found all upstairs, which will
allow the Swamp plans to take over until (hopefully) the rune is found.
  • Loading branch information
gammafunk committed Oct 5, 2022
1 parent 51d7d32 commit 93fa2d8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 4 additions & 0 deletions source/branches.lua
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ function in_hell_branch()
end

function branch_rune_depth(branch)
if not branch_rune(branch) then
return
end

if branch == "Abyss" then
return 3
else
Expand Down
12 changes: 9 additions & 3 deletions source/gameplans.lua
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ function explored_level(branch, depth)
return autoexplored_level(branch, depth)
and have_all_stairs(branch, depth, DIR.DOWN, FEAT_LOS.REACHABLE)
and have_all_stairs(branch, depth, DIR.UP, FEAT_LOS.REACHABLE)
and (depth < branch_rune_depth(branch) or have_branch_runes(branch))
and (have_branch_runes(branch) or depth < branch_rune_depth(branch))
end

function explored_level_range(range)
Expand Down Expand Up @@ -845,8 +845,14 @@ function finalize_exploration_depth(branch, depth)
if depth_up_finished then
if depth_down_finished then
if down_unreach then
level_stair_reset(branch, up_depth, DIR.DOWN)
level_stair_reset(branch, depth, DIR.UP)
-- We don't try stair resets if we're still looking for the
-- rune. This way we'll instead try branch-end-specific
-- plans for e.g. Swamp.
if have_branch_runes(branch)
or depth < branch_rune_depth(branch) then
level_stair_reset(branch, up_depth, DIR.DOWN)
level_stair_reset(branch, depth, DIR.UP)
end
return depth
end

Expand Down
1 change: 0 additions & 1 deletion source/variables.lua
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ local plan_explore
local plan_explore2
local plan_move


local plan_orbrun_rest
local plan_orbrun_emergency
local plan_orbrun_move

0 comments on commit 93fa2d8

Please sign in to comment.