diff options
-rw-r--r-- | CHANGELOG.md | 10 | ||||
-rw-r--r-- | app/models/monster_kill.rb | 15 | ||||
-rw-r--r-- | app/views/application/components/text/_title.html.erb | 14 | ||||
-rw-r--r-- | data/titles.yml | 14 |
4 files changed, 53 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 22ebaf8..e584534 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,16 @@ All notable changes to this project will be documented in this file. ### Hearth - New amenity: binding array (level 1, level 2) +### Titles +- 7 new titles + - Slayer: Kill 1,000 monsters + - Butcher: Kill 10,000 monsters + - Slaughterer: Kill 100,000 monsters + - Massacrer: Kill 1,000,000 monsters + - Spiteful: Kill 1,000 of one particular monster + - Hateful: Kill 10,000 of one particular monster + - Vicious: Kill 100,000 of one particular monster + ### UI - Character skills were moved from the Character view to their own view, which features a new interface with XP bars. diff --git a/app/models/monster_kill.rb b/app/models/monster_kill.rb index 4096e8e..24519b1 100644 --- a/app/models/monster_kill.rb +++ b/app/models/monster_kill.rb @@ -4,4 +4,19 @@ class MonsterKill < ApplicationRecord validates :quantity, numericality: { greater_than_or_equal_to: 0, only_integer: true } scope :ordered_by_monster_name, -> { includes(:monster).order("monsters.name") } + + after_save :award_titles + + private + def award_titles + character.award_title("spiteful") if quantity >= 1000 + character.award_title("hateful") if quantity >= 10_000 + character.award_title("vicious") if quantity >= 100_000 + + all_kills_quantity = character.monster_kills.sum(:quantity) + character.award_title("slayer") if all_kills_quantity >= 1_000 + character.award_title("butcher") if all_kills_quantity >= 10_000 + character.award_title("slaughterer") if all_kills_quantity >= 100_000 + character.award_title("massacrer") if all_kills_quantity >= 1_000_000 + end end diff --git a/app/views/application/components/text/_title.html.erb b/app/views/application/components/text/_title.html.erb index a7c2a7e..5e1d5a2 100644 --- a/app/views/application/components/text/_title.html.erb +++ b/app/views/application/components/text/_title.html.erb @@ -10,6 +10,20 @@ <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> + <% when "spiteful" %> + <span class="text-transparent bg-clip-text bg-gradient-to-b from-gray-500 to-red-900">Spiteful</span> + <% when "hateful" %> + <span class="text-transparent bg-clip-text bg-gradient-to-b from-gray-600 to-red-800">Hateful</span> + <% when "vicious" %> + <span class="text-transparent bg-clip-text bg-gradient-to-b from-gray-700 to-red-700">Vicious</span> + <% when "slayer" %> + <span class="text-red-400">Slayer</span> + <% when "butcher" %> + <span class="text-red-500">Butcher</span> + <% when "slaughterer" %> + <span class="text-red-600">Slaughterer</span> + <% when "massacrer" %> + <span class="text-red-700">Massacrer</span> <% else %> <%= title.name %> <% end %> diff --git a/data/titles.yml b/data/titles.yml index a8c228a..23ff009 100644 --- a/data/titles.yml +++ b/data/titles.yml @@ -8,3 +8,17 @@ aspirant: name: "Aspirant" sentinel: name: "Sentinel" +spiteful: + name: "Spiteful" +hateful: + name: "Hateful" +vicious: + name: "Vicious" +slayer: + name: "Slayer" +butcher: + name: "Butcher" +slaughterer: + name: "Slaughterer" +massacrer: + name: "Massacrer" |