Updates for weapon series
- Change to new series numbers - Add static method for querying whether the weapon's element is changeable - Add a new method to return a text slug for the weapon's series
This commit is contained in:
parent
d8eee21f99
commit
15729ec7a8
6 changed files with 5798 additions and 2 deletions
|
|
@ -37,6 +37,54 @@ class Weapon < ApplicationRecord
|
|||
has_many :weapon_awakenings
|
||||
has_many :awakenings, through: :weapon_awakenings
|
||||
|
||||
SERIES_SLUGS = {
|
||||
1 => 'seraphic',
|
||||
2 => 'grand',
|
||||
3 => 'dark-opus',
|
||||
4 => 'revenant',
|
||||
5 => 'primal',
|
||||
6 => 'beast',
|
||||
7 => 'regalia',
|
||||
8 => 'omega',
|
||||
9 => 'olden-primal',
|
||||
10 => 'hollowsky',
|
||||
11 => 'xeno',
|
||||
12 => 'rose',
|
||||
13 => 'ultima',
|
||||
14 => 'bahamut',
|
||||
15 => 'epic',
|
||||
16 => 'cosmos',
|
||||
17 => 'superlative',
|
||||
18 => 'vintage',
|
||||
19 => 'class-champion',
|
||||
20 => 'replica',
|
||||
21 => 'relic',
|
||||
22 => 'rusted',
|
||||
23 => 'sephira',
|
||||
24 => 'vyrmament',
|
||||
25 => 'upgrader',
|
||||
26 => 'astral',
|
||||
27 => 'draconic',
|
||||
28 => 'eternal-splendor',
|
||||
29 => 'ancestral',
|
||||
30 => 'new-world-foundation',
|
||||
31 => 'ennead',
|
||||
32 => 'militis',
|
||||
33 => 'malice',
|
||||
34 => 'menace',
|
||||
35 => 'illustrious',
|
||||
36 => 'proven',
|
||||
37 => 'revans',
|
||||
38 => 'world',
|
||||
39 => 'exo',
|
||||
40 => 'draconic-providence',
|
||||
41 => 'celestial',
|
||||
42 => 'omega-rebirth',
|
||||
43 => 'collab',
|
||||
98 => 'event',
|
||||
99 => 'gacha'
|
||||
}.freeze
|
||||
|
||||
def blueprint
|
||||
WeaponBlueprint
|
||||
end
|
||||
|
|
@ -51,11 +99,23 @@ class Weapon < ApplicationRecord
|
|||
|
||||
# Returns whether the weapon is included in the Draconic or Dark Opus series
|
||||
def opus_or_draconic?
|
||||
[2, 3].include?(series)
|
||||
[3, 27].include?(series)
|
||||
end
|
||||
|
||||
# Returns whether the weapon belongs to the Draconic Weapon series or the Draconic Weapon Providence series
|
||||
def draconic_or_providence?
|
||||
[3, 34].include?(series)
|
||||
[27, 40].include?(series)
|
||||
end
|
||||
|
||||
def self.element_changeable?(series)
|
||||
[4, 13, 17, 19].include?(series.to_i)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def series_slug
|
||||
# Assuming series is an array, take the first value
|
||||
series_number = series.first
|
||||
SERIES_SLUGS[series_number]
|
||||
end
|
||||
end
|
||||
|
|
|
|||
14
db/seed/test/weapon_awakenings_test.csv
Normal file
14
db/seed/test/weapon_awakenings_test.csv
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
"id","weapon_id","awakening_id"
|
||||
"3f8be70e-db9f-41c0-91a7-b07cca9ed263","706438c4-a5eb-4f7c-a145-0c2a3e7e6fbe","18ab5007-3fcb-4f83-a7a0-879a9a4a7ad7"
|
||||
"59af97e7-8828-432e-9ff7-b2c792d08d70","ba7af3b3-c62f-4f85-a420-0321c776ba00","275c9de5-db1e-4c66-8210-660505fd1af4"
|
||||
"97c4b396-597f-4622-9f6d-ee9536a6629b","ba7af3b3-c62f-4f85-a420-0321c776ba00","d691a61c-dc7e-4d92-a8e6-98c04608353c"
|
||||
"b6b911bb-ee89-435f-b325-9df53a1ce6ea","ba7af3b3-c62f-4f85-a420-0321c776ba00","969d37db-5f14-4d1a-bef4-59ba5a016674"
|
||||
"1dbff135-b401-4619-973d-740f4504ee3a","a2f0db22-baf1-4640-8c2e-6d283375744f","d691a61c-dc7e-4d92-a8e6-98c04608353c"
|
||||
"d48fd874-484d-41c5-bff0-709cb714f7b0","a2f0db22-baf1-4640-8c2e-6d283375744f","275c9de5-db1e-4c66-8210-660505fd1af4"
|
||||
"e793cc76-025d-4b6d-975a-58c56ff19141","47208685-e87a-4e07-b328-fb9ac3888718","d691a61c-dc7e-4d92-a8e6-98c04608353c"
|
||||
"42ba1467-971e-40bd-b701-07538678cc95","e7a05d2e-a3ec-4620-98a5-d8472d474971","d691a61c-dc7e-4d92-a8e6-98c04608353c"
|
||||
"6e94080f-1bbf-4171-8d77-40328c1daf1f","e7a05d2e-a3ec-4620-98a5-d8472d474971","969d37db-5f14-4d1a-bef4-59ba5a016674"
|
||||
"714e3575-d536-4a77-870b-b5e2d8b31b68","e7a05d2e-a3ec-4620-98a5-d8472d474971","275c9de5-db1e-4c66-8210-660505fd1af4"
|
||||
"5daffb43-f456-41db-8e04-dadc42bea788","8137294e-6bf1-4bac-a1e0-38cdc542622b","d691a61c-dc7e-4d92-a8e6-98c04608353c"
|
||||
"ab83344b-b4ee-4aad-8e9b-1b7a8169575b","8137294e-6bf1-4bac-a1e0-38cdc542622b","275c9de5-db1e-4c66-8210-660505fd1af4"
|
||||
"e26dbd37-b4d1-49f2-a5f2-36525a57b998","8137294e-6bf1-4bac-a1e0-38cdc542622b","969d37db-5f14-4d1a-bef4-59ba5a016674"
|
||||
|
47
db/seed/test/weapon_keys_test.csv
Normal file
47
db/seed/test/weapon_keys_test.csv
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
"id","name_en","name_jp","slot","group","order","slug","granblue_id","series"
|
||||
"02b40c48-b0d4-4df6-a27f-da2bc58fdd0f","Pendulum of Strife","闘争のペンデュラム",1,0,2,"pendulum-strife",14003,"{3}"
|
||||
"0946e421-db65-403b-946f-5e2285e963f5","Pendulum of Sagacity","窮理のペンデュラム",1,2,2,"pendulum-sagacity",14006,"{3}"
|
||||
"14534be3-defa-44cd-9096-09bae07565c8","Chain of Temperament","技錬のチェイン",1,1,0,"chain-temperament",14011,"{3}"
|
||||
"1e2a1e5b-75f4-4e00-85d5-e5ef474dd6d7","Chain of Depravity","邪罪のチェイン",1,1,5,"chain-depravity",14016,"{3}"
|
||||
"3faafaf1-5fc5-4aa8-8c65-894bbe1c615f","α Pendulum","アルファ・ペンデュラム",0,0,0,"pendulum-alpha",13001,"{3}"
|
||||
"562c89bd-68cf-4a33-8609-d82e017130d6","Chain of Restoration","賦活のチェイン",1,1,1,"chain-restoration",14012,"{3}"
|
||||
"5936e870-61a1-40a4-8c52-b85b9ab96967","Pendulum of Prosperity","隆盛のペンデュラム",1,0,3,"pendulum-prosperity",14004,"{3}"
|
||||
"653477b7-5321-4ea4-8b6f-42218e67a090","Pendulum of Zeal","激情のペンデュラム",1,0,1,"pendulum-zeal",14002,"{3}"
|
||||
"6ded911e-81d6-4fae-a3e7-682a5d18f2fc","Chain of Glorification","謳歌のチェイン",1,1,2,"chain-glorification",14013,"{3}"
|
||||
"b3d8d4d8-8bf6-4e03-9f21-547653bf7574","Pendulum of Strength","強壮のペンデュラム",1,0,0,"pendulum-strength",14001,"{3}"
|
||||
"c7a65d1f-c6a5-4c12-a90e-f3a31dc9d8f9","Pendulum of Extremity","絶涯のペンデュラム",1,2,1,"pendulum-extremity",14005,"{3}"
|
||||
"d5b81056-fd58-45b6-b6ef-a43b45a15194","Chain of Temptation","誘惑のチェイン",1,1,3,"chain-temptation",14014,"{3}"
|
||||
"d5ed9765-263e-4e28-b46a-a1f6bf8c6615","Pendulum of Supremacy","天髄のペンデュラム",1,2,3,"pendulum-supremacy",14007,"{3}"
|
||||
"e719de37-500e-44cd-98a4-2d9af71e0809","Δ Pendulum","デルタ・ペンデュラム",0,0,4,"pendulum-delta",13004,"{3}"
|
||||
"ebe424a0-7370-4b07-bd37-7eeee9b8425c","Chain of Falsehood","虚詐のチェイン",1,1,6,"chain-falsehood",14017,"{3}"
|
||||
"ed19dcef-8579-4125-8607-5a43922d0999","β Pendulum","ベータ・ペンデュラム",0,0,1,"pendulum-beta",13002,"{3}"
|
||||
"f5d711d8-f2f8-4909-9a64-ce6dc3584e03","γ Pendulum","ガンマ・ペンデュラム",0,0,2,"pendulum-gamma",13003,"{3}"
|
||||
"f81ec8e8-acc8-4ad3-8460-b628e90cd29d","Chain of Forbiddance","禁忌のチェイン",1,1,4,"chain-forbiddance",14015,"{3}"
|
||||
"0b696acb-baf4-4ad8-9caa-4255b338b13b","Gauph Key of Vitality","ガフスキー【生命】",0,3,2,"gauph-vitality",10003,"{13}"
|
||||
"148e3323-395f-417c-b18a-96fd9421cfe6","Gauph Key of Strife","ガフスキー【闘争】",0,3,1,"gauph-strife",10002,"{13}"
|
||||
"2ebe966e-0339-4464-acb9-0db138c3e2e7","Gauph Key of Will","ガフスキー【戦意】",0,3,0,"gauph-will",10001,"{13}"
|
||||
"3ca1a71c-66bf-464a-8ad2-254c52169e8e","Gauph Key γ","ガフスキー【γ】",1,3,2,"gauph-gamma",11003,"{13}"
|
||||
"3d5d610a-3734-444d-8818-fce2024a190b","Gauph Key Tria","ガフスキー【トリア】",2,3,2,"gauph-tria",17003,"{13}"
|
||||
"4d6fefb6-09e6-4c92-98b0-a48b35ddd738","Gauph Key β","ガフスキー【β】",1,3,1,"gauph-beta",11002,"{13}"
|
||||
"606632e3-3391-4223-8147-07060fe6f2e4","Gauph Key of Courage","ガフスキー【勇気】",0,3,5,"gauph-courage",10006,"{13}"
|
||||
"6d03b9c2-08d8-49ea-8522-5507e9243ccc","Gauph Key α","ガフスキー【α】",1,3,0,"gauph-alpha",11001,"{13}"
|
||||
"98a358bc-d123-40c9-8c0e-7953467c9a27","Gauph Key Δ","ガフスキー【Δ】",1,3,3,"gauph-delta",11004,"{13}"
|
||||
"a1613dcd-dcc1-4290-95e7-3f9dfc28dd06","Gauph Key Tessera","ガフスキー【テーセラ】",2,3,3,"gauph-tessera",17004,"{13}"
|
||||
"abd48244-8398-4159-ada6-9062803189f1","Gauph Key of Strength","ガフスキー【強壮】",0,3,3,"gauph-strength",10004,"{13}"
|
||||
"cdd87f62-2d29-4698-b09d-8eef3f7b4406","Gauph Key Ena","ガフスキー【エナ】",2,3,0,"gauph-ena",17001,"{13}"
|
||||
"d0dd2b46-cb55-4c2f-beb6-e2ee380bdb5e","Gauph Key Dio","ガフスキー【ディオ】",2,3,1,"gauph-dio",17002,"{13}"
|
||||
"d6c0afdb-f6f3-4473-ada3-d505228ee348","Gauph Key of Zeal","ガフスキー【激情】",0,3,4,"gauph-zeal",10005,"{13}"
|
||||
"44c2b0ba-642e-4edc-9680-1a34abe20418","Emblem of Devilry","魔獄のエンブレム",0,4,2,"emblem-devilry",3,"{19}"
|
||||
"5ac2ad0a-f8da-403a-b098-7831d354f8e0","Emblem of Divinity","天聖のエンブレム",0,4,1,"emblem-divinity",2,"{19}"
|
||||
"c2f1e5bc-9f8b-4af1-821c-2b32a9fb5f1f","Emblem of Humanity","英勇のエンブレム",0,4,0,"emblem-humanity",1,"{19}"
|
||||
"0c6ce91c-864c-4c62-8c9b-be61e8fae47f","Optimus Teluma","オプティマス・テルマ",1,2,0,"teluma-optimus",16001,"{27,40}"
|
||||
"1929bfa8-6bbd-4918-9ad7-594525b5e2c6","Crag Teluma","巨岩のテルマ",0,2,3,"teluma-crag",15004,"{27,40}"
|
||||
"3fa65774-1ed1-4a16-86cd-9133adca2232","Omega Teluma","マグナ・テルマ",1,2,1,"teluma-omega",16002,"{27,40}"
|
||||
"49f46e22-1796-435e-bce2-d9fdfe76d6c5","Tempest Teluma","暴風のテルマ",0,2,4,"teluma-tempest",15005,"{27,40}"
|
||||
"81950efb-a4e1-4d45-8572-ddb604246212","Malice Teluma","闇禍のテルマ",0,2,6,"teluma-malice",15007,"{27,40}"
|
||||
"d14e933e-630d-4cd6-9d61-dbdfd6e9332e","Abyss Teluma","深海のテルマ",0,2,2,"teluma-abyss",15003,"{27,40}"
|
||||
"dc96edb7-8bee-4721-94c2-daa6508aaed8","Inferno Teluma","炎獄のテルマ",0,2,1,"teluma-inferno",15002,"{27,40}"
|
||||
"e36950be-1ea9-4642-af94-164187e38e6c","Aureole Teluma","後光のテルマ",0,2,5,"teluma-aureole",15006,"{27,40}"
|
||||
"ee80ff09-71c0-48bb-90ff-45e138df7481","Endurance Teluma","剛堅のテルマ",0,2,0,"teluma-endurance",15001,"{27,40}"
|
||||
"b0b6d3be-7203-437e-8acd-2a59c2b5506a","Oblivion Teluma","冥烈のテルマ",0,2,8,"teluma-oblivion",15009,"{40}"
|
||||
"d79558df-53fb-4c24-963b-e0b67040afc7","Salvation Teluma","燦護のテルマ",0,2,7,"teluma-salvation",15008,"{40}"
|
||||
|
3066
spec/fixtures/deck_sample.json
vendored
Normal file
3066
spec/fixtures/deck_sample.json
vendored
Normal file
File diff suppressed because it is too large
Load diff
2564
spec/fixtures/deck_sample2.json
vendored
Normal file
2564
spec/fixtures/deck_sample2.json
vendored
Normal file
File diff suppressed because it is too large
Load diff
45
spec/services/processors/base_processor_spec.rb
Normal file
45
spec/services/processors/base_processor_spec.rb
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
require 'rails_helper'
|
||||
|
||||
module Processors
|
||||
class DummyBaseProcessor < BaseProcessor
|
||||
# A dummy implementation of process.
|
||||
def process
|
||||
"processed"
|
||||
end
|
||||
|
||||
# Expose the protected log method as public for testing.
|
||||
def public_log(message)
|
||||
log(message)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
RSpec.describe Processors::DummyBaseProcessor, type: :model do
|
||||
# Note: BaseProcessor.new expects (party, data, options = {})
|
||||
let(:dummy_party) { nil }
|
||||
let(:dummy_data) { {} }
|
||||
let(:processor) { described_class.new(dummy_party, dummy_data) }
|
||||
|
||||
describe '#process' do
|
||||
it 'returns the dummy processed value' do
|
||||
expect(processor.process).to eq("processed")
|
||||
end
|
||||
end
|
||||
|
||||
describe '#public_log' do
|
||||
it 'logs a message containing the processor class name' do
|
||||
message = "Test log message"
|
||||
expect(Rails.logger).to receive(:info).with(a_string_including("DummyBaseProcessor", message))
|
||||
processor.public_log(message)
|
||||
end
|
||||
end
|
||||
|
||||
after(:each) do |example|
|
||||
if example.exception
|
||||
puts "\nDEBUG [DummyBaseProcessor]: #{example.full_description} failed with error: #{example.exception.message}"
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in a new issue