From 4850c9d042f85f54025ba528fe987f390c344dcc Mon Sep 17 00:00:00 2001 From: David Gay Date: Wed, 7 Jul 2021 21:46:13 -0400 Subject: Give bollyrots and crypt writhes double the damage capacity at night --- app/models/concerns/has_whatnot.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'app/models/concerns') diff --git a/app/models/concerns/has_whatnot.rb b/app/models/concerns/has_whatnot.rb index 22322c0..987c969 100644 --- a/app/models/concerns/has_whatnot.rb +++ b/app/models/concerns/has_whatnot.rb @@ -18,5 +18,17 @@ module HasWhatnot def where_has_tag(tag) where("whatnot->'tags' ? :tag", tag: tag) end + + def conditions_met?(data) + data[:conditions]&.each do |conditions_data| + case conditions_data[:type] + when "time_of_day" + return false unless conditions_data[:times].include? World.time_of_day.to_s + else + raise "Invalid condition type GID (#{conditions_data[:type]})" + end + end + true + end end end -- cgit v1.2.3