From de43ddf481dfdaa57c3b0183fa7f8d7d94eb80a7 Mon Sep 17 00:00:00 2001 From: David Gay Date: Mon, 24 May 2021 17:37:18 -0400 Subject: Combat code fixes --- app/controllers/game_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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)") -- cgit v1.2.3