Skip to content

Commit

Permalink
Merge pull request #6761 from MahtraDR/stack_scrolls_turn
Browse files Browse the repository at this point in the history
[scripts][stack-scrolls] Add new turn syntax, and keep_scrolls
  • Loading branch information
MahtraDR authored Feb 16, 2024
2 parents 909f345 + d645ffa commit 5180022
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions stack-scrolls.lic
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class ScrollStack
settings = get_settings
scroll_stackers = settings.scroll_stackers
@discard_scrolls = settings.discard_scrolls
@keep_scrolls = settings.keep_scrolls
stacker_container = settings.stacker_container
@worn_trashcan = settings.worn_trashcan
@worn_trashcan_verb = settings.worn_trashcan_verb
Expand Down Expand Up @@ -82,9 +83,7 @@ class ScrollStack

slot = target['contents'].find_index { |data| data.first =~ /#{query}/i }

slot.times do
DRC.bput("turn my #{target['name']}", 'You turn to a new')
end
DRC.bput("turn #{DRC.get_noun(target['name'])} to #{query}", /^You turn/)

case DRC.bput("pull my #{target['name']}", 'This was the last copy', 'Carefully')
when /This was the last/i
Expand Down Expand Up @@ -166,7 +165,9 @@ class ScrollStack
end
waitrt?

if @discard_scrolls.find { |discard| spell_name == discard }
if @discard_scrolls.find { |discard| spell_name == discard } || !@keep_scrolls.any?(/#{spell_name}/i)
DRC.message("Scroll in discards, or not in keep list.")
DRC.message("Scroll is #{spell_name}")
DRCI.dispose_trash(scroll, @worn_trashcan, @worn_trashcan_verb)
elsif (target = UserVars.stackers.find { |stacker| stacker['contents'].find { |data| data.first == spell_name } })
stack_existing_scroll(target, scroll, spell_name, stacker_container)
Expand Down

0 comments on commit 5180022

Please sign in to comment.