mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-09-01 12:19:29 +02:00
Merge branch 'beta' into qol/adopt-me-for-create-test
This commit is contained in:
commit
833633c953
@ -162,10 +162,10 @@ export const BerriesAboundEncounter: MysteryEncounter =
|
||||
.withOptionPhase(async (scene: BattleScene) => {
|
||||
// Pick race for berries
|
||||
const encounter = scene.currentBattle.mysteryEncounter!;
|
||||
const fastestPokemon = encounter.misc.fastestPokemon;
|
||||
const enemySpeed = encounter.misc.enemySpeed;
|
||||
const fastestPokemon: PlayerPokemon = encounter.misc.fastestPokemon;
|
||||
const enemySpeed: number = encounter.misc.enemySpeed;
|
||||
const speedDiff = fastestPokemon.getStat(Stat.SPD) / (enemySpeed * 1.1);
|
||||
const numBerries = encounter.misc.numBerries;
|
||||
const numBerries: number = encounter.misc.numBerries;
|
||||
|
||||
const shopOptions: ModifierTypeOption[] = [];
|
||||
for (let i = 0; i < 5; i++) {
|
||||
|
@ -4749,8 +4749,15 @@ export class EnemyPokemon extends Pokemon {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Go through a boss' health segments and give stats boosts for each newly cleared segment
|
||||
* The base boost is 1 to a random stat that's not already maxed out per broken shield
|
||||
* For Pokemon with 3 health segments or more, breaking the last shield gives +2 instead
|
||||
* For Pokemon with 5 health segments or more, breaking the last two shields give +2 each
|
||||
* @param segmentIndex index of the segment to get down to (0 = no shield left, 1 = 1 shield left, etc.)
|
||||
*/
|
||||
handleBossSegmentCleared(segmentIndex: integer): void {
|
||||
while (segmentIndex - 1 < this.bossSegmentIndex) {
|
||||
while (this.bossSegmentIndex > 0 && segmentIndex - 1 < this.bossSegmentIndex) {
|
||||
// Filter out already maxed out stat stages and weigh the rest based on existing stats
|
||||
const leftoverStats = EFFECTIVE_STATS.filter((s: EffectiveStat) => this.getStatStage(s) < 6);
|
||||
const statWeights = leftoverStats.map((s: EffectiveStat) => this.getStat(s, false));
|
||||
|
@ -33,7 +33,7 @@ describe("Boss Pokemon / Shields", () => {
|
||||
.enemyMoveset(Moves.SPLASH)
|
||||
.enemyHeldItems([])
|
||||
.startingLevel(1000)
|
||||
.moveset([Moves.FALSE_SWIPE, Moves.SUPER_FANG, Moves.SPLASH])
|
||||
.moveset([Moves.FALSE_SWIPE, Moves.SUPER_FANG, Moves.SPLASH, Moves.PSYCHIC])
|
||||
.ability(Abilities.NO_GUARD);
|
||||
});
|
||||
|
||||
@ -196,6 +196,28 @@ describe("Boss Pokemon / Shields", () => {
|
||||
|
||||
});
|
||||
|
||||
it("the boss enduring does not proc an extra stat boost", async () => {
|
||||
game.override
|
||||
.enemyHealthSegments(2)
|
||||
.enemyAbility(Abilities.STURDY);
|
||||
|
||||
await game.classicMode.startBattle([ Species.MEWTWO ]);
|
||||
|
||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||
expect(enemyPokemon.isBoss()).toBe(true);
|
||||
expect(enemyPokemon.bossSegments).toBe(2);
|
||||
expect(getTotalStatStageBoosts(enemyPokemon)).toBe(0);
|
||||
|
||||
game.move.select(Moves.PSYCHIC);
|
||||
await game.toNextTurn();
|
||||
|
||||
// Enemy survived with Sturdy
|
||||
expect(enemyPokemon.bossSegmentIndex).toBe(0);
|
||||
expect(enemyPokemon.hp).toBe(1);
|
||||
expect(getTotalStatStageBoosts(enemyPokemon)).toBe(1);
|
||||
|
||||
}, TIMEOUT);
|
||||
|
||||
/**
|
||||
* Gets the sum of the effective stat stage boosts for the given Pokemon
|
||||
* @param enemyPokemon the pokemon to get stats from
|
||||
|
@ -19,7 +19,7 @@ import { CommandPhase } from "#app/phases/command-phase";
|
||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
||||
|
||||
const namespace = "mysteryEncounter:berriesAbound";
|
||||
const defaultParty = [Species.PYUKUMUKU];
|
||||
const defaultParty = [Species.PYUKUMUKU, Species.MAGIKARP, Species.PIKACHU];
|
||||
const defaultBiome = Biome.CAVE;
|
||||
const defaultWave = 45;
|
||||
|
||||
@ -116,7 +116,9 @@ describe("Berries Abound - Mystery Encounter", () => {
|
||||
expect(enemyField[0].species.speciesId).toBe(speciesToSpawn);
|
||||
});
|
||||
|
||||
// TODO: there is some severe test flakiness occurring for this file, needs to be looked at/addressed in separate issue
|
||||
/**
|
||||
* Related issue-comment: {@link https://github.com/pagefaultgames/pokerogue/issues/4300#issuecomment-2362849444}
|
||||
*/
|
||||
it("should reward the player with X berries based on wave", async () => {
|
||||
await game.runToMysteryEncounter(MysteryEncounterType.BERRIES_ABOUND, defaultParty);
|
||||
|
||||
@ -188,15 +190,14 @@ describe("Berries Abound - Mystery Encounter", () => {
|
||||
});
|
||||
|
||||
it("Should skip battle when fastest pokemon is faster than boss", async () => {
|
||||
const leaveEncounterWithoutBattleSpy = vi.spyOn(EncounterPhaseUtils, "leaveEncounterWithoutBattle");
|
||||
const encounterTextSpy = vi.spyOn(EncounterDialogueUtils, "showEncounterText");
|
||||
vi.spyOn(EncounterPhaseUtils, "leaveEncounterWithoutBattle");
|
||||
vi.spyOn(EncounterDialogueUtils, "showEncounterText");
|
||||
|
||||
await game.runToMysteryEncounter(MysteryEncounterType.BERRIES_ABOUND, defaultParty);
|
||||
|
||||
// Setting party pokemon's level arbitrarily high to outspeed
|
||||
const fastestPokemon = scene.getParty()[0];
|
||||
fastestPokemon.level = 1000;
|
||||
fastestPokemon.calculateStats();
|
||||
scene.getParty().forEach(pkm => {
|
||||
vi.spyOn(pkm, "getStat").mockReturnValue(9999); // for ease return for every stat
|
||||
});
|
||||
|
||||
await runMysteryEncounterToEnd(game, 2);
|
||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
||||
@ -210,8 +211,8 @@ describe("Berries Abound - Mystery Encounter", () => {
|
||||
expect(option.modifierTypeOption.type.id).toContain("BERRY");
|
||||
}
|
||||
|
||||
expect(encounterTextSpy).toHaveBeenCalledWith(expect.any(BattleScene), `${namespace}.option.2.selected`);
|
||||
expect(leaveEncounterWithoutBattleSpy).toBeCalled();
|
||||
expect(EncounterDialogueUtils.showEncounterText).toHaveBeenCalledWith(expect.any(BattleScene), `${namespace}.option.2.selected`);
|
||||
expect(EncounterPhaseUtils.leaveEncounterWithoutBattle).toBeCalled();
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user