Skip to content

Commit

Permalink
check active_spells once per justice_message increment
Browse files Browse the repository at this point in the history
  • Loading branch information
desertkaz authored Jul 18, 2024
1 parent 5325e74 commit b0200a6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions afk.lic
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand All @@ -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")
Expand Down

0 comments on commit b0200a6

Please sign in to comment.