pokerogue/src/battle-scene-events.ts

97 lines
2.5 KiB
TypeScript
Raw Normal View History

2024-05-24 17:01:47 -05:00
import Move from "./data/move";
/** Alias for all {@linkcode BattleScene} events */
2024-05-24 17:01:47 -05:00
export enum BattleSceneEventType {
/**
* Triggers when the corresponding setting is changed
* @see {@linkcode CandyUpgradeNotificationChangedEvent}
*/
CANDY_UPGRADE_NOTIFICATION_CHANGED = "onCandyUpgradeDisplayChanged",
/**
* Triggers when a move is successfully used
* @see {@linkcode MoveUsedEvent}
*/
MOVE_USED = "onMoveUsed",
/**
* Triggers on the first turn of a new battle
* @see {@linkcode TurnInitEvent}
*/
TURN_INIT = "onTurnInit",
/**
* Triggers after a turn ends in battle
* @see {@linkcode TurnEndEvent}
*/
TURN_END = "onTurnEnd",
/**
* Triggers when a new {@linkcode Arena} is created during initialization
* @see {@linkcode NewArenaEvent}
*/
NEW_ARENA = "onNewArena",
2024-05-24 17:01:47 -05:00
}
/**
* Container class for {@linkcode BattleSceneEventType.CANDY_UPGRADE_NOTIFICATION_CHANGED} events
* @extends Event
*/
export class CandyUpgradeNotificationChangedEvent extends Event {
/** The new value the setting was changed to */
public newValue: number;
constructor(newValue: number) {
super(BattleSceneEventType.CANDY_UPGRADE_NOTIFICATION_CHANGED);
this.newValue = newValue;
}
}
2024-05-24 17:01:47 -05:00
/**
* Container class for {@linkcode BattleSceneEventType.MOVE_USED} events
2024-05-24 17:01:47 -05:00
* @extends Event
*/
export class MoveUsedEvent extends Event {
/** The ID of the {@linkcode Pokemon} that used the {@linkcode Move} */
public userId: number;
/** The {@linkcode Move} used */
public move: Move;
/** The amount of PP used on the {@linkcode Move} this turn */
public ppUsed: number;
constructor(userId: number, move: Move, ppUsed: number) {
super(BattleSceneEventType.MOVE_USED);
this.userId = userId;
this.move = move;
this.ppUsed = ppUsed;
}
}
/**
* Container class for {@linkcode BattleSceneEventType.TURN_INIT} events
* @extends Event
*/
export class TurnInitEvent extends Event {
constructor() {
super(BattleSceneEventType.TURN_INIT);
}
}
/**
* Container class for {@linkcode BattleSceneEventType.TURN_END} events
* @extends Event
*/
export class TurnEndEvent extends Event {
/** The amount of turns in the current battle */
public turnCount: number;
constructor(turnCount: number) {
super(BattleSceneEventType.TURN_END);
this.turnCount = turnCount;
}
}
/**
* Container class for {@linkcode BattleSceneEventType.NEW_ARENA} events
* @extends Event
*/
export class NewArenaEvent extends Event {
constructor() {
super(BattleSceneEventType.NEW_ARENA);
}
}