blob: c484242d7dea46c84ce484d227088d7a407deb0a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
class ItemInfix < ApplicationRecord
belongs_to :character
belongs_to :item
belongs_to :skill
before_create :check_max_infixes
def self.break_check
rand >= 0.99
end
def effects
self.item.whatnot[:infix_effects]
end
private
def check_max_infixes
current_infixes = character.item_infixes.where(skill: skill)
raise :abort if current_infixes.count >= character.max_infixes(skill)
end
end
|