mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-03 23:12:20 +02:00
Merge branch 'beta' into finish-buff-punish-moves
This commit is contained in:
commit
a6269175a9
@ -251,8 +251,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
this.shiny = false;
|
||||
}
|
||||
|
||||
if (!dataSource) {
|
||||
this.calculateStats();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
getNameToRender() {
|
||||
|
@ -293,7 +293,7 @@ export class TitlePhase extends Phase {
|
||||
}
|
||||
|
||||
for (const achv of Object.keys(this.scene.gameData.achvUnlocks)) {
|
||||
if (vouchers.hasOwnProperty(achv)) {
|
||||
if (vouchers.hasOwnProperty(achv) && achv !== "CLASSIC_VICTORY") {
|
||||
this.scene.validateVoucher(vouchers[achv]);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,11 @@
|
||||
import { pokemonEvolutions, SpeciesFormEvolution, SpeciesWildEvolutionDelay } from "#app/data/pokemon-evolutions";
|
||||
import { Abilities } from "#app/enums/abilities";
|
||||
import { Moves } from "#app/enums/moves";
|
||||
import { Species } from "#app/enums/species";
|
||||
import GameManager from "#test/utils/gameManager";
|
||||
import Phaser from "phaser";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
import { SPLASH_ONLY } from "./utils/testUtils";
|
||||
|
||||
describe("Evolution", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
@ -89,4 +91,61 @@ describe("Evolution", () => {
|
||||
|
||||
expect(speciesFormEvo.wildDelay).toBe(SpeciesWildEvolutionDelay.NONE);
|
||||
});
|
||||
|
||||
it("should increase both HP and max HP when evolving", async () => {
|
||||
game.override.moveset([Moves.SURF])
|
||||
.enemySpecies(Species.GOLEM)
|
||||
.enemyMoveset(SPLASH_ONLY)
|
||||
.startingWave(21)
|
||||
.startingLevel(16)
|
||||
.enemyLevel(50);
|
||||
|
||||
await game.startBattle([Species.TOTODILE]);
|
||||
|
||||
const totodile = game.scene.getPlayerPokemon()!;
|
||||
const hpBefore = totodile.hp;
|
||||
|
||||
expect(totodile.hp).toBe(totodile.getMaxHp());
|
||||
|
||||
const golem = game.scene.getEnemyPokemon()!;
|
||||
golem.hp = 1;
|
||||
|
||||
expect(golem.hp).toBe(1);
|
||||
|
||||
game.move.select(Moves.SURF);
|
||||
await game.phaseInterceptor.to("EndEvolutionPhase");
|
||||
|
||||
expect(totodile.hp).toBe(totodile.getMaxHp());
|
||||
expect(totodile.hp).toBeGreaterThan(hpBefore);
|
||||
}, TIMEOUT);
|
||||
|
||||
it("should not fully heal HP when evolving", async () => {
|
||||
game.override.moveset([Moves.SURF])
|
||||
.enemySpecies(Species.GOLEM)
|
||||
.enemyMoveset(SPLASH_ONLY)
|
||||
.startingWave(21)
|
||||
.startingLevel(13)
|
||||
.enemyLevel(30);
|
||||
|
||||
await game.startBattle([Species.CYNDAQUIL]);
|
||||
|
||||
const cyndaquil = game.scene.getPlayerPokemon()!;
|
||||
cyndaquil.hp = Math.floor(cyndaquil.getMaxHp() / 2);
|
||||
const hpBefore = cyndaquil.hp;
|
||||
const maxHpBefore = cyndaquil.getMaxHp();
|
||||
|
||||
expect(cyndaquil.hp).toBe(Math.floor(cyndaquil.getMaxHp() / 2));
|
||||
|
||||
const golem = game.scene.getEnemyPokemon()!;
|
||||
golem.hp = 1;
|
||||
|
||||
expect(golem.hp).toBe(1);
|
||||
|
||||
game.move.select(Moves.SURF);
|
||||
await game.phaseInterceptor.to("EndEvolutionPhase");
|
||||
|
||||
expect(cyndaquil.getMaxHp()).toBeGreaterThan(maxHpBefore);
|
||||
expect(cyndaquil.hp).toBeGreaterThan(hpBefore);
|
||||
expect(cyndaquil.hp).toBeLessThan(cyndaquil.getMaxHp());
|
||||
}, TIMEOUT);
|
||||
});
|
||||
|
@ -7,6 +7,8 @@ import MockSprite from "#test/utils/mocks/mocksContainer/mockSprite";
|
||||
import MockText from "#test/utils/mocks/mocksContainer/mockText";
|
||||
import MockTexture from "#test/utils/mocks/mocksContainer/mockTexture";
|
||||
import { MockGameObject } from "./mockGameObject";
|
||||
import { vi } from "vitest";
|
||||
import { MockVideoGameObject } from "./mockVideoGameObject";
|
||||
|
||||
/**
|
||||
* Stub class for Phaser.Textures.TextureManager
|
||||
@ -34,6 +36,7 @@ export default class MockTextureManager {
|
||||
text: this.text.bind(this),
|
||||
bitmapText: this.text.bind(this),
|
||||
displayList: this.displayList,
|
||||
video: vi.fn(() => new MockVideoGameObject()),
|
||||
};
|
||||
}
|
||||
|
||||
|
13
src/test/utils/mocks/mockVideoGameObject.ts
Normal file
13
src/test/utils/mocks/mockVideoGameObject.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { vi } from "vitest";
|
||||
import { MockGameObject } from "./mockGameObject";
|
||||
|
||||
/** Mocks video-related stuff */
|
||||
export class MockVideoGameObject implements MockGameObject {
|
||||
constructor() {}
|
||||
|
||||
public play = vi.fn();
|
||||
public stop = vi.fn(() => this);
|
||||
public setOrigin = vi.fn();
|
||||
public setScale = vi.fn();
|
||||
public setVisible = vi.fn();
|
||||
}
|
@ -6,7 +6,9 @@ import { CommandPhase } from "#app/phases/command-phase";
|
||||
import { DamagePhase } from "#app/phases/damage-phase";
|
||||
import { EggLapsePhase } from "#app/phases/egg-lapse-phase";
|
||||
import { EncounterPhase } from "#app/phases/encounter-phase";
|
||||
import { EndEvolutionPhase } from "#app/phases/end-evolution-phase";
|
||||
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase";
|
||||
import { EvolutionPhase } from "#app/phases/evolution-phase";
|
||||
import { FaintPhase } from "#app/phases/faint-phase";
|
||||
import { LoginPhase } from "#app/phases/login-phase";
|
||||
import { MessagePhase } from "#app/phases/message-phase";
|
||||
@ -92,6 +94,8 @@ export default class PhaseInterceptor {
|
||||
[SwitchPhase, this.startPhase],
|
||||
[SwitchSummonPhase, this.startPhase],
|
||||
[PartyHealPhase, this.startPhase],
|
||||
[EvolutionPhase, this.startPhase],
|
||||
[EndEvolutionPhase, this.startPhase],
|
||||
];
|
||||
|
||||
private endBySetMode = [
|
||||
|
Loading…
Reference in New Issue
Block a user