From d57d41a5105cd52a223267404f1ec81f8ec447fd Mon Sep 17 00:00:00 2001 From: vtcifer Date: Tue, 10 Sep 2024 15:47:39 -0400 Subject: [PATCH] Tweak EV healing to wait longer and catch if the plant withers before you finish Also enable tome/performance while waiting for plant to heal you --- safe-room.lic | 59 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 17 deletions(-) diff --git a/safe-room.lic b/safe-room.lic index 0d71084206..90f50219bf 100644 --- a/safe-room.lic +++ b/safe-room.lic @@ -285,33 +285,58 @@ class SafeRoom return false unless empath['name'] DRCT.walk_to empath['id'] - return false unless DRRoom.pcs.include?(empath['name']) || DRRoom.room_objs.grep(@plant_regex).size > 0 - - unless DRRoom.pcs.include?(empath) - if /.*vela.tohr (\w+)/ =~ DRRoom.room_objs.grep(@plant_regex).to_s + + if !DRRoom.pcs.include?(empath) && /.*vela.tohr (\w+)/ =~ DRRoom.room_objs.grep(@plant_regex).to_s + Flags.add('doneheal',/You sense that this particular .* has healed all that it can.$/,/^The last of your wounds knit shut/) + while /.*vela.tohr (\w+)/ =~ DRRoom.room_objs.grep(@plant_regex).to_s fput("touch #{Regexp.last_match(1)}") - end - end - if DRRoom.pcs.include?(empath['name']) + if @performance_while_healing && !(Script.running?('performance') || Script.running?('play')) + start_script('performance', ['noclean']) + @stop_performance_after_heal = true + end + if @tome_while_healing && !Script.running?('tome') + start_script('tome', ['active']) + @stop_tome_after_heal = true + end + + 120.times do + pause 5 + break if Flags['doneheal'] + end + + if !Flags['doneheal'] || Flags['doneheal'].to_s =~ /You sense that this particular .* has healed all that it can.$/ + Flags.reset('doneheal') + next + end + + stop_script('performance') if Script.running?('performance') && @stop_performance_after_heal + stop_script('tome') if Script.running?('tome') && @stop_tome_after_heal + + Flags.delete('doneheal') + return !need_healing? + end + elsif DRRoom.pcs.include?(empath['name']) if empath['start_heal_action'] fput(empath['start_heal_action']) else fput("whisper #{empath['name']} heal") end fput("listen to #{empath['name']}") - end - if empath['done_healing_matches'] && empath['done_healing_matches'].is_a?(Array) - Flags.add('doneheal', *empath['done_healing_matches'], /^The last of your wounds knit shut/) - else - Flags.add('doneheal', '"Done!"', 'All set', 'not even injured', 'in good enough shape', 'All better', /^The last of your wounds knit shut/) - end - 24.times do - pause 5 - break if Flags['doneheal'] + if empath['done_healing_matches'] && empath['done_healing_matches'].is_a?(Array) + Flags.add('doneheal',*empath['done_healing_matches']) + else + Flags.add('doneheal', '"Done!"', 'All set', 'not even injured', 'in good enough shape', 'All better') + end + 24.times do + pause 5 + break if Flags['doneheal'] + end + Flags.delete('doneheal') + else + return false end - Flags.delete('doneheal') !need_healing? end