From b43c0a475b29a26e0c425328ee28d8dcfc64bff6 Mon Sep 17 00:00:00 2001 From: David Gay Date: Wed, 14 Jul 2021 18:26:20 -0400 Subject: Prevent characters from starting or finishing an activity that might result in combat if the character is at max wounds --- app/lib/activity_processor.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app/lib') diff --git a/app/lib/activity_processor.rb b/app/lib/activity_processor.rb index b8456c8..e8ca82e 100644 --- a/app/lib/activity_processor.rb +++ b/app/lib/activity_processor.rb @@ -25,6 +25,8 @@ class ActivityProcessor return end + raise TooManyWoundsError if @character.activity.can_result_in_combat? && !@character.can_fight? + Character.transaction do if @character.rested_duration > 0 remaining_rested_duration = @character.rested_duration - @character.rested_duration_to_spend_on_activity @@ -191,7 +193,7 @@ class ActivityProcessor rescue TooManyWoundsError @character.stop_activity @results.replace([{ type: "error", - message: "You can't fight in your condition. You'll have to heal a wound." }]) + message: "In your condition, you can't do anything that might result in combat. You'll have to heal a wound first." }]) rescue MonsterSpawnError @character.stop_activity @results.replace([{ type: "error", -- cgit v1.2.3