From 25b01cb1df594d0b80adf719ef1cb5dbe9c62ab5 Mon Sep 17 00:00:00 2001 From: David Gay Date: Thu, 27 May 2021 17:27:30 -0400 Subject: Display activities in amenities even if requisite cost isn't met --- app/models/character.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'app/models') diff --git a/app/models/character.rb b/app/models/character.rb index c973d7d..9eb34cf 100644 --- a/app/models/character.rb +++ b/app/models/character.rb @@ -128,12 +128,14 @@ class Character < ApplicationRecord duration - (Time.now - self.activity_started_at) end - def can_do_activity?(activity) + def can_do_activity?(activity, ignore_cost: false) return false unless activity.innate? || self.learned_activities.exists?(activity: activity) - activity.whatnot[:cost]&.each do |cost| - case cost[:type] - when "item" - return false unless self.has_item?(cost[:gid], cost[:quantity]) + unless ignore_cost + activity.whatnot[:cost]&.each do |cost| + case cost[:type] + when "item" + return false unless self.has_item?(cost[:gid], cost[:quantity]) + end end end activity.whatnot[:requirements]&.each do |requirement| -- cgit v1.2.3