fix tests

This commit is contained in:
Moka 2024-11-09 13:21:24 +01:00
parent 8ed40dd0c8
commit de4d031602
6 changed files with 19 additions and 5 deletions

View File

@ -123,9 +123,7 @@ export const UncommonBreedEncounter: MysteryEncounter =
yoyo: true,
y: "-=20",
loop: 1,
onComplete: () => {
encounter.introVisuals?.playShinySparkles();
}
onComplete: () => encounter.introVisuals?.playShinySparkles()
});
scene.time.delayedCall(500, () => scene.playSound("battle_anims/PRSFX- Spotlight2"));

View File

@ -665,6 +665,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
}
initShinySparkle(): void {
// TODO
const keySuffix = this.variant ? `_${this.variant + 1}` : "";
const key = `shiny${keySuffix}`;
const shinySparkle = this.scene.addFieldSprite(0, 0, key);

View File

@ -341,6 +341,7 @@ export class EggHatchPhase extends Phase {
this.pokemon.cry();
if (isShiny) {
this.scene.time.delayedCall(Utils.fixedInt(500), () => {
// TODO
this.pokemonShinySparkle.play(`sparkle${this.pokemon.variant ? `_${this.pokemon.variant + 1}` : ""}`);
this.scene.playSound("se/sparkle");
});

View File

@ -122,7 +122,7 @@ describe("The Pokemon Salesman - Mystery Encounter", () => {
});
});
it("Should update the player's money properly", async () => {
it("should update the player's money properly", async () => {
const initialMoney = 20000;
scene.money = initialMoney;
const updateMoneySpy = vi.spyOn(EncounterPhaseUtils, "updatePlayerMoney");
@ -136,7 +136,7 @@ describe("The Pokemon Salesman - Mystery Encounter", () => {
expect(scene.money).toBe(initialMoney - price);
});
it("Should add the Pokemon to the party", async () => {
it("should add the Pokemon to the party", async () => {
scene.money = 20000;
await game.runToMysteryEncounter(MysteryEncounterType.THE_POKEMON_SALESMAN, defaultParty);
@ -152,6 +152,18 @@ describe("The Pokemon Salesman - Mystery Encounter", () => {
expect(newlyPurchasedPokemon!.moveset.length > 0).toBeTruthy();
});
it("should give the purchased Pokemon its HA or make it shiny", async () => {
scene.money = 20000;
await game.runToMysteryEncounter(MysteryEncounterType.THE_POKEMON_SALESMAN, defaultParty);
await runMysteryEncounterToEnd(game, 1);
const newlyPurchasedPokemon = scene.getPlayerParty()[scene.getPlayerParty().length - 1];
const isshiny = newlyPurchasedPokemon.shiny;
const hasHA = newlyPurchasedPokemon.abilityIndex === 2;
expect(isshiny || hasHA).toBeTruthy();
expect(isshiny && hasHA).toBeFalsy();
});
it("should be disabled if player does not have enough money", async () => {
scene.money = 0;
await game.runToMysteryEncounter(MysteryEncounterType.THE_POKEMON_SALESMAN, defaultParty);

View File

@ -109,6 +109,7 @@ describe("The Strong Stuff - Mystery Encounter", () => {
species: getPokemonSpecies(Species.SHUCKLE),
isBoss: true,
bossSegments: 5,
shiny: false,
customPokemonData: new CustomPokemonData({ spriteScale: 1.25 }),
nature: Nature.BOLD,
moveSet: [ Moves.INFESTATION, Moves.SALT_CURE, Moves.GASTRO_ACID, Moves.HEAL_ORDER ],

View File

@ -92,6 +92,7 @@ describe("Trash to Treasure - Mystery Encounter", () => {
{
species: getPokemonSpecies(Species.GARBODOR),
isBoss: true,
shiny: false,
formIndex: 1,
bossSegmentModifier: 1,
moveSet: [ Moves.PAYBACK, Moves.GUNK_SHOT, Moves.STOMPING_TANTRUM, Moves.DRAIN_PUNCH ],