From 54473e0e8d2db24e4c1dd12aa309d610e62ed09d Mon Sep 17 00:00:00 2001 From: David Gay Date: Mon, 7 Jun 2021 20:16:13 -0400 Subject: Move equipment break check earlier in combat end code so it isn't skipped --- app/lib/activity_processor.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/lib/activity_processor.rb b/app/lib/activity_processor.rb index bc0d058..72c7ddd 100644 --- a/app/lib/activity_processor.rb +++ b/app/lib/activity_processor.rb @@ -272,7 +272,10 @@ class ActivityProcessor elsif evasion_roll > accuracy_roll combat_message.call("#{target.name} evaded #{actor.name}'s attack.") end + if char_hp < 1 || mon_hp < 1 + break_check + if monster_spawn hp_lost = monster_spawn.remaining_hp - mon_hp if hp_lost > 0 @@ -310,11 +313,14 @@ class ActivityProcessor end end end - @character.do_equipment_break_checks.each do |broken_item| - @results.push({ type: "warning", message: "Your #{broken_item.name} was damaged beyond repair!" }) - end break end end end + + def break_check + @character.do_equipment_break_checks.each do |broken_item| + @results.push({ type: "warning", message: "Your #{broken_item.name} was damaged beyond repair!" }) + end + end end -- cgit v1.2.3