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
let species = useNewSpeciesPool
? getPokemonSpecies(newSpeciesPool[Math.floor(Math.random() * newSpeciesPool.length)])
? getPokemonSpecies(newSpeciesPool[Math.floor(Utils.randSeedInt(newSpeciesPool.length))])
: template.isSameSpecies(index) && index > offset
? getPokemonSpecies(battle.enemyParty[offset].species.getTrainerSpeciesForLevel(level, false, template.getStrength(offset), this.scene.currentBattle.waveIndex))
: this.genNewPartyMemberSpecies(level, strength);

View File

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

View File

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

View File

@ -1,13 +1,12 @@
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();
public play = () => null;
public stop = () => this;
public setOrigin = () => null;
public setScale = () => null;
public setVisible = () => null;
}

View File

@ -1,5 +1,4 @@
import MockTextureManager from "#test/utils/mocks/mockTextureManager";
import { vi } from "vitest";
import { MockGameObject } from "../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.
}
setInteractive = vi.fn();
setInteractive = () => null;
setOrigin(x, y) {
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.
}
setName = vi.fn((name: string) => {
setName = (name: string) => {
this.name = name;
// return this.phaserSprite.setName(name);
});
};
bringToTop(obj) {
// 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;
}
disableInteractive = vi.fn();
disableInteractive = () => null;
}

View File

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

View File

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