summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2021-06-07 20:16:13 -0400
committerDavid Gay <david@davidgay.org>2021-06-07 20:16:13 -0400
commit54473e0e8d2db24e4c1dd12aa309d610e62ed09d (patch)
tree83f19cb55593428cb96700782839f1f4819bfadc
parentabb1342915dcf879870dc0014d1c196b788f5da3 (diff)
Move equipment break check earlier in combat end code so it isn't skipped
-rw-r--r--CHANGELOG.md2
-rw-r--r--app/lib/activity_processor.rb12
2 files changed, 11 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c716630..89647d1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,8 @@ All notable changes to this project will be documented in this file.
- The following stats can now be negative: resistances, speed, accuracy, power, and evasion
- Combat stances now increase or decrease stats by a flat amount (instead of a percentage). The amount is
equal to your beastslay level divided by 5, rounded up.
+- Equipment break check now occurs immediately once a combatant has been reduced to zero HP or less. Previously
+ the break check could be skipped under certain conditons where the combat loop ended early.
### Monsters
- Stalk beast
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