From 6add614e1c02c4aac600d0ce8096cfdcd08c3149 Mon Sep 17 00:00:00 2001 From: damocleas Date: Mon, 31 Mar 2025 12:34:16 -0400 Subject: [PATCH] [Balance] Trash to Treasure and The Strong Stuff minor adjustments (#5593) * Update trash-to-treasure-encounter.ts * Update the-strong-stuff-encounter.ts * add 'set' items to garbodor * Update relevant tests --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --- .../encounters/the-strong-stuff-encounter.ts | 4 +- .../encounters/trash-to-treasure-encounter.ts | 63 ++++++--- .../the-strong-stuff-encounter.test.ts | 4 +- .../trash-to-treasure-encounter.test.ts | 125 ++++++++++++------ 4 files changed, 133 insertions(+), 63 deletions(-) diff --git a/src/data/mystery-encounters/encounters/the-strong-stuff-encounter.ts b/src/data/mystery-encounters/encounters/the-strong-stuff-encounter.ts index e54df048430..c994c6e993f 100644 --- a/src/data/mystery-encounters/encounters/the-strong-stuff-encounter.ts +++ b/src/data/mystery-encounters/encounters/the-strong-stuff-encounter.ts @@ -93,7 +93,7 @@ export const TheStrongStuffEncounter: MysteryEncounter = MysteryEncounterBuilder bossSegments: 5, shiny: false, // Shiny lock because shiny is rolled only if the battle option is picked customPokemonData: new CustomPokemonData({ spriteScale: 1.25 }), - nature: Nature.BOLD, + nature: Nature.HARDY, moveSet: [Moves.INFESTATION, Moves.SALT_CURE, Moves.GASTRO_ACID, Moves.HEAL_ORDER], modifierConfigs: [ { @@ -117,7 +117,7 @@ export const TheStrongStuffEncounter: MysteryEncounter = MysteryEncounterBuilder mysteryEncounterBattleEffects: (pokemon: Pokemon) => { queueEncounterMessage(`${namespace}:option.2.stat_boost`); globalScene.unshiftPhase( - new StatStageChangePhase(pokemon.getBattlerIndex(), true, [Stat.DEF, Stat.SPDEF], 2), + new StatStageChangePhase(pokemon.getBattlerIndex(), true, [Stat.DEF, Stat.SPDEF], 1), ); }, }, diff --git a/src/data/mystery-encounters/encounters/trash-to-treasure-encounter.ts b/src/data/mystery-encounters/encounters/trash-to-treasure-encounter.ts index 1c617aa2c7f..e60fe0ddc18 100644 --- a/src/data/mystery-encounters/encounters/trash-to-treasure-encounter.ts +++ b/src/data/mystery-encounters/encounters/trash-to-treasure-encounter.ts @@ -27,6 +27,7 @@ import { Moves } from "#enums/moves"; import { BattlerIndex } from "#app/battle"; import { PokemonMove } from "#app/field/pokemon"; import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode"; +import { randSeedInt } from "#app/utils"; /** the i18n namespace for this encounter */ const namespace = "mysteryEncounters/trashToTreasure"; @@ -80,7 +81,43 @@ export const TrashToTreasureEncounter: MysteryEncounter = MysteryEncounterBuilde shiny: false, // Shiny lock because of custom intro sprite formIndex: 1, // Gmax bossSegmentModifier: 1, // +1 Segment from normal - moveSet: [Moves.PAYBACK, Moves.GUNK_SHOT, Moves.STOMPING_TANTRUM, Moves.DRAIN_PUNCH], + moveSet: [Moves.GUNK_SHOT, Moves.STOMPING_TANTRUM, Moves.HAMMER_ARM, Moves.PAYBACK], + modifierConfigs: [ + { + modifier: generateModifierType(modifierTypes.BERRY) as PokemonHeldItemModifierType, + }, + { + modifier: generateModifierType(modifierTypes.BERRY) as PokemonHeldItemModifierType, + }, + { + modifier: generateModifierType(modifierTypes.BERRY) as PokemonHeldItemModifierType, + }, + { + modifier: generateModifierType(modifierTypes.BERRY) as PokemonHeldItemModifierType, + }, + { + modifier: generateModifierType(modifierTypes.BASE_STAT_BOOSTER) as PokemonHeldItemModifierType, + }, + { + modifier: generateModifierType(modifierTypes.BASE_STAT_BOOSTER) as PokemonHeldItemModifierType, + }, + { + modifier: generateModifierType(modifierTypes.TOXIC_ORB) as PokemonHeldItemModifierType, + stackCount: randSeedInt(2, 0), + }, + { + modifier: generateModifierType(modifierTypes.SOOTHE_BELL) as PokemonHeldItemModifierType, + stackCount: randSeedInt(2, 1), + }, + { + modifier: generateModifierType(modifierTypes.LUCKY_EGG) as PokemonHeldItemModifierType, + stackCount: randSeedInt(3, 1), + }, + { + modifier: generateModifierType(modifierTypes.GOLDEN_EGG) as PokemonHeldItemModifierType, + stackCount: randSeedInt(2, 0), + }, + ], }; const config: EnemyPartyConfig = { levelAdditiveModifier: 0.5, @@ -90,7 +127,7 @@ export const TrashToTreasureEncounter: MysteryEncounter = MysteryEncounterBuilde encounter.enemyPartyConfigs = [config]; // Load animations/sfx for Garbodor fight start moves - loadCustomMovesForEncounter([Moves.TOXIC, Moves.AMNESIA]); + loadCustomMovesForEncounter([Moves.TOXIC, Moves.STOCKPILE]); globalScene.loadSe("PRSFX- Dig2", "battle_anims", "PRSFX- Dig2.wav"); globalScene.loadSe("PRSFX- Venom Drench", "battle_anims", "PRSFX- Venom Drench.wav"); @@ -115,7 +152,7 @@ export const TrashToTreasureEncounter: MysteryEncounter = MysteryEncounterBuilde doGarbageDig(); }) .withOptionPhase(async () => { - // Gain 2 Leftovers and 2 Shell Bell + // Gain 2 Leftovers and 1 Shell Bell await transitionMysteryEncounterIntroVisuals(); await tryApplyDigRewardItems(); @@ -175,7 +212,7 @@ export const TrashToTreasureEncounter: MysteryEncounter = MysteryEncounterBuilde { sourceBattlerIndex: BattlerIndex.ENEMY, targets: [BattlerIndex.ENEMY], - move: new PokemonMove(Moves.AMNESIA), + move: new PokemonMove(Moves.STOCKPILE), ignorePp: true, }, ); @@ -231,21 +268,7 @@ async function tryApplyDigRewardItems() { true, ); - // First Shell bell - for (const pokemon of party) { - const heldItems = globalScene.findModifiers( - m => m instanceof PokemonHeldItemModifier && m.pokemonId === pokemon.id, - true, - ) as PokemonHeldItemModifier[]; - const existingShellBell = heldItems.find(m => m instanceof HitHealModifier) as HitHealModifier; - - if (!existingShellBell || existingShellBell.getStackCount() < existingShellBell.getMaxStackCount()) { - await applyModifierTypeToPlayerPokemon(pokemon, shellBell); - break; - } - } - - // Second Shell bell + // Only Shell bell for (const pokemon of party) { const heldItems = globalScene.findModifiers( m => m instanceof PokemonHeldItemModifier && m.pokemonId === pokemon.id, @@ -263,7 +286,7 @@ async function tryApplyDigRewardItems() { await showEncounterText( i18next.t("battle:rewardGainCount", { modifierName: shellBell.name, - count: 2, + count: 1, }), null, undefined, diff --git a/test/mystery-encounter/encounters/the-strong-stuff-encounter.test.ts b/test/mystery-encounter/encounters/the-strong-stuff-encounter.test.ts index 57d55af5dac..a9e6a339d36 100644 --- a/test/mystery-encounter/encounters/the-strong-stuff-encounter.test.ts +++ b/test/mystery-encounter/encounters/the-strong-stuff-encounter.test.ts @@ -114,7 +114,7 @@ describe("The Strong Stuff - Mystery Encounter", () => { bossSegments: 5, shiny: false, customPokemonData: new CustomPokemonData({ spriteScale: 1.25 }), - nature: Nature.BOLD, + nature: Nature.HARDY, moveSet: [Moves.INFESTATION, Moves.SALT_CURE, Moves.GASTRO_ACID, Moves.HEAL_ORDER], modifierConfigs: expect.any(Array), tags: [BattlerTagType.MYSTERY_ENCOUNTER_POST_SUMMON], @@ -198,7 +198,7 @@ describe("The Strong Stuff - Mystery Encounter", () => { expect(scene.getCurrentPhase()?.constructor.name).toBe(CommandPhase.name); expect(enemyField.length).toBe(1); expect(enemyField[0].species.speciesId).toBe(Species.SHUCKLE); - expect(enemyField[0].summonData.statStages).toEqual([0, 2, 0, 2, 0, 0, 0]); + expect(enemyField[0].summonData.statStages).toEqual([0, 1, 0, 1, 0, 0, 0]); const shuckleItems = enemyField[0].getHeldItems(); expect(shuckleItems.length).toBe(5); expect(shuckleItems.find(m => m instanceof BerryModifier && m.berryType === BerryType.SITRUS)?.stackCount).toBe( diff --git a/test/mystery-encounter/encounters/trash-to-treasure-encounter.test.ts b/test/mystery-encounter/encounters/trash-to-treasure-encounter.test.ts index 90e2312e624..df7bbb9f424 100644 --- a/test/mystery-encounter/encounters/trash-to-treasure-encounter.test.ts +++ b/test/mystery-encounter/encounters/trash-to-treasure-encounter.test.ts @@ -1,30 +1,37 @@ +import type BattleScene from "#app/battle-scene"; +import * as BattleAnims from "#app/data/battle-anims"; +import { TrashToTreasureEncounter } from "#app/data/mystery-encounters/encounters/trash-to-treasure-encounter"; import * as MysteryEncounters from "#app/data/mystery-encounters/mystery-encounters"; +import * as EncounterPhaseUtils from "#app/data/mystery-encounters/utils/encounter-phase-utils"; +import { + type EnemyPartyConfig, + type EnemyPokemonConfig, + generateModifierType, +} from "#app/data/mystery-encounters/utils/encounter-phase-utils"; +import { getPokemonSpecies } from "#app/data/pokemon-species"; import { Biome } from "#app/enums/biome"; import { MysteryEncounterType } from "#app/enums/mystery-encounter-type"; import { Species } from "#app/enums/species"; -import GameManager from "#test/testUtils/gameManager"; -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import { getPokemonSpecies } from "#app/data/pokemon-species"; -import * as BattleAnims from "#app/data/battle-anims"; -import * as EncounterPhaseUtils from "#app/data/mystery-encounters/utils/encounter-phase-utils"; +import { PokemonMove } from "#app/field/pokemon"; +import { HealShopCostModifier, HitHealModifier, TurnHealModifier } from "#app/modifier/modifier"; +import { ModifierTier } from "#app/modifier/modifier-tier"; +import { modifierTypes, type PokemonHeldItemModifierType } from "#app/modifier/modifier-type"; +import { CommandPhase } from "#app/phases/command-phase"; +import { MovePhase } from "#app/phases/move-phase"; +import { SelectModifierPhase } from "#app/phases/select-modifier-phase"; +import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler"; +import { Mode } from "#app/ui/ui"; +import * as Utils from "#app/utils"; +import { Moves } from "#enums/moves"; +import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode"; +import { MysteryEncounterTier } from "#enums/mystery-encounter-tier"; import { runMysteryEncounterToEnd, skipBattleRunMysteryEncounterRewardsPhase, } from "#test/mystery-encounter/encounter-test-utils"; -import { Moves } from "#enums/moves"; -import type BattleScene from "#app/battle-scene"; -import { PokemonMove } from "#app/field/pokemon"; -import { Mode } from "#app/ui/ui"; -import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler"; -import { HitHealModifier, HealShopCostModifier, TurnHealModifier } from "#app/modifier/modifier"; -import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode"; -import { MysteryEncounterTier } from "#enums/mystery-encounter-tier"; +import GameManager from "#test/testUtils/gameManager"; import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils"; -import { TrashToTreasureEncounter } from "#app/data/mystery-encounters/encounters/trash-to-treasure-encounter"; -import { ModifierTier } from "#app/modifier/modifier-tier"; -import { SelectModifierPhase } from "#app/phases/select-modifier-phase"; -import { CommandPhase } from "#app/phases/command-phase"; -import { MovePhase } from "#app/phases/move-phase"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; const namespace = "mysteryEncounters/trashToTreasure"; const defaultParty = [Species.LAPRAS, Species.GENGAR, Species.ABRA]; @@ -73,6 +80,7 @@ describe("Trash to Treasure - Mystery Encounter", () => { }); it("should initialize fully", async () => { + vi.spyOn(Utils, "randSeedInt").mockImplementation((range, min = 0) => min + range - 1); initSceneWithoutEncounterPhase(scene, defaultParty); scene.currentBattle.mysteryEncounter = TrashToTreasureEncounter; const moveInitSpy = vi.spyOn(BattleAnims, "initMoveAnim"); @@ -85,22 +93,61 @@ describe("Trash to Treasure - Mystery Encounter", () => { TrashToTreasureEncounter.populateDialogueTokensFromRequirements(); const onInitResult = onInit!(); - expect(TrashToTreasureEncounter.enemyPartyConfigs).toEqual([ - { - levelAdditiveModifier: 0.5, - disableSwitch: true, - pokemonConfigs: [ - { - species: getPokemonSpecies(Species.GARBODOR), - isBoss: true, - shiny: false, - formIndex: 1, - bossSegmentModifier: 1, - moveSet: [Moves.PAYBACK, Moves.GUNK_SHOT, Moves.STOMPING_TANTRUM, Moves.DRAIN_PUNCH], - }, - ], - }, - ]); + const bossSpecies = getPokemonSpecies(Species.GARBODOR); + const pokemonConfig: EnemyPokemonConfig = { + species: bossSpecies, + isBoss: true, + shiny: false, // Shiny lock because of custom intro sprite + formIndex: 1, // Gmax + bossSegmentModifier: 1, // +1 Segment from normal + moveSet: [Moves.GUNK_SHOT, Moves.STOMPING_TANTRUM, Moves.HAMMER_ARM, Moves.PAYBACK], + modifierConfigs: [ + { + modifier: generateModifierType(modifierTypes.BERRY) as PokemonHeldItemModifierType, + }, + { + modifier: generateModifierType(modifierTypes.BERRY) as PokemonHeldItemModifierType, + }, + { + modifier: generateModifierType(modifierTypes.BERRY) as PokemonHeldItemModifierType, + }, + { + modifier: generateModifierType(modifierTypes.BERRY) as PokemonHeldItemModifierType, + }, + { + modifier: generateModifierType(modifierTypes.BASE_STAT_BOOSTER) as PokemonHeldItemModifierType, + }, + { + modifier: generateModifierType(modifierTypes.BASE_STAT_BOOSTER) as PokemonHeldItemModifierType, + }, + { + modifier: generateModifierType(modifierTypes.TOXIC_ORB) as PokemonHeldItemModifierType, + stackCount: Utils.randSeedInt(2, 0), + }, + { + modifier: generateModifierType(modifierTypes.SOOTHE_BELL) as PokemonHeldItemModifierType, + stackCount: Utils.randSeedInt(2, 1), + }, + { + modifier: generateModifierType(modifierTypes.LUCKY_EGG) as PokemonHeldItemModifierType, + stackCount: Utils.randSeedInt(3, 1), + }, + { + modifier: generateModifierType(modifierTypes.GOLDEN_EGG) as PokemonHeldItemModifierType, + stackCount: Utils.randSeedInt(2, 0), + }, + ], + }; + const config: EnemyPartyConfig = { + levelAdditiveModifier: 0.5, + pokemonConfigs: [pokemonConfig], + disableSwitch: true, + }; + const enemyPartyConfigs = [config]; + + expect(JSON.stringify(TrashToTreasureEncounter.enemyPartyConfigs, undefined, 2)).toEqual( + JSON.stringify(enemyPartyConfigs, undefined, 2), + ); await vi.waitFor(() => expect(moveInitSpy).toHaveBeenCalled()); await vi.waitFor(() => expect(moveLoadSpy).toHaveBeenCalled()); expect(onInitResult).toBe(true); @@ -122,7 +169,7 @@ describe("Trash to Treasure - Mystery Encounter", () => { }); }); - it("should give 2 Leftovers, 2 Shell Bell, and Black Sludge", async () => { + it("should give 2 Leftovers, 1 Shell Bell, and Black Sludge", async () => { await game.runToMysteryEncounter(MysteryEncounterType.TRASH_TO_TREASURE, defaultParty); await runMysteryEncounterToEnd(game, 1); await game.phaseInterceptor.to(SelectModifierPhase, false); @@ -134,7 +181,7 @@ describe("Trash to Treasure - Mystery Encounter", () => { const shellBell = scene.findModifier(m => m instanceof HitHealModifier) as HitHealModifier; expect(shellBell).toBeDefined(); - expect(shellBell?.stackCount).toBe(2); + expect(shellBell?.stackCount).toBe(1); const blackSludge = scene.findModifier(m => m instanceof HealShopCostModifier) as HealShopCostModifier; expect(blackSludge).toBeDefined(); @@ -178,17 +225,17 @@ describe("Trash to Treasure - Mystery Encounter", () => { expect(enemyField.length).toBe(1); expect(enemyField[0].species.speciesId).toBe(Species.GARBODOR); expect(enemyField[0].moveset).toEqual([ - new PokemonMove(Moves.PAYBACK), new PokemonMove(Moves.GUNK_SHOT), new PokemonMove(Moves.STOMPING_TANTRUM), - new PokemonMove(Moves.DRAIN_PUNCH), + new PokemonMove(Moves.HAMMER_ARM), + new PokemonMove(Moves.PAYBACK), ]); // Should have used moves pre-battle const movePhases = phaseSpy.mock.calls.filter(p => p[0] instanceof MovePhase).map(p => p[0]); expect(movePhases.length).toBe(2); expect(movePhases.filter(p => (p as MovePhase).move.moveId === Moves.TOXIC).length).toBe(1); - expect(movePhases.filter(p => (p as MovePhase).move.moveId === Moves.AMNESIA).length).toBe(1); + expect(movePhases.filter(p => (p as MovePhase).move.moveId === Moves.STOCKPILE).length).toBe(1); }); it("should have 2 Rogue, 1 Ultra, 1 Great in rewards", async () => {