From 20b3ec993c5f34cc03de8374720f482ebfbf867f Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Tue, 5 Dec 2023 10:30:55 -0800 Subject: [PATCH] Update weapon.rb * Update to check key compatibility against an array instead of an int * Add convenience function to check if the weapon is part of a Draconic Weapon series --- app/models/weapon.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/weapon.rb b/app/models/weapon.rb index 8b330b1..321c5c4 100644 --- a/app/models/weapon.rb +++ b/app/models/weapon.rb @@ -48,11 +48,16 @@ class Weapon < ApplicationRecord end def compatible_with_key?(key) - key.series == series + key.series.include?(series) end # Returns whether the weapon is included in the Draconic or Dark Opus series def opus_or_draconic? [2, 3].include?(series) end + + # Returns whether the weapon belongs to the Draconic Weapon series or the Draconic Weapon Providence series + def draconic_or_providence? + [3, 34].include?(series) + end end