diff options
author | David Gay <david@davidgay.org> | 2021-07-14 18:26:20 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-07-14 18:26:35 -0400 |
commit | b43c0a475b29a26e0c425328ee28d8dcfc64bff6 (patch) | |
tree | 2d79d1251b13f2b89f979960bffa6966b4d55028 /app/lib | |
parent | b4f643b1ce4613dcd18e71a6f31a84293ac10857 (diff) |
Prevent characters from starting or finishing an activity that might result in combat if the character is at max wounds
Diffstat (limited to 'app/lib')
-rw-r--r-- | app/lib/activity_processor.rb | 4 |
1 files changed, 3 insertions, 1 deletions
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", |