Make EXP boosting items stack additively and not multiplicatively (#3094)
Fixes #2040
This commit is contained in:
parent
cc6b424813
commit
ecbf7570b3
|
@ -1774,7 +1774,7 @@ export class PokemonExpBoosterModifier extends PokemonHeldItemModifier {
|
|||
}
|
||||
|
||||
apply(args: any[]): boolean {
|
||||
(args[1] as Utils.NumberHolder).value = Math.floor((args[1] as Utils.NumberHolder).value * (1 + (this.getStackCount() * this.boostMultiplier)));
|
||||
(args[1] as Utils.NumberHolder).value += (this.getStackCount() * this.boostMultiplier);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -3927,7 +3927,9 @@ export class VictoryPhase extends PokemonPhase {
|
|||
expMultiplier = Overrides.XP_MULTIPLIER_OVERRIDE;
|
||||
}
|
||||
const pokemonExp = new Utils.NumberHolder(expValue * expMultiplier);
|
||||
this.scene.applyModifiers(PokemonExpBoosterModifier, true, partyMember, pokemonExp);
|
||||
const modifierBonusExp = new Utils.NumberHolder(1);
|
||||
this.scene.applyModifiers(PokemonExpBoosterModifier, true, partyMember, modifierBonusExp);
|
||||
pokemonExp.value *= modifierBonusExp.value;
|
||||
partyMemberExp.push(Math.floor(pokemonExp.value));
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import Phase from "phaser";
|
||||
import GameManager from "#app/test/utils/gameManager";
|
||||
import overrides from "#app/overrides";
|
||||
import { Abilities } from "#app/enums/abilities.js";
|
||||
import { PokemonExpBoosterModifier } from "#app/modifier/modifier.js";
|
||||
import * as Utils from "#app/utils";
|
||||
|
||||
describe("EXP Modifier Items", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
let game: GameManager;
|
||||
|
||||
beforeAll(() => {
|
||||
phaserGame = new Phase.Game({
|
||||
type: Phaser.HEADLESS,
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
game.phaseInterceptor.restoreOg();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
game = new GameManager(phaserGame);
|
||||
|
||||
vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH);
|
||||
vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH);
|
||||
vi.spyOn(overrides, "SINGLE_BATTLE_OVERRIDE", "get").mockReturnValue(true);
|
||||
});
|
||||
|
||||
it("EXP booster items stack additively", async() => {
|
||||
vi.spyOn(overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "LUCKY_EGG"}, {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);
|
||||
}, 20000);
|
||||
});
|
Loading…
Reference in New Issue