* add weapon_stat_modifiers table for ax skills and befoulments * add fk columns for ax modifiers and befoulments, replace has_ax_skills with augment_type * update models for weapon_stat_modifier fks and befoulments * update blueprints for weapon_stat_modifier serialization * update import service for weapon_stat_modifier fks and befoulments * add weapon_stat_modifiers controller and update params for fks * update tests and factories for weapon_stat_modifier fks * fix remaining has_ax_skills and ax_modifier references * add ax_modifier and befoulment_modifier to eager loading * fix ax modifier column naming and migration approach * add game_skill_ids for befoulment modifiers
31 lines
818 B
Ruby
31 lines
818 B
Ruby
# frozen_string_literal: true
|
|
|
|
##
|
|
# Reference table for weapon stat modifiers (AX skills and befoulments).
|
|
#
|
|
# AX skills are positive modifiers that can be applied to certain weapons.
|
|
# Befoulments are negative modifiers that appear on Odiant weapons.
|
|
#
|
|
class WeaponStatModifier < ApplicationRecord
|
|
CATEGORIES = %w[ax befoulment].freeze
|
|
|
|
validates :slug, presence: true, uniqueness: true
|
|
validates :name_en, presence: true
|
|
validates :category, presence: true, inclusion: { in: CATEGORIES }
|
|
validates :polarity, inclusion: { in: [-1, 1] }
|
|
|
|
scope :ax_skills, -> { where(category: 'ax') }
|
|
scope :befoulments, -> { where(category: 'befoulment') }
|
|
|
|
def self.find_by_game_skill_id(id)
|
|
find_by(game_skill_id: id.to_i)
|
|
end
|
|
|
|
def buff?
|
|
polarity == 1
|
|
end
|
|
|
|
def debuff?
|
|
polarity == -1
|
|
end
|
|
end
|