From 8783fd81c72e86982a38153ffe08a5a4a5e99b6c Mon Sep 17 00:00:00 2001 From: Frederico Santos Date: Wed, 7 Aug 2024 21:29:41 +0100 Subject: [PATCH] Revert egg additive/multiplicative change and change endless biome rotation for every 5 waves. (#3415) Co-authored-by: snoozbuster --- src/battle-scene.ts | 26 +++++--------------------- src/modifier/modifier.ts | 2 +- src/phases.ts | 4 +--- src/test/items/exp_booster.test.ts | 11 ++++++----- vite.config.ts | 3 ++- 5 files changed, 15 insertions(+), 31 deletions(-) diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 4269edecfaf..c0b6e2ba91e 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -1115,27 +1115,11 @@ export default class BattleScene extends SceneBase { //this.pushPhase(new TrainerMessageTestPhase(this, TrainerType.RIVAL, TrainerType.RIVAL_2, TrainerType.RIVAL_3, TrainerType.RIVAL_4, TrainerType.RIVAL_5, TrainerType.RIVAL_6)); if (!waveIndex && lastBattle) { - let isNewBiome = !(lastBattle.waveIndex % 10) || ((this.gameMode.hasShortBiomes || this.gameMode.isDaily) && (lastBattle.waveIndex % 50) === 49); - if (!isNewBiome && this.gameMode.hasShortBiomes && (lastBattle.waveIndex % 10) < 9) { - let w = lastBattle.waveIndex - ((lastBattle.waveIndex % 10) - 1); - let biomeWaves = 1; - while (w < lastBattle.waveIndex) { - let wasNewBiome = false; - this.executeWithSeedOffset(() => { - wasNewBiome = !Utils.randSeedInt(6 - biomeWaves); - }, w << 4); - if (wasNewBiome) { - biomeWaves = 1; - } else { - biomeWaves++; - } - w++; - } - - this.executeWithSeedOffset(() => { - isNewBiome = !Utils.randSeedInt(6 - biomeWaves); - }, lastBattle.waveIndex << 4); - } + const isWaveIndexMultipleOfTen = !(lastBattle.waveIndex % 10); + const isEndlessOrDaily = this.gameMode.hasShortBiomes || this.gameMode.isDaily; + const isEndlessFifthWave = this.gameMode.hasShortBiomes && (lastBattle.waveIndex % 5) === 0; + const isWaveIndexMultipleOfFiftyMinusOne = (lastBattle.waveIndex % 50) === 49; + const isNewBiome = isWaveIndexMultipleOfTen || isEndlessFifthWave || (isEndlessOrDaily && isWaveIndexMultipleOfFiftyMinusOne); const resetArenaState = isNewBiome || this.currentBattle.battleType === BattleType.TRAINER || this.currentBattle.battleSpec === BattleSpec.FINAL_BOSS; this.getEnemyParty().forEach(enemyPokemon => enemyPokemon.destroy()); this.trySpreadPokerus(); diff --git a/src/modifier/modifier.ts b/src/modifier/modifier.ts index 6ff2d3c9718..c6871353a7d 100644 --- a/src/modifier/modifier.ts +++ b/src/modifier/modifier.ts @@ -1818,7 +1818,7 @@ export class PokemonExpBoosterModifier extends PokemonHeldItemModifier { } apply(args: any[]): boolean { - (args[1] as Utils.NumberHolder).value += (this.getStackCount() * this.boostMultiplier); + (args[1] as Utils.NumberHolder).value = Math.floor((args[1] as Utils.NumberHolder).value * (1 + (this.getStackCount() * this.boostMultiplier))); return true; } diff --git a/src/phases.ts b/src/phases.ts index ac6da0db148..39cbbd5ff8b 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -3988,9 +3988,7 @@ export class VictoryPhase extends PokemonPhase { expMultiplier = Overrides.XP_MULTIPLIER_OVERRIDE; } const pokemonExp = new Utils.NumberHolder(expValue * expMultiplier); - const modifierBonusExp = new Utils.NumberHolder(1); - this.scene.applyModifiers(PokemonExpBoosterModifier, true, partyMember, modifierBonusExp); - pokemonExp.value *= modifierBonusExp.value; + this.scene.applyModifiers(PokemonExpBoosterModifier, true, partyMember, pokemonExp); partyMemberExp.push(Math.floor(pokemonExp.value)); } diff --git a/src/test/items/exp_booster.test.ts b/src/test/items/exp_booster.test.ts index 3348304b2e7..2b700c92086 100644 --- a/src/test/items/exp_booster.test.ts +++ b/src/test/items/exp_booster.test.ts @@ -27,13 +27,14 @@ describe("EXP Modifier Items", () => { game.override.battleType("single"); }); - it("EXP booster items stack additively", async() => { - game.override.startingHeldItems([{name: "LUCKY_EGG"}, {name: "GOLDEN_EGG"}]); + it("EXP booster items stack multiplicatively", async() => { + game.override.startingHeldItems([{name: "LUCKY_EGG", count: 3}, {name: "GOLDEN_EGG"}]); await game.startBattle(); const partyMember = game.scene.getPlayerPokemon()!; - const modifierBonusExp = new Utils.NumberHolder(1); - partyMember.scene.applyModifiers(PokemonExpBoosterModifier, true, partyMember, modifierBonusExp); - expect(modifierBonusExp.value).toBe(2.4); + partyMember.exp = 100; + const expHolder = new Utils.NumberHolder(partyMember.exp); + partyMember.scene.applyModifiers(PokemonExpBoosterModifier, true, partyMember, expHolder); + expect(expHolder.value).toBe(440); }, 20000); }); diff --git a/vite.config.ts b/vite.config.ts index f5c95aa56bd..4bd013bff2e 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -20,7 +20,8 @@ export const defaultConfig = { } warn(warning); }, - } + }, + appType: "mpa", };