Exclude certain values from remixing

This commit is contained in:
Justin Edmund 2023-01-09 00:05:18 -08:00
parent b6e8dd93b1
commit 79b9b4e225
3 changed files with 32 additions and 14 deletions

View file

@ -12,34 +12,46 @@ class GridCharacter < ApplicationRecord
validate :over_mastery_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
unless awakening.nil?
errors.add(:awakening, 'awakening level too low') if awakening["level"] < 1
errors.add(:awakening, 'awakening level too high') if awakening["level"] > 9
end
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
end
def transcendence
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 low') if transcendence_step < 0 && character.ulb
end
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
def over_mastery_hp
unless ring2["modifier"].nil?
errors.add(:ring2, 'invalid value') unless hp_values.include?(ring2["strength"])
end
return if ring2['modifier'].nil?
errors.add(:ring2, 'invalid value') unless hp_values.include?(ring2['strength'])
end
def over_mastery_attack_matches_hp
unless 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 ring1[:modifier].nil? && ring2[:modifier].nil?
return if ring2[:strength] == (ring1[:strength] / 2)
errors.add(:over_mastery,
'over mastery attack and hp values do not match')
end
def character

View file

@ -13,6 +13,14 @@ class GridWeapon < ApplicationRecord
validate :compatible_with_position, 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
def blueprint
GridWeaponBlueprint

View file

@ -60,8 +60,6 @@ class Party < ApplicationRecord
##### Amoeba configuration
amoeba do
enable
nullify :description
nullify :shortcode