summaryrefslogtreecommitdiff
path: root/app/models/concerns
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2021-07-07 21:46:13 -0400
committerDavid Gay <david@davidgay.org>2021-07-07 21:46:22 -0400
commit4850c9d042f85f54025ba528fe987f390c344dcc (patch)
tree15fa17c5ac02445f7248bd9041c82eca0b5ad66b /app/models/concerns
parent9c015e16340c80a35aad1cde299218c650f5ba35 (diff)
Give bollyrots and crypt writhes double the damage capacity at night
Diffstat (limited to 'app/models/concerns')
-rw-r--r--app/models/concerns/has_whatnot.rb12
1 files changed, 12 insertions, 0 deletions
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