Add migrations for skill tables

These tables allow us to store data about:
* Character and Weapon charge attacks
* Character active and support skills
* Weapon skills
* Summon calls
* Summon auras and subauras
This commit is contained in:
Justin Edmund 2025-03-02 16:24:24 -08:00
parent 3746ee9af6
commit 7b88932e2c
9 changed files with 166 additions and 0 deletions

View file

@ -0,0 +1,21 @@
class CreateEffects < ActiveRecord::Migration[8.0]
def change
create_table :effects, id: :uuid do |t|
t.string :name_en, null: false
t.string :name_jp
t.text :description_en
t.text :description_jp
t.string :icon_path
t.integer :effect_type, null: false # 1=buff, 2=debuff, 3=special
t.string :effect_class # classification (cant_act, burn, poison)
t.uuid :effect_family_id # no foreign key here
t.boolean :stackable, default: false
t.timestamps null: false
end
add_foreign_key :effects, :effects, column: :effect_family_id
add_index :effects, :effect_class
add_index :effects, :name_en
end
end

View file

@ -0,0 +1,17 @@
class CreateSkills < ActiveRecord::Migration[8.0]
def change
create_table :skills, id: :uuid do |t|
t.string :name_en, null: false
t.string :name_jp
t.text :description_en
t.text :description_jp
t.integer :border_type # 1=red(dmg), 2=green(heal), 3=yellow(buff), 4=blue(debuff), 5=purple(field)
t.integer :cooldown
t.integer :skill_type # 1=character, 2=weapon, 3=summon call, 4=charge attack
t.timestamps null: false
end
add_index :skills, :name_en
add_index :skills, :skill_type
end
end

View file

@ -0,0 +1,14 @@
class CreateSkillValues < ActiveRecord::Migration[8.0]
def change
create_table :skill_values, id: :uuid do |t|
t.references :skill, type: :uuid, null: false
t.integer :level, null: false, default: 1 # skill level or uncap level
t.decimal :value # numeric value for multiplier
t.string :text_value # text description for non-numeric values
t.timestamps null: false
end
add_foreign_key :skill_values, :skills
add_index :skill_values, %i[skill_id level], unique: true
end
end

View file

@ -0,0 +1,23 @@
class CreateSkillEffects < ActiveRecord::Migration[8.0]
def change
create_table :skill_effects, id: :uuid do |t|
t.references :skill, type: :uuid, null: false
t.references :effect, type: :uuid, null: false
t.integer :target_type # 1=self, 2=ally, 3=all allies, 4=enemy, 5=all enemies
t.integer :duration_type # 1=turns, 2=seconds, 3=indefinite, 4=one-time
t.integer :duration_value # number of turns/seconds if applicable
t.text :condition # condition text
t.integer :chance # percentage chance to apply
t.decimal :value # value for effect if applicable
t.decimal :cap # cap for effect if applicable
t.boolean :local, default: true # local vs global effect
t.boolean :permanent, default: false # permanent
t.boolean :undispellable, default: false # can't be dispelled
t.timestamps null: false
end
add_foreign_key :skill_effects, :skills, name: 'fk_skill_effects_skills'
add_foreign_key :skill_effects, :effects, name: 'fk_skill_effects_effects'
add_index :skill_effects, %i[skill_id effect_id target_type]
end
end

View file

@ -0,0 +1,19 @@
class CreateCharacterSkills < ActiveRecord::Migration[8.0]
def change
create_table :character_skills, id: :uuid do |t|
t.string :character_granblue_id, null: false
t.references :skill, type: :uuid, null: false
t.integer :position, null: false # 1, 2, 3, 4 for skill slots
t.integer :unlock_level # level when skill unlocked
t.integer :improve_level # level when skill improved (+)
t.references :alt_skill, type: :uuid
t.text :alt_condition # condition for alt version
t.timestamps null: false
end
add_foreign_key :character_skills, :skills
add_foreign_key :character_skills, :skills, column: :alt_skill_id
add_index :character_skills, %i[character_granblue_id position]
add_index :character_skills, :character_granblue_id
end
end

View file

@ -0,0 +1,19 @@
class CreateWeaponSkills < ActiveRecord::Migration[8.0]
def change
create_table :weapon_skills, id: :uuid do |t|
t.string :weapon_granblue_id, null: false
t.references :skill, type: :uuid, null: false
t.integer :position, null: false # 1, 2, 3 for skill slots
t.string :skill_modifier # Modifier like "Might", "Majesty"
t.string :skill_series # Series like "Ironflame", "Hoarfrost"
t.string :skill_size # Size like "Small", "Medium", "Big", "Massive"
t.integer :unlock_level # level when skill unlocked
t.timestamps null: false
end
add_foreign_key :weapon_skills, :skills
add_index :weapon_skills, %i[weapon_granblue_id position]
add_index :weapon_skills, :weapon_granblue_id
add_index :weapon_skills, :skill_series
end
end

View file

@ -0,0 +1,18 @@
class CreateSummonAuras < ActiveRecord::Migration[8.0]
def change
create_table :summon_auras, id: :uuid do |t|
t.string :summon_granblue_id, null: false
t.text :description_en
t.text :description_jp
t.integer :aura_type # 1=main, 2=sub
t.integer :boost_type # 1=weapon skill, 2=elemental, 3=stat
t.string :boost_target # what is being boosted
t.decimal :boost_value # percentage value
t.integer :uncap_level # 0, 3, 4, 5 for uncap level
t.text :condition # any conditions
t.timestamps null: false
end
add_index :summon_auras, %i[summon_granblue_id aura_type uncap_level]
add_index :summon_auras, :summon_granblue_id
end
end

View file

@ -0,0 +1,18 @@
class CreateSummonCalls < ActiveRecord::Migration[8.0]
def change
create_table :summon_calls, id: :uuid do |t|
t.string :summon_granblue_id, null: false
t.references :skill, type: :uuid, null: false
t.integer :cooldown
t.integer :uncap_level # 0, 3, 4, 5 for uncap level
t.references :alt_skill, type: :uuid
t.text :alt_condition # condition for alt version
t.timestamps null: false
end
add_foreign_key :summon_calls, :skills
add_foreign_key :summon_calls, :skills, column: :alt_skill_id
add_index :summon_calls, %i[summon_granblue_id uncap_level]
add_index :summon_calls, :summon_granblue_id
end
end

View file

@ -0,0 +1,17 @@
class CreateChargeAttacks < ActiveRecord::Migration[8.0]
def change
create_table :charge_attacks, id: :uuid do |t|
t.string :owner_id, null: false # can be character_granblue_id or weapon_granblue_id
t.string :owner_type, null: false # "character" or "weapon"
t.references :skill, type: :uuid, null: false
t.integer :uncap_level # 0, 3, 4, 5 for uncap level
t.references :alt_skill, type: :uuid
t.text :alt_condition # condition for alt version
t.timestamps null: false
end
add_foreign_key :charge_attacks, :skills
add_foreign_key :charge_attacks, :skills, column: :alt_skill_id
add_index :charge_attacks, %i[owner_type owner_id uncap_level]
end
end