summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/models/monster_spawn_combat.rb9
-rw-r--r--app/views/application/components/text/_title.html.erb2
2 files changed, 11 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(", "))
diff --git a/app/views/application/components/text/_title.html.erb b/app/views/application/components/text/_title.html.erb
index 2576ff8..a7c2a7e 100644
--- a/app/views/application/components/text/_title.html.erb
+++ b/app/views/application/components/text/_title.html.erb
@@ -8,6 +8,8 @@
<span class="text-gray-500">Retribut</span><span class="text-yellow-200">o</span><span class="text-gray-500">r</span>
<% when "aspirant" %>
<span class="text-purple-200">Aspirant</span>
+ <% when "sentinel" %>
+ <span class="text-gray-500">S</span><span class="text-gray-400">e</span><span class="text-gray-300">n</span><span class="text-gray-200">ti</span><span class="text-gray-300">n</span><span class="text-gray-400">e</span><span class="text-gray-500">l</span>
<% else %>
<%= title.name %>
<% end %>