From 3446cb7656768b40dfd0afce9c8384676bf27135 Mon Sep 17 00:00:00 2001 From: David Gay Date: Sun, 6 Jun 2021 20:22:14 -0400 Subject: Add and award Sentinel title, and add leviathan info to changelog --- CHANGELOG.md | 9 +++++++++ app/models/monster_spawn_combat.rb | 9 +++++++++ app/views/application/components/text/_title.html.erb | 2 ++ data/titles.yml | 2 ++ 4 files changed, 22 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 192aabb..39f3624 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,9 +8,18 @@ All notable changes to this project will be documented in this file. messages from other sources... - A "new messages" indicator will be added in the future. For now, you'll have to go to the Messages view to see if you have any messages. +- Leviathans have been added. These intraplanar creatures appear in a location and can be attacked by any character. + Damage dealt to a leviathan persists even if you lose the combat. Once the leviathan has been reduced to 0 HP, it + is slain. Every character who dealt damage to the leviathan is awarded XP for each encounter they had with the + leviathan in which they damaged it. These characters are also eligible for loot, and are awarded it randomly from + the pool of items that are dropped by the leviathan. Whoever dealt the most damage to the leviathan earns a new + title. - Implemented monitoring (error tracking, uptime, server health, etc.) via Honeybadger. This means the server will automatically send errors to me, with context, for analysis. Please continue to report bugs in Discord, it will be useful to corroborate with Honeybadger. + +### Titles +- New title: Sentinel, awarded upon the slaying of a leviathan to the character who dealt the most damage to it. ### Skills - Otherforge 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 @@ Retributor <% when "aspirant" %> Aspirant + <% when "sentinel" %> + Sentinel <% else %> <%= title.name %> <% end %> diff --git a/data/titles.yml b/data/titles.yml index a45206e..a8c228a 100644 --- a/data/titles.yml +++ b/data/titles.yml @@ -6,3 +6,5 @@ retributor: name: "Retributor" aspirant: name: "Aspirant" +sentinel: + name: "Sentinel" -- cgit v1.2.3