Exclude certain values from remixing
This commit is contained in:
parent
b6e8dd93b1
commit
79b9b4e225
3 changed files with 32 additions and 14 deletions
|
|
@ -12,34 +12,46 @@ class GridCharacter < ApplicationRecord
|
||||||
validate :over_mastery_hp, on: :update
|
validate :over_mastery_hp, on: :update
|
||||||
validate :over_mastery_attack_matches_hp, on: :update
|
validate :over_mastery_attack_matches_hp, on: :update
|
||||||
|
|
||||||
|
##### Amoeba configuration
|
||||||
|
amoeba do
|
||||||
|
nullify :ring1
|
||||||
|
nullify :ring2
|
||||||
|
nullify :ring3
|
||||||
|
nullify :ring4
|
||||||
|
nullify :earring
|
||||||
|
nullify :perpetuity
|
||||||
|
end
|
||||||
|
|
||||||
def awakening_level
|
def awakening_level
|
||||||
unless awakening.nil?
|
return if awakening.nil?
|
||||||
errors.add(:awakening, 'awakening level too low') if awakening["level"] < 1
|
|
||||||
errors.add(:awakening, 'awakening level too high') if awakening["level"] > 9
|
errors.add(:awakening, 'awakening level too low') if awakening['level'] < 1
|
||||||
end
|
errors.add(:awakening, 'awakening level too high') if awakening['level'] > 9
|
||||||
end
|
end
|
||||||
|
|
||||||
def transcendence
|
def transcendence
|
||||||
errors.add(:transcendence_step, 'character has no transcendence') if transcendence_step > 0 && !character.ulb
|
errors.add(:transcendence_step, 'character has no transcendence') if transcendence_step > 0 && !character.ulb
|
||||||
errors.add(:transcendence_step, 'transcendence step too high') if transcendence_step > 5 && character.ulb
|
errors.add(:transcendence_step, 'transcendence step too high') if transcendence_step > 5 && character.ulb
|
||||||
errors.add(:transcendence_step, 'transcendence step too low') if transcendence_step < 0 && character.ulb
|
errors.add(:transcendence_step, 'transcendence step too low') if transcendence_step < 0 && character.ulb
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def over_mastery_attack
|
def over_mastery_attack
|
||||||
errors.add(:ring1, 'invalid value') unless ring1["modifier"].nil? || atk_values.include?(ring1["strength"])
|
errors.add(:ring1, 'invalid value') unless ring1['modifier'].nil? || atk_values.include?(ring1['strength'])
|
||||||
end
|
end
|
||||||
|
|
||||||
def over_mastery_hp
|
def over_mastery_hp
|
||||||
unless ring2["modifier"].nil?
|
return if ring2['modifier'].nil?
|
||||||
errors.add(:ring2, 'invalid value') unless hp_values.include?(ring2["strength"])
|
|
||||||
end
|
errors.add(:ring2, 'invalid value') unless hp_values.include?(ring2['strength'])
|
||||||
end
|
end
|
||||||
|
|
||||||
def over_mastery_attack_matches_hp
|
def over_mastery_attack_matches_hp
|
||||||
unless ring1[:modifier].nil? && ring2[:modifier].nil?
|
return if ring1[:modifier].nil? && ring2[:modifier].nil?
|
||||||
errors.add(:over_mastery, 'over mastery attack and hp values do not match') unless ring2[:strength] == (ring1[:strength] / 2)
|
|
||||||
end
|
return if ring2[:strength] == (ring1[:strength] / 2)
|
||||||
|
|
||||||
|
errors.add(:over_mastery,
|
||||||
|
'over mastery attack and hp values do not match')
|
||||||
end
|
end
|
||||||
|
|
||||||
def character
|
def character
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,14 @@ class GridWeapon < ApplicationRecord
|
||||||
validate :compatible_with_position, on: :create
|
validate :compatible_with_position, on: :create
|
||||||
validate :no_conflicts, on: :create
|
validate :no_conflicts, on: :create
|
||||||
|
|
||||||
|
##### Amoeba configuration
|
||||||
|
amoeba do
|
||||||
|
nullify :ax_modifier1
|
||||||
|
nullify :ax_modifier2
|
||||||
|
nullify :ax_strength1
|
||||||
|
nullify :ax_strength2
|
||||||
|
end
|
||||||
|
|
||||||
# Helper methods
|
# Helper methods
|
||||||
def blueprint
|
def blueprint
|
||||||
GridWeaponBlueprint
|
GridWeaponBlueprint
|
||||||
|
|
|
||||||
|
|
@ -60,8 +60,6 @@ class Party < ApplicationRecord
|
||||||
|
|
||||||
##### Amoeba configuration
|
##### Amoeba configuration
|
||||||
amoeba do
|
amoeba do
|
||||||
enable
|
|
||||||
|
|
||||||
nullify :description
|
nullify :description
|
||||||
nullify :shortcode
|
nullify :shortcode
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue