summaryrefslogtreecommitdiff
path: root/app/models/monster_spawn_combat.rb
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2021-06-07 16:05:34 -0400
committerDavid Gay <david@davidgay.org>2021-06-07 16:05:34 -0400
commit7433ac3221f9d784b8797afc4c94df1846becbd1 (patch)
tree8b32bd51c0aa46a32eda92bd2f06e70cea7e7bba /app/models/monster_spawn_combat.rb
parentf4ab4f5af22c2cacb6aacee7954824f97735bdc7 (diff)
Don't say character earned the Sentinel title if they already had it
Diffstat (limited to 'app/models/monster_spawn_combat.rb')
-rw-r--r--app/models/monster_spawn_combat.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/models/monster_spawn_combat.rb b/app/models/monster_spawn_combat.rb
index 08fe0f2..8dbd8e8 100644
--- a/app/models/monster_spawn_combat.rb
+++ b/app/models/monster_spawn_combat.rb
@@ -84,8 +84,9 @@ class MonsterSpawnCombat < ApplicationRecord
character_damage[character] = MonsterSpawnCombat.where(monster_spawn: monster_spawn, character: character).sum(:hp_lost)
end
title_recipient = character_damage.max_by { |_, v| v }[0]
- title_recipient.award_title("sentinel")
- message_body_parts[title_recipient.id].push("You earned the Sentinel title!")
+ if title_recipient.award_title("sentinel")
+ message_body_parts[title_recipient.id].push("You earned the Sentinel title!")
+ end
message_body_parts.each do |character_id, body_parts|
if body_parts.any?