diff --git a/assets/dbs/items_db.json b/assets/dbs/items_db.json index c4fe91c85e..691e9595d3 100644 --- a/assets/dbs/items_db.json +++ b/assets/dbs/items_db.json @@ -16,6 +16,7 @@ "operator": "plus" }], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "", @@ -40,6 +41,7 @@ "operator": "plus" }], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "", @@ -68,6 +70,7 @@ "operator": "plus" }], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "", @@ -103,6 +106,7 @@ } ], "element": "venus", + "attack_ability": "", "unleash_ability": "titan_blade", "unleash_rate": 0.35, "use_ability": "", @@ -129,6 +133,7 @@ } ], "element": "jupiter", + "attack_ability": "", "unleash_ability": "vorpal_slash", "unleash_rate": 0.35, "use_ability": "", @@ -153,6 +158,7 @@ "operator": "plus" }], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "", @@ -176,6 +182,7 @@ "operator": "plus" }], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "", @@ -199,6 +206,7 @@ "operator": "plus" }], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "", @@ -222,6 +230,7 @@ "operator": "plus" }], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "", @@ -255,6 +264,7 @@ } ], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "", @@ -274,6 +284,7 @@ "carry_up_to_30": true, "effects": [], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "cookie", @@ -293,6 +304,7 @@ "carry_up_to_30": true, "effects": [], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "antidote", @@ -312,6 +324,7 @@ "carry_up_to_30": true, "effects": [], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "elixir", @@ -331,6 +344,7 @@ "carry_up_to_30": true, "effects": [], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "herb", @@ -350,6 +364,7 @@ "carry_up_to_30": true, "effects": [], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "nut", @@ -369,6 +384,7 @@ "carry_up_to_30": false, "effects": [], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "", @@ -388,6 +404,7 @@ "carry_up_to_30": false, "effects": [], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "", @@ -407,6 +424,7 @@ "carry_up_to_30": false, "effects": [], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "", @@ -432,6 +450,7 @@ } ], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "", @@ -458,6 +477,7 @@ } ], "element": "no_element", + "attack_ability": "", "unleash_ability": "sarcophagus", "unleash_rate": 0.35, "use_ability": "", @@ -487,6 +507,7 @@ "operator": "plus" }], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "", @@ -507,6 +528,7 @@ "carry_up_to_30": false, "effects": [], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "wish_well", @@ -527,6 +549,7 @@ "carry_up_to_30": true, "effects": [], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "", @@ -551,6 +574,7 @@ "operator": "plus" }], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "", @@ -575,6 +599,7 @@ "operator": "plus" }], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "", @@ -602,6 +627,7 @@ "quantity": 2, "operator": "divide"}], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "", @@ -630,6 +656,7 @@ "operator": "plus" }], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "", @@ -654,6 +681,7 @@ "operator": "plus" }], "element": "mars", + "attack_ability": "", "unleash_ability": "flare_burst", "unleash_rate": 35, "use_ability": "", @@ -679,6 +707,7 @@ "operator": "plus" }], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "", @@ -700,6 +729,7 @@ "carry_up_to_30": false, "effects": [], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "", @@ -720,6 +750,7 @@ "carry_up_to_30": false, "effects": [], "attribute": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "", @@ -739,6 +770,7 @@ "carry_up_to_30": true, "effects": [], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "oil_drop", @@ -758,6 +790,7 @@ "carry_up_to_30": true, "effects": [], "element": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "smoke_bomb", @@ -781,6 +814,7 @@ "operator": "plus" }], "element": "no_element", + "attack_ability": "", "unleash_ability": "aura_gloves", "unleash_rate": 0, "use_ability": "", @@ -800,6 +834,7 @@ "carry_up_to_30": false, "effects": [], "attribute": "no_element", + "attack_ability": "", "unleash_ability": "", "unleash_rate": 0, "use_ability": "", diff --git a/base/Item.ts b/base/Item.ts index 94758ed2cc..fd7bcd714a 100644 --- a/base/Item.ts +++ b/base/Item.ts @@ -57,6 +57,7 @@ export class Item { public carry_up_to_30: boolean; public effects: any; public element: elements; + public attack_ability: string; public unleash_ability: string; public unleash_rate: number; public use_ability: string; @@ -85,6 +86,7 @@ export class Item { carry_up_to_30, effects, element, + attack_ability, unleash_ability, unleash_rate, use_ability, @@ -108,6 +110,7 @@ export class Item { this.carry_up_to_30 = carry_up_to_30; this.effects = effects; this.element = element; + this.attack_ability = attack_ability; this.unleash_ability = unleash_ability; this.unleash_rate = unleash_rate; this.use_ability = use_ability; diff --git a/base/battle/Battle.ts b/base/battle/Battle.ts index 2e0023eff6..714a48317d 100644 --- a/base/battle/Battle.ts +++ b/base/battle/Battle.ts @@ -733,8 +733,8 @@ export class Battle { //gets item's name in the case this ability is related to an item let item_name = action.item_slot ? this.data.info.items_list[action.item_slot.key_name].name : ""; - //change the current ability to unleash ability from weapon - const unleash_info = await this.check_if_ability_will_unleash(action, ability, item_name); + //change the current ability to custom animation or unleash ability if necessary + const unleash_info = await this.check_weapon_ability(action, ability, item_name); ability = unleash_info.ability; item_name = unleash_info.item_name; @@ -1237,19 +1237,26 @@ export class Battle { return ability; } - async check_if_ability_will_unleash(action: PlayerAbility, ability: Ability, item_name: string) { - if ( - action.caster.fighter_type === fighter_types.ALLY && - ability !== undefined && - ability.can_switch_to_unleash - ) { + async check_weapon_ability(action: PlayerAbility, ability: Ability, item_name: string) { + if (action.caster.fighter_type === fighter_types.ALLY && ability !== undefined) { const caster = action.caster as MainChar; - if ( - caster.equip_slots.weapon && - this.data.info.items_list[caster.equip_slots.weapon.key_name].unleash_ability - ) { - const weapon = this.data.info.items_list[caster.equip_slots.weapon.key_name]; + const weapon = this.data.info.items_list[caster.equip_slots.weapon.key_name]; + if (!caster.equip_slots.weapon) { + return { + ability: ability, + item_name: item_name, + }; + } + + if (weapon.attack_ability) { + action.key_name = weapon.attack_ability; + ability = this.data.info.abilities_list[weapon.attack_ability]; + + await this.set_action_animation_settings(action, ability); + } + + if (ability.can_switch_to_unleash && weapon.unleash_ability) { if (Math.random() < weapon.unleash_rate) { item_name = weapon.name; action.key_name = weapon.unleash_ability; @@ -1259,6 +1266,7 @@ export class Battle { } } } + return { ability: ability, item_name: item_name, diff --git a/base/initializers/items.ts b/base/initializers/items.ts index 9fd65830ed..e6bf33b2a4 100644 --- a/base/initializers/items.ts +++ b/base/initializers/items.ts @@ -20,6 +20,7 @@ export function initialize_items(game: Phaser.Game, data: GoldenSun, items_db: a item_data.carry_up_to_30, item_data.effects, item_data.element, + item_data.attack_ability, item_data.unleash_ability, item_data.unleash_rate, item_data.use_ability,