mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-03-10 03:48:27 +00:00
* TS: enable strict-null * fix battle-scene.ts * fix voucher.ts * adapt more files to strict-null * adapt more files to strict-null ( 2) * adapt ability.ts to strict-null * adapt `arena.ts` to strict-null * adapt TagAddedEvent constructor to strict-null * adapt phases.ts.to strict-null * adapt status-effect.ts to strict-null * adapt `account.ts` to strict-null * adapt `configHandler.ts` to strict-null * adapt `ability.ts` to strict-null * adapt `biomes.ts` to strict-null * adapt `challenge.ts` to strict-null * adapt `daily-run.ts` to strict-null * adapt `nature.ts` to strict-null * adapt `pokemon-forms.ts` to strict-null * adapt `tainer-names.ts` to strict-null * adapt `types.ts` to strict-null * adapt `weather.ts` to strict-null * adapt `egg-hatch-phase.ts` to strict-null * adapt `evolution-phase.ts` to strict-null * adapt `pokemon-sprite-sparkle-handler.ts` to strict-null * adapt `evolution-phase.ts` to strict-null * adapt `game-mode.ts` to strict-null * adapt `utils.ts` to strict-null * adapt `voucher-ui-handler.ts` to strict-null * adapt `src/ui/unavailable-modal-ui-handler.ts` to strict-null * adapt `src/ui/ui.ts` to strict-null * adapt `src/ui/ui-theme.ts` to strict-null * adapt `src/ui/title-ui-handler.ts` to strict-null * adapt `src/ui/time-of-day-widget.ts` to strict-null * adapt `src/ui/text.ts` to strict-null * adapt `src/ui/target-select-ui-handler.ts` to strict-null * adapt `src/ui/settings/settings-keyboard-ui-handler.ts` to strict-null * adapt more files to strict-null (3) * adapt more files to strict-null (4) * adapt more files (mostly tests) to strict-null (5) * adapt more files to strict-null (6) * adapt more files to strict-null (7) * Update `src/data/pokemon-evolutions.ts` for strict-null Partial update `src/data/pokemon-species.ts` for strict-null * adapt more files to strict-null (8) * adapt more files to strict-null (9) * Strict some more nulls (still a few errors remaining) * adapt rest of the files to strict-null (9) * fix tests (check for null instead of undefined) * repalce a lot of `??` with bangs And added TODO notice as usual * fix more tests * all tests pass now * fix broken game-loop after trainer battle add some console.warn for missing cases and falling back to default * remove guessed fallback from utils.rgbHexToRgba * add TODO for this.currentBattle = null * adjust getPokemonById() return to include `null` * fix compilation errors * add test for pokemon.trySetStatus * `chanceMultiplier` shouldn't be optional * allow `null` for currentPhase * adjust hasExpSprite logic for no keymatch found * reduce bang usage in account.updateUserInfo() * fix new strict-null issues after merge * fix `strict-null` issues in dropdown.ts and sand_spit.test.ts * fix egg-gacha * adapt gul_missile.test.ts to strict-null * fix move.ts strict-null * fix i18n.ts strict-null * fix strict-null issues * fix baton_pass test after accidentially breaking it * chore: fix compiler errors * revert accidential changes in baton_pass.test.ts --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
209 lines
4.0 KiB
TypeScript
209 lines
4.0 KiB
TypeScript
import MockTextureManager from "#test/utils/mocks/mockTextureManager";
|
|
import { MockGameObject } from "../mockGameObject";
|
|
|
|
export default class MockContainer implements MockGameObject {
|
|
protected x;
|
|
protected y;
|
|
protected scene;
|
|
protected width;
|
|
protected height;
|
|
protected visible;
|
|
private alpha;
|
|
private style;
|
|
public frame;
|
|
protected textureManager;
|
|
public list: MockGameObject[] = [];
|
|
|
|
constructor(textureManager: MockTextureManager, x, y) {
|
|
this.x = x;
|
|
this.y = y;
|
|
this.frame = {};
|
|
this.textureManager = textureManager;
|
|
}
|
|
setVisible(visible) {
|
|
this.visible = visible;
|
|
}
|
|
|
|
once(event, callback, source) {
|
|
}
|
|
|
|
off(event, callback, source) {
|
|
}
|
|
|
|
removeFromDisplayList() {
|
|
// same as remove or destroy
|
|
}
|
|
|
|
addedToScene() {
|
|
// This callback is invoked when this Game Object is added to a Scene.
|
|
}
|
|
|
|
setSize(width, height) {
|
|
// Sets the size of this Game Object.
|
|
}
|
|
|
|
setMask() {
|
|
/// Sets the mask that this Game Object will use to render with.
|
|
}
|
|
|
|
setPositionRelative(source, x, y) {
|
|
/// Sets the position of this Game Object to be a relative position from the source Game Object.
|
|
}
|
|
|
|
setInteractive(hitArea?, callback?, dropZone?) {
|
|
/// Sets the InteractiveObject to be a drop zone for a drag and drop operation.
|
|
}
|
|
setOrigin(x, y) {
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
|
|
setAlpha(alpha) {
|
|
this.alpha = alpha;
|
|
}
|
|
|
|
setFrame(frame, updateSize?: boolean, updateOrigin?: boolean) {
|
|
// Sets the frame this Game Object will use to render with.
|
|
}
|
|
|
|
setScale(scale) {
|
|
// Sets the scale of this Game Object.
|
|
}
|
|
|
|
setPosition(x, y) {
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
|
|
setX(x) {
|
|
this.x = x;
|
|
}
|
|
|
|
setY(y) {
|
|
this.y = y;
|
|
}
|
|
|
|
destroy() {
|
|
this.list = [];
|
|
}
|
|
|
|
setShadow(shadowXpos, shadowYpos, shadowColor) {
|
|
// Sets the shadow settings for this Game Object.
|
|
}
|
|
|
|
setLineSpacing(lineSpacing) {
|
|
// Sets the line spacing value of this Game Object.
|
|
}
|
|
|
|
setText(text) {
|
|
// Sets the text this Game Object will display.
|
|
}
|
|
|
|
setAngle(angle) {
|
|
// Sets the angle of this Game Object.
|
|
}
|
|
|
|
setShadowOffset(offsetX, offsetY) {
|
|
// Sets the shadow offset values.
|
|
}
|
|
|
|
setWordWrapWidth(width) {
|
|
// Sets the width (in pixels) to use for wrapping lines.
|
|
}
|
|
|
|
setFontSize(fontSize) {
|
|
// Sets the font size of this Game Object.
|
|
}
|
|
getBounds() {
|
|
return { width: this.width, height: this.height };
|
|
}
|
|
|
|
setColor(color) {
|
|
// Sets the tint of this Game Object.
|
|
}
|
|
|
|
setShadowColor(color) {
|
|
// Sets the shadow color.
|
|
}
|
|
|
|
setTint(color) {
|
|
// Sets the tint of this Game Object.
|
|
}
|
|
|
|
setStrokeStyle(thickness, color) {
|
|
// Sets the stroke style for the graphics.
|
|
return this;
|
|
}
|
|
|
|
setDepth(depth) {
|
|
// Sets the depth of this Game Object.
|
|
}
|
|
|
|
setTexture(texture) {
|
|
// Sets the texture this Game Object will use to render with.
|
|
}
|
|
|
|
clearTint() {
|
|
// Clears any previously set tint.
|
|
}
|
|
|
|
sendToBack() {
|
|
// Sends this Game Object to the back of its parent's display list.
|
|
}
|
|
|
|
moveAbove(obj) {
|
|
// Moves this Game Object to be above the given Game Object in the display list.
|
|
}
|
|
|
|
moveBelow(obj) {
|
|
// Moves this Game Object to be below the given Game Object in the display list.
|
|
}
|
|
|
|
setName(name) {
|
|
// return this.phaserSprite.setName(name);
|
|
}
|
|
|
|
bringToTop(obj) {
|
|
// Brings this Game Object to the top of its parents display list.
|
|
}
|
|
|
|
on(event, callback, source) {
|
|
}
|
|
|
|
add(obj) {
|
|
// Adds a child to this Game Object.
|
|
this.list.push(obj);
|
|
}
|
|
|
|
removeAll() {
|
|
// Removes all Game Objects from this Container.
|
|
this.list = [];
|
|
}
|
|
|
|
addAt(obj, index) {
|
|
// Adds a Game Object to this Container at the given index.
|
|
this.list.splice(index, 0, obj);
|
|
}
|
|
|
|
remove(obj) {
|
|
const index = this.list.indexOf(obj);
|
|
if (index !== -1) {
|
|
this.list.splice(index, 1);
|
|
}
|
|
}
|
|
|
|
getIndex(obj) {
|
|
const index = this.list.indexOf(obj);
|
|
return index || -1;
|
|
}
|
|
|
|
getAt(index) {
|
|
return this.list[index];
|
|
}
|
|
|
|
getAll() {
|
|
return this.list;
|
|
}
|
|
|
|
}
|