mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 00:52:47 +02:00
Re-apply to SpeciesFormChangeStatusEffectTrigger
constructor
Apply to new instances in test mocks
This commit is contained in:
parent
be080b505b
commit
5e2fd4ef00
@ -1,5 +1,5 @@
|
||||
import i18next from "i18next";
|
||||
import type { Constructor } from "#app/utils/common";
|
||||
import { coerceArray, type Constructor } from "#app/utils/common";
|
||||
import type { TimeOfDay } from "#enums/time-of-day";
|
||||
import type Pokemon from "#app/field/pokemon";
|
||||
import type { SpeciesFormChange } from "#app/data/pokemon-forms";
|
||||
@ -125,10 +125,7 @@ export class SpeciesFormChangeStatusEffectTrigger extends SpeciesFormChangeTrigg
|
||||
|
||||
constructor(statusEffects: StatusEffect | StatusEffect[], invert = false) {
|
||||
super();
|
||||
if (!Array.isArray(statusEffects)) {
|
||||
statusEffects = [statusEffects];
|
||||
}
|
||||
this.statusEffects = statusEffects;
|
||||
this.statusEffects = coerceArray(statusEffects);
|
||||
this.invert = invert;
|
||||
// this.description = i18next.t("pokemonEvolutions:Forms.statusEffect");
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { coerceArray } from "#app/utils/common";
|
||||
import type MockTextureManager from "#test/testUtils/mocks/mockTextureManager";
|
||||
import type { MockGameObject } from "../mockGameObject";
|
||||
|
||||
@ -216,11 +217,7 @@ export default class MockContainer implements MockGameObject {
|
||||
}
|
||||
|
||||
add(obj: MockGameObject | MockGameObject[]): this {
|
||||
if (Array.isArray(obj)) {
|
||||
this.list.push(...obj);
|
||||
} else {
|
||||
this.list.push(obj);
|
||||
}
|
||||
this.list.push(...coerceArray(obj));
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -232,18 +229,12 @@ export default class MockContainer implements MockGameObject {
|
||||
|
||||
addAt(obj: MockGameObject | MockGameObject[], index = 0): this {
|
||||
// Adds a Game Object to this Container at the given index.
|
||||
if (!Array.isArray(obj)) {
|
||||
obj = [obj];
|
||||
}
|
||||
this.list.splice(index, 0, ...obj);
|
||||
this.list.splice(index, 0, ...coerceArray(obj));
|
||||
return this;
|
||||
}
|
||||
|
||||
remove(obj: MockGameObject | MockGameObject[], destroyChild = false): this {
|
||||
if (!Array.isArray(obj)) {
|
||||
obj = [obj];
|
||||
}
|
||||
for (const item of obj) {
|
||||
for (const item of coerceArray(obj)) {
|
||||
const index = this.list.indexOf(item);
|
||||
if (index !== -1) {
|
||||
this.list.splice(index, 1);
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { coerceArray } from "#app/utils/common";
|
||||
import type { MockGameObject } from "../mockGameObject";
|
||||
|
||||
export default class MockRectangle implements MockGameObject {
|
||||
@ -50,11 +51,7 @@ export default class MockRectangle implements MockGameObject {
|
||||
|
||||
add(obj: MockGameObject | MockGameObject[]): this {
|
||||
// Adds a child to this Game Object.
|
||||
if (Array.isArray(obj)) {
|
||||
this.list.push(...obj);
|
||||
} else {
|
||||
this.list.push(obj);
|
||||
}
|
||||
this.list.push(...coerceArray(obj));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { coerceArray } from "#app/utils/common";
|
||||
import Phaser from "phaser";
|
||||
import type { MockGameObject } from "../mockGameObject";
|
||||
import Frame = Phaser.Textures.Frame;
|
||||
|
||||
type Frame = Phaser.Textures.Frame;
|
||||
|
||||
export default class MockSprite implements MockGameObject {
|
||||
private phaserSprite;
|
||||
@ -204,11 +206,7 @@ export default class MockSprite implements MockGameObject {
|
||||
|
||||
add(obj: MockGameObject | MockGameObject[]): this {
|
||||
// Adds a child to this Game Object.
|
||||
if (Array.isArray(obj)) {
|
||||
this.list.push(...obj);
|
||||
} else {
|
||||
this.list.push(obj);
|
||||
}
|
||||
this.list.push(...coerceArray(obj));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user