mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-02-06 16:17:33 +00:00
78 lines
2.6 KiB
TypeScript
78 lines
2.6 KiB
TypeScript
|
import { ArenaTagSide } from "#app/data/arena-tag.js";
|
||
|
import { ArenaTagType } from "#app/data/enums/arena-tag-type.js";
|
||
|
import { TerrainType } from "#app/data/terrain.js";
|
||
|
import { WeatherType } from "#app/data/weather.js";
|
||
|
|
||
|
/** Alias for all {@linkcode ArenaEvent} type strings */
|
||
|
export enum ArenaEventType {
|
||
|
/** Triggers when a {@linkcode WeatherType} is added, overlapped, or removed */
|
||
|
WEATHER_CHANGED = "onWeatherChanged",
|
||
|
/** Triggers when a {@linkcode TerrainType} is added, overlapped, or removed */
|
||
|
TERRAIN_CHANGED = "onTerrainChanged",
|
||
|
|
||
|
/** Triggers when a {@linkcode ArenaTagType} is added or removed */
|
||
|
TAG_CHANGED = "onTagChanged",
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Base container class for all {@linkcode ArenaEventType} events
|
||
|
* @extends Event
|
||
|
*/
|
||
|
export class ArenaEvent extends Event {
|
||
|
/** The total duration of the {@linkcode ArenaEventType} */
|
||
|
public duration: number;
|
||
|
constructor(eventType: ArenaEventType, duration: number) {
|
||
|
super(eventType);
|
||
|
|
||
|
this.duration = duration;
|
||
|
}
|
||
|
}
|
||
|
/**
|
||
|
* Container class for {@linkcode ArenaEventType.WEATHER_CHANGED} events
|
||
|
* @extends ArenaEvent
|
||
|
*/
|
||
|
export class WeatherChangedEvent extends ArenaEvent {
|
||
|
/** The {@linkcode WeatherType} being overridden */
|
||
|
public oldWeatherType: WeatherType;
|
||
|
/** The {@linkcode WeatherType} being set */
|
||
|
public newWeatherType: WeatherType;
|
||
|
constructor(oldWeatherType: WeatherType, newWeatherType: WeatherType, duration: number) {
|
||
|
super(ArenaEventType.WEATHER_CHANGED, duration);
|
||
|
|
||
|
this.oldWeatherType = oldWeatherType;
|
||
|
this.newWeatherType = newWeatherType;
|
||
|
}
|
||
|
}
|
||
|
/**
|
||
|
* Container class for {@linkcode ArenaEventType.TERRAIN_CHANGED} events
|
||
|
* @extends ArenaEvent
|
||
|
*/
|
||
|
export class TerrainChangedEvent extends ArenaEvent {
|
||
|
/** The {@linkcode TerrainType} being overridden */
|
||
|
public oldTerrainType: TerrainType;
|
||
|
/** The {@linkcode TerrainType} being set */
|
||
|
public newTerrainType: TerrainType;
|
||
|
constructor(oldTerrainType: TerrainType, newTerrainType: TerrainType, duration: number) {
|
||
|
super(ArenaEventType.TERRAIN_CHANGED, duration);
|
||
|
|
||
|
this.oldTerrainType = oldTerrainType;
|
||
|
this.newTerrainType = newTerrainType;
|
||
|
}
|
||
|
}
|
||
|
/**
|
||
|
* Container class for {@linkcode ArenaEventType.TAG_CHANGED} events
|
||
|
* @extends ArenaEvent
|
||
|
*/
|
||
|
export class TagChangedEvent extends ArenaEvent {
|
||
|
/** The {@linkcode ArenaTagType} being set */
|
||
|
public arenaTagType: ArenaTagType;
|
||
|
/** The {@linkcode ArenaTagSide} the tag is being placed on */
|
||
|
public arenaTagSide: ArenaTagSide;
|
||
|
constructor(arenaTagType: ArenaTagType, arenaTagSide: ArenaTagSide, duration: number) {
|
||
|
super(ArenaEventType.TAG_CHANGED, duration);
|
||
|
|
||
|
this.arenaTagType = arenaTagType;
|
||
|
this.arenaTagSide = arenaTagSide;
|
||
|
}
|
||
|
}
|