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, yoyo: true,
y: "-=20", y: "-=20",
loop: 1, loop: 1,
onComplete: () => { onComplete: () => encounter.introVisuals?.playShinySparkles()
encounter.introVisuals?.playShinySparkles();
}
}); });
scene.time.delayedCall(500, () => scene.playSound("battle_anims/PRSFX- Spotlight2")); 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 { initShinySparkle(): void {
// TODO
const keySuffix = this.variant ? `_${this.variant + 1}` : ""; const keySuffix = this.variant ? `_${this.variant + 1}` : "";
const key = `shiny${keySuffix}`; const key = `shiny${keySuffix}`;
const shinySparkle = this.scene.addFieldSprite(0, 0, key); const shinySparkle = this.scene.addFieldSprite(0, 0, key);

View File

@ -341,6 +341,7 @@ export class EggHatchPhase extends Phase {
this.pokemon.cry(); this.pokemon.cry();
if (isShiny) { if (isShiny) {
this.scene.time.delayedCall(Utils.fixedInt(500), () => { this.scene.time.delayedCall(Utils.fixedInt(500), () => {
// TODO
this.pokemonShinySparkle.play(`sparkle${this.pokemon.variant ? `_${this.pokemon.variant + 1}` : ""}`); this.pokemonShinySparkle.play(`sparkle${this.pokemon.variant ? `_${this.pokemon.variant + 1}` : ""}`);
this.scene.playSound("se/sparkle"); 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; const initialMoney = 20000;
scene.money = initialMoney; scene.money = initialMoney;
const updateMoneySpy = vi.spyOn(EncounterPhaseUtils, "updatePlayerMoney"); const updateMoneySpy = vi.spyOn(EncounterPhaseUtils, "updatePlayerMoney");
@ -136,7 +136,7 @@ describe("The Pokemon Salesman - Mystery Encounter", () => {
expect(scene.money).toBe(initialMoney - price); 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; scene.money = 20000;
await game.runToMysteryEncounter(MysteryEncounterType.THE_POKEMON_SALESMAN, defaultParty); await game.runToMysteryEncounter(MysteryEncounterType.THE_POKEMON_SALESMAN, defaultParty);
@ -152,6 +152,18 @@ describe("The Pokemon Salesman - Mystery Encounter", () => {
expect(newlyPurchasedPokemon!.moveset.length > 0).toBeTruthy(); 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 () => { it("should be disabled if player does not have enough money", async () => {
scene.money = 0; scene.money = 0;
await game.runToMysteryEncounter(MysteryEncounterType.THE_POKEMON_SALESMAN, defaultParty); await game.runToMysteryEncounter(MysteryEncounterType.THE_POKEMON_SALESMAN, defaultParty);

View File

@ -109,6 +109,7 @@ describe("The Strong Stuff - Mystery Encounter", () => {
species: getPokemonSpecies(Species.SHUCKLE), species: getPokemonSpecies(Species.SHUCKLE),
isBoss: true, isBoss: true,
bossSegments: 5, bossSegments: 5,
shiny: false,
customPokemonData: new CustomPokemonData({ spriteScale: 1.25 }), customPokemonData: new CustomPokemonData({ spriteScale: 1.25 }),
nature: Nature.BOLD, nature: Nature.BOLD,
moveSet: [ Moves.INFESTATION, Moves.SALT_CURE, Moves.GASTRO_ACID, Moves.HEAL_ORDER ], 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), species: getPokemonSpecies(Species.GARBODOR),
isBoss: true, isBoss: true,
shiny: false,
formIndex: 1, formIndex: 1,
bossSegmentModifier: 1, bossSegmentModifier: 1,
moveSet: [ Moves.PAYBACK, Moves.GUNK_SHOT, Moves.STOMPING_TANTRUM, Moves.DRAIN_PUNCH ], moveSet: [ Moves.PAYBACK, Moves.GUNK_SHOT, Moves.STOMPING_TANTRUM, Moves.DRAIN_PUNCH ],