From 7b976577569d808615c93ce660a55b8b9bd9caf0 Mon Sep 17 00:00:00 2001 From: innerthunder <168692175+innerthunder@users.noreply.github.com> Date: Fri, 6 Sep 2024 00:59:22 -0700 Subject: [PATCH 1/2] [Bug] Fix Aura Break applying without Dark/Fairy Aura present (#4057) * Fix Aura Break ignoring active Dark/Fairy Aura condition * Add conditional post-summon message --------- Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> --- src/data/ability.ts | 6 ++++-- src/data/move.ts | 5 ++++- src/locales/en/ability-trigger.json | 1 + src/test/abilities/aura_break.test.ts | 27 ++++++++++++++++++++------- 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index 2407460b87d..10aba1f030e 100755 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -5333,8 +5333,10 @@ export function initAbilities() { .attr(FieldMoveTypePowerBoostAbAttr, Type.FAIRY, 4 / 3), new Ability(Abilities.AURA_BREAK, 6) .ignorable() - .conditionalAttr(target => target.hasAbility(Abilities.DARK_AURA), FieldMoveTypePowerBoostAbAttr, Type.DARK, 9 / 16) - .conditionalAttr(target => target.hasAbility(Abilities.FAIRY_AURA), FieldMoveTypePowerBoostAbAttr, Type.FAIRY, 9 / 16), + .conditionalAttr(pokemon => pokemon.scene.getField(true).some(p => p.hasAbility(Abilities.DARK_AURA)), FieldMoveTypePowerBoostAbAttr, Type.DARK, 9 / 16) + .conditionalAttr(pokemon => pokemon.scene.getField(true).some(p => p.hasAbility(Abilities.FAIRY_AURA)), FieldMoveTypePowerBoostAbAttr, Type.FAIRY, 9 / 16) + .conditionalAttr(pokemon => pokemon.scene.getField(true).some(p => p.hasAbility(Abilities.DARK_AURA) || p.hasAbility(Abilities.FAIRY_AURA)), + PostSummonMessageAbAttr, (pokemon: Pokemon) => i18next.t("abilityTriggers:postSummonAuraBreak", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) })), new Ability(Abilities.PRIMORDIAL_SEA, 6) .attr(PostSummonWeatherChangeAbAttr, WeatherType.HEAVY_RAIN) .attr(PostBiomeChangeWeatherChangeAbAttr, WeatherType.HEAVY_RAIN) diff --git a/src/data/move.ts b/src/data/move.ts index 96b780a8330..19014c0eb30 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -757,7 +757,10 @@ export default class Move implements Localizable { const fieldAuras = new Set( source.scene.getField(true) - .map((p) => p.getAbilityAttrs(FieldMoveTypePowerBoostAbAttr) as FieldMoveTypePowerBoostAbAttr[]) + .map((p) => p.getAbilityAttrs(FieldMoveTypePowerBoostAbAttr).filter(attr => { + const condition = attr.getCondition(); + return (!condition || condition(p)); + }) as FieldMoveTypePowerBoostAbAttr[]) .flat(), ); for (const aura of fieldAuras) { diff --git a/src/locales/en/ability-trigger.json b/src/locales/en/ability-trigger.json index 4f1d4dac766..a7383cea16b 100644 --- a/src/locales/en/ability-trigger.json +++ b/src/locales/en/ability-trigger.json @@ -52,6 +52,7 @@ "postSummonTeravolt": "{{pokemonNameWithAffix}} is radiating a bursting aura!", "postSummonDarkAura": "{{pokemonNameWithAffix}} is radiating a Dark Aura!", "postSummonFairyAura": "{{pokemonNameWithAffix}} is radiating a Fairy Aura!", + "postSummonAuraBreak": "{{pokemonNameWithAffix}} reversed all other Pokémon's auras!", "postSummonNeutralizingGas": "{{pokemonNameWithAffix}}'s Neutralizing Gas filled the area!", "postSummonAsOneGlastrier": "{{pokemonNameWithAffix}} has two Abilities!", "postSummonAsOneSpectrier": "{{pokemonNameWithAffix}} has two Abilities!", diff --git a/src/test/abilities/aura_break.test.ts b/src/test/abilities/aura_break.test.ts index 7de300c157a..0fb2212d817 100644 --- a/src/test/abilities/aura_break.test.ts +++ b/src/test/abilities/aura_break.test.ts @@ -1,5 +1,4 @@ import { allMoves } from "#app/data/move"; -import { MoveEffectPhase } from "#app/phases/move-effect-phase"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; @@ -33,31 +32,45 @@ describe("Abilities - Aura Break", () => { game.override.enemySpecies(Species.SHUCKLE); }); - it("reverses the effect of fairy aura", async () => { + it("reverses the effect of Fairy Aura", async () => { const moveToCheck = allMoves[Moves.MOONBLAST]; const basePower = moveToCheck.power; game.override.ability(Abilities.FAIRY_AURA); vi.spyOn(moveToCheck, "calculateBattlePower"); - await game.startBattle([Species.PIKACHU]); + await game.classicMode.startBattle([Species.PIKACHU]); game.move.select(Moves.MOONBLAST); - await game.phaseInterceptor.to(MoveEffectPhase); + await game.phaseInterceptor.to("MoveEffectPhase"); expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(expect.closeTo(basePower * auraBreakMultiplier)); }); - it("reverses the effect of dark aura", async () => { + it("reverses the effect of Dark Aura", async () => { const moveToCheck = allMoves[Moves.DARK_PULSE]; const basePower = moveToCheck.power; game.override.ability(Abilities.DARK_AURA); vi.spyOn(moveToCheck, "calculateBattlePower"); - await game.startBattle([Species.PIKACHU]); + await game.classicMode.startBattle([Species.PIKACHU]); game.move.select(Moves.DARK_PULSE); - await game.phaseInterceptor.to(MoveEffectPhase); + await game.phaseInterceptor.to("MoveEffectPhase"); expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(expect.closeTo(basePower * auraBreakMultiplier)); }); + + it("has no effect if neither Fairy Aura nor Dark Aura are present", async () => { + const moveToCheck = allMoves[Moves.MOONBLAST]; + const basePower = moveToCheck.power; + + game.override.ability(Abilities.BALL_FETCH); + vi.spyOn(moveToCheck, "calculateBattlePower"); + + await game.classicMode.startBattle([Species.PIKACHU]); + game.move.select(Moves.MOONBLAST); + await game.phaseInterceptor.to("MoveEffectPhase"); + + expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(basePower); + }); }); From d58f03528776a56e0fc1b8cfc6d1a99ae3561038 Mon Sep 17 00:00:00 2001 From: "Adrian T." <68144167+torranx@users.noreply.github.com> Date: Fri, 6 Sep 2024 17:41:48 +0800 Subject: [PATCH 2/2] [Misc] Migrate REROLL_TARGET to SHOP_CURSOR_TARGET (#4016) * migrate reroll target to shop cursor target * delete key after migrating --- src/system/game-data.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/system/game-data.ts b/src/system/game-data.ts index 1a47294906e..746af4d47a5 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -857,6 +857,14 @@ export class GameData { const settings = JSON.parse(localStorage.getItem("settings")!); // TODO: is this bang correct? + // TODO: Remove this block after save migration is implemented + if (settings.hasOwnProperty("REROLL_TARGET") && !settings.hasOwnProperty(SettingKeys.Shop_Cursor_Target)) { + settings[SettingKeys.Shop_Cursor_Target] = settings["REROLL_TARGET"]; + delete settings["REROLL_TARGET"]; + localStorage.setItem("settings", JSON.stringify(settings)); + } + // End of block to remove + for (const setting of Object.keys(settings)) { setSetting(this.scene, setting, settings[setting]); }