Skip to content

Commit

Permalink
Revert egg additive/multiplicative change and change endless biome ro…
Browse files Browse the repository at this point in the history
…tation for every 5 waves. (pagefaultgames#3415)

Co-authored-by: snoozbuster <snoozbuster@outlook.com>
  • Loading branch information
f-fsantos and snoozbuster authored Aug 7, 2024
1 parent 94c1c92 commit 8783fd8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 31 deletions.
26 changes: 5 additions & 21 deletions src/battle-scene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/modifier/modifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 1 addition & 3 deletions src/phases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
11 changes: 6 additions & 5 deletions src/test/items/exp_booster.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
3 changes: 2 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export const defaultConfig = {
}
warn(warning);
},
}
},
appType: "mpa",
};


Expand Down

0 comments on commit 8783fd8

Please sign in to comment.