diff options
author | David Gay <david@davidgay.org> | 2021-06-07 20:16:13 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-06-07 20:16:13 -0400 |
commit | 54473e0e8d2db24e4c1dd12aa309d610e62ed09d (patch) | |
tree | 83f19cb55593428cb96700782839f1f4819bfadc /app/lib | |
parent | abb1342915dcf879870dc0014d1c196b788f5da3 (diff) |
Move equipment break check earlier in combat end code so it isn't skipped
Diffstat (limited to 'app/lib')
-rw-r--r-- | app/lib/activity_processor.rb | 12 |
1 files changed, 9 insertions, 3 deletions
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 |