diff options
author | David Gay <david@davidgay.org> | 2021-05-24 17:37:18 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-05-24 17:37:18 -0400 |
commit | de43ddf481dfdaa57c3b0183fa7f8d7d94eb80a7 (patch) | |
tree | 325f83fab40610aff357be7fd24c73615aa5dd37 /app | |
parent | 1d55d62b2561a402c902b4c5a66076ab1c278548 (diff) |
Combat code fixes
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/game_controller.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/controllers/game_controller.rb b/app/controllers/game_controller.rb index cb9bbcb..152e856 100644 --- a/app/controllers/game_controller.rb +++ b/app/controllers/game_controller.rb @@ -30,6 +30,7 @@ class GameController < ApplicationController monster = Monster.find_by_gid(table_entry[:gid]) @results.push({ type: type, monster: monster }) resolve_combat_with(monster) + break end end when "item" @@ -130,7 +131,7 @@ class GameController < ApplicationController combat_message.call("#{actor.name} landed a critical hit!") dealt_damage = dealt_damage * 2 end - blocked_damage = (accuracy_roll >= (roll(20) + mon.block)) ? 0 : mon.block_value + blocked_damage = (accuracy_roll >= (roll(20) + target.block)) ? 0 : target.block_value resolved_damage = dealt_damage - blocked_damage actor == char ? mon_hp -= resolved_damage : char_hp -= resolved_damage combat_message.call("#{actor.name} hit for #{resolved_damage} (#{dealt_damage} - #{blocked_damage} blocked)") |