summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2021-05-31 17:24:28 -0400
committerDavid Gay <david@davidgay.org>2021-05-31 17:24:28 -0400
commit1176500e444109d35e360022a847228d07a08a47 (patch)
tree51df36ccc9100a876ec03bd879203ea9cefa46a4
parent7113d69455d9600baa6d26796fb5b0d0ced1c939 (diff)
Change block so at least one point of damage will always get through
-rw-r--r--CHANGELOG.md2
-rw-r--r--app/controllers/game_controller.rb1
2 files changed, 3 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b7dc048..a77b61b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -28,10 +28,12 @@ All notable changes to this project will be documented in this file.
### Changed
- Beastslay activity names now start with "Slay in" instead of "Hunt".
+- A successful block can no longer reduce resolved damage to 0. A successful hit will always do at least 1 damage.
### Fixed
- Distill manadross tincture recipe awarded mending salve instead of manadross tincture.
- Equip requirements were ignored.
+- Characters could heal by blocking with a high enough block value
## [0.1.3.1] - 2021-05-31
diff --git a/app/controllers/game_controller.rb b/app/controllers/game_controller.rb
index f6bb7b8..d1d8bd6 100644
--- a/app/controllers/game_controller.rb
+++ b/app/controllers/game_controller.rb
@@ -219,6 +219,7 @@ class GameController < ApplicationController
dealt_damage = dealt_damage * 2
end
blocked_damage = (accuracy_roll >= (roll(20) + target.block(with_combat_style: true))) ? 0 : target.block_value
+ blocked_damage = [blocked_damage, (dealt_damage - 1)].min
resolved_damage = dealt_damage - blocked_damage
actor == char ? mon_hp -= resolved_damage : char_hp -= resolved_damage
damage_text = "#{resolved_damage} damage."