From b0200a6f5f2aa74d1ae4773007b2dd96d45e6cd9 Mon Sep 17 00:00:00 2001 From: desertkaz Date: Wed, 17 Jul 2024 21:29:30 -0700 Subject: [PATCH] check active_spells once per justice_message increment --- afk.lic | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/afk.lic b/afk.lic index f712b74a11..8da8341db3 100644 --- a/afk.lic +++ b/afk.lic @@ -41,6 +41,7 @@ register_slackbot(settings.slack_username) pause 1 while DRStats.health < [health_threshold + 20, 100].min || DRStats.spirit < [health_threshold + 20, 100].min justice_message_count = 0 +spell_check_count = 0 loop do line = script.gets? @@ -51,8 +52,9 @@ loop do justice_message_count += 1 if line =~ /^"Burn .+! Burn .+!" .* giving you a wide berth/ justice_message_count += 1 if line =~ /authorities will try to bring you in for endangering the public/ - if justice_message_count >= 1 - justice_message_count = 0 if DRSpells.active_spells.each { |x, _y| fput("release #{get_data("spells")["spell_data"][x]["abbrev"]} spell") if get_data("spells")["spell_data"][x]["triggers_justice"] } + if justice_message_count != spell_check_count + DRSpells.active_spells.each { |x, _y| fput("release #{get_data("spells")["spell_data"][x]["abbrev"]} spell") if get_data("spells")["spell_data"][x]["triggers_justice"] } + spell_check_count += 1 end if justice_message_count > justice_threshold exit_game("It looks like you've run into trouble with the law too many times")