Merge branch 'beta' into mystery-encounters-translations

This commit is contained in:
Lugiad 2024-09-11 23:04:27 +02:00 committed by GitHub
commit cad3e7261b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 19 additions and 25 deletions

View File

@ -357,7 +357,7 @@ export default class Trainer extends Phaser.GameObjects.Container {
// If useNewSpeciesPool is true, we need to generate a new species from the new species pool, otherwise we generate a random species // If useNewSpeciesPool is true, we need to generate a new species from the new species pool, otherwise we generate a random species
let species = useNewSpeciesPool let species = useNewSpeciesPool
? getPokemonSpecies(newSpeciesPool[Math.floor(Math.random() * newSpeciesPool.length)]) ? getPokemonSpecies(newSpeciesPool[Math.floor(Utils.randSeedInt(newSpeciesPool.length))])
: template.isSameSpecies(index) && index > offset : template.isSameSpecies(index) && index > offset
? getPokemonSpecies(battle.enemyParty[offset].species.getTrainerSpeciesForLevel(level, false, template.getStrength(offset), this.scene.currentBattle.waveIndex)) ? getPokemonSpecies(battle.enemyParty[offset].species.getTrainerSpeciesForLevel(level, false, template.getStrength(offset), this.scene.currentBattle.waveIndex))
: this.genNewPartyMemberSpecies(level, strength); : this.genNewPartyMemberSpecies(level, strength);

View File

@ -41,7 +41,7 @@ window.URL.createObjectURL = (blob: Blob) => {
}); });
return null; return null;
}; };
navigator.getGamepads = vi.fn().mockReturnValue([]); navigator.getGamepads = () => [];
global.fetch = vi.fn(MockFetch); global.fetch = vi.fn(MockFetch);
Utils.setCookie(Utils.sessionIdKey, 'fake_token'); Utils.setCookie(Utils.sessionIdKey, 'fake_token');

View File

@ -1,4 +1,3 @@
import { vi } from "vitest";
import MockGraphics from "./mocksContainer/mockGraphics"; import MockGraphics from "./mocksContainer/mockGraphics";
import MockTextureManager from "./mockTextureManager"; import MockTextureManager from "./mockTextureManager";
@ -16,8 +15,8 @@ export class MockGameObjectCreator {
rexTransitionImagePack() { rexTransitionImagePack() {
return { return {
transit: vi.fn(), transit: () => null,
once: vi.fn(), once: () => null,
}; };
} }
} }

View File

@ -1,13 +1,12 @@
import { vi } from "vitest";
import { MockGameObject } from "./mockGameObject"; import { MockGameObject } from "./mockGameObject";
/** Mocks video-related stuff */ /** Mocks video-related stuff */
export class MockVideoGameObject implements MockGameObject { export class MockVideoGameObject implements MockGameObject {
constructor() {} constructor() {}
public play = vi.fn(); public play = () => null;
public stop = vi.fn(() => this); public stop = () => this;
public setOrigin = vi.fn(); public setOrigin = () => null;
public setScale = vi.fn(); public setScale = () => null;
public setVisible = vi.fn(); public setVisible = () => null;
} }

View File

@ -1,5 +1,4 @@
import MockTextureManager from "#test/utils/mocks/mockTextureManager"; import MockTextureManager from "#test/utils/mocks/mockTextureManager";
import { vi } from "vitest";
import { MockGameObject } from "../mockGameObject"; import { MockGameObject } from "../mockGameObject";
export default class MockContainer implements MockGameObject { export default class MockContainer implements MockGameObject {
@ -52,7 +51,7 @@ export default class MockContainer implements MockGameObject {
/// Sets the position of this Game Object to be a relative position from the source Game Object. /// Sets the position of this Game Object to be a relative position from the source Game Object.
} }
setInteractive = vi.fn(); setInteractive = () => null;
setOrigin(x, y) { setOrigin(x, y) {
this.x = x; this.x = x;
@ -160,10 +159,9 @@ export default class MockContainer implements MockGameObject {
// Moves this Game Object to be below the given Game Object in the display list. // Moves this Game Object to be below the given Game Object in the display list.
} }
setName = vi.fn((name: string) => { setName = (name: string) => {
this.name = name; this.name = name;
// return this.phaserSprite.setName(name); };
});
bringToTop(obj) { bringToTop(obj) {
// Brings this Game Object to the top of its parents display list. // Brings this Game Object to the top of its parents display list.
@ -207,5 +205,5 @@ export default class MockContainer implements MockGameObject {
return this.list; return this.list;
} }
disableInteractive = vi.fn(); disableInteractive = () => null;
} }

View File

@ -1,6 +1,5 @@
import Phaser from "phaser"; import Phaser from "phaser";
import { MockGameObject } from "../mockGameObject"; import { MockGameObject } from "../mockGameObject";
import { vi } from "vitest";
import Sprite = Phaser.GameObjects.Sprite; import Sprite = Phaser.GameObjects.Sprite;
import Frame = Phaser.Textures.Frame; import Frame = Phaser.Textures.Frame;
@ -102,7 +101,7 @@ export default class MockSprite implements MockGameObject {
return this.phaserSprite.stop(); return this.phaserSprite.stop();
} }
setInteractive = vi.fn(); setInteractive = () => null;
on(event, callback, source) { on(event, callback, source) {
return this.phaserSprite.on(event, callback, source); return this.phaserSprite.on(event, callback, source);

View File

@ -1,5 +1,4 @@
import UI from "#app/ui/ui"; import UI from "#app/ui/ui";
import { vi } from "vitest";
import { MockGameObject } from "../mockGameObject"; import { MockGameObject } from "../mockGameObject";
export default class MockText implements MockGameObject { export default class MockText implements MockGameObject {
@ -193,11 +192,11 @@ export default class MockText implements MockGameObject {
}; };
} }
setColor = vi.fn((color: string) => { setColor = (color: string) => {
this.color = color; this.color = color;
}); };
setInteractive = vi.fn(); setInteractive = () => null;
setShadowColor(color) { setShadowColor(color) {
// Sets the shadow color. // Sets the shadow color.
@ -223,9 +222,9 @@ export default class MockText implements MockGameObject {
// return this.phaserText.setAlpha(alpha); // return this.phaserText.setAlpha(alpha);
} }
setName = vi.fn((name: string) => { setName = (name: string) => {
this.name = name; this.name = name;
}); };
setAlign(align) { setAlign(align) {
// return this.phaserText.setAlign(align); // return this.phaserText.setAlign(align);