diff options
author | David Gay <david@davidgay.org> | 2021-06-06 20:22:14 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-06-06 20:22:14 -0400 |
commit | 3446cb7656768b40dfd0afce9c8384676bf27135 (patch) | |
tree | d355b299de3afefdcc73f685176b3db5cb71137f /app/models | |
parent | a2af06fae8b70bfb24e805a8023124cf9371b8a6 (diff) |
Add and award Sentinel title, and add leviathan info to changelog
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/monster_spawn_combat.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/monster_spawn_combat.rb b/app/models/monster_spawn_combat.rb index 5b61bb5..08fe0f2 100644 --- a/app/models/monster_spawn_combat.rb +++ b/app/models/monster_spawn_combat.rb @@ -78,6 +78,15 @@ class MonsterSpawnCombat < ApplicationRecord end end + # TODO: HACK for title for now + character_damage = {} + involved_characters.each do |character| + 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!") + message_body_parts.each do |character_id, body_parts| if body_parts.any? Message.create(recipient_id: character_id, subject: "#{monster.name} slain", body: body_parts.join(", ")) |