summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2021-06-03 09:23:59 -0400
committerDavid Gay <david@davidgay.org>2021-06-03 09:23:59 -0400
commitb9091779d24bbbcad0c6514a5fc04af860100894 (patch)
tree0078fb704e17f83753e9348d0bc7f1c4952bdb87
parent5c79a9376feab23366859a3bbf44cf393d39ad91 (diff)
Display amount of time until amenity on cooldown is usable again
-rw-r--r--CHANGELOG.md9
-rw-r--r--app/models/built_hearth_amenity.rb5
-rw-r--r--app/views/characters/hearth/index.html.erb8
3 files changed, 17 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 036d1c8..2e78146 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,15 +12,16 @@ All notable changes to this project will be documented in this file.
iron spade, arcanite spade
- New activities: construct loamspire level 1, construct loamspire level 2, craft iron spade, craft arcanite spade,
and all plant and harvest activities for the seeds and crops listed above
+- Stone spade can now be found while wildscouring crumbling ruins. Other drop chances have not changed, so the net
+ result is that you come up empty less.
+- Seeds can now be found while wealdreaping in Twil Woods and Twil Grove.
+- Listern fonts now display the amount of time until they're usable again.
+- A blank line is now added after combat results to make it easier to visually scan the logs.
### Changed
- Initiative rolls are now made with a d20 instead of a d10. Therefore, having a good speed stat is now more important.
Previously, once a combatant had a decent speed stat advantage, the roll was fairly easy to call. So this is a buff,
but also a nerf. A bnerf.
-- Stone spade can now be found while wildscouring crumbling ruins. Other drop chances have not changed, so the net
- result is that you come up empty less.
-- Seeds can now be found while wealdreaping in Twil Woods and Twil Grove.
-- A blank line is now added after combat results to make it easier to visually scan the logs.
### Fixed
- Arcanite short sword was named "iron short sword".
diff --git a/app/models/built_hearth_amenity.rb b/app/models/built_hearth_amenity.rb
index a1e35e8..02e2cd3 100644
--- a/app/models/built_hearth_amenity.rb
+++ b/app/models/built_hearth_amenity.rb
@@ -29,6 +29,11 @@ class BuiltHearthAmenity < ApplicationRecord
[0, seconds_until_cooled_down].max
end
+ def cooled_down_at
+ return nil unless seconds_until_cooled_down
+ Time.now + seconds_until_cooled_down.seconds
+ end
+
def effects
self.hearth_amenity.whatnot[:effects]&.reject { |e| e[:level] > self.level }
end
diff --git a/app/views/characters/hearth/index.html.erb b/app/views/characters/hearth/index.html.erb
index c063088..b8478f1 100644
--- a/app/views/characters/hearth/index.html.erb
+++ b/app/views/characters/hearth/index.html.erb
@@ -22,7 +22,13 @@
<% end %>
<% end %>
<% if built_amenity.usable? %>
- <%= button_to "Use", hearth_amenity_use_path(built_amenity.hearth_amenity) %>
+ <% if built_amenity.on_cooldown? %>
+ <div class="text-sm">Will be filled again in
+ <%= distance_of_time_in_words_to_now(built_amenity.cooled_down_at) %>.
+ </div>
+ <% else %>
+ <%= button_to "Use", hearth_amenity_use_path(built_amenity.hearth_amenity) %>
+ <% end %>
<% end %>
<% if built_amenity.hearth_amenity.gid == "loamspire" %>
<%= link_to "Manage crops", character_hearth_loamspire_path, class: "btn btn-primary" %>