mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-30 13:33:01 +02:00
Convert MoveUseMode
enum to const
object
This commit is contained in:
parent
93767f1550
commit
5c5da889d7
@ -11,12 +11,12 @@ import type { BattlerTagLapseType } from "#enums/battler-tag-lapse-type";
|
|||||||
* instead using the available helper functions
|
* instead using the available helper functions
|
||||||
* ({@linkcode isVirtual}, {@linkcode isIgnoreStatus}, {@linkcode isIgnorePP} and {@linkcode isReflected}).
|
* ({@linkcode isVirtual}, {@linkcode isIgnoreStatus}, {@linkcode isIgnorePP} and {@linkcode isReflected}).
|
||||||
*/
|
*/
|
||||||
export enum MoveUseMode {
|
export const MoveUseMode = {
|
||||||
/**
|
/**
|
||||||
* This move was used normally (i.e. clicking on the button) or called via Instruct.
|
* This move was used normally (i.e. clicking on the button) or called via Instruct.
|
||||||
* It deducts PP from the user's moveset (failing if out of PP), and interacts normally with other moves and abilities.
|
* It deducts PP from the user's moveset (failing if out of PP), and interacts normally with other moves and abilities.
|
||||||
*/
|
*/
|
||||||
NORMAL = 1,
|
NORMAL: 1,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This move was called by an effect that ignores PP, such as a consecutively executed move (e.g. Outrage).
|
* This move was called by an effect that ignores PP, such as a consecutively executed move (e.g. Outrage).
|
||||||
@ -27,7 +27,7 @@ export enum MoveUseMode {
|
|||||||
*
|
*
|
||||||
* PP can still be reduced by other effects (such as Spite or Eerie Spell).
|
* PP can still be reduced by other effects (such as Spite or Eerie Spell).
|
||||||
*/
|
*/
|
||||||
IGNORE_PP = 2,
|
IGNORE_PP: 2,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This move was called indirectly by an out-of-turn effect other than Instruct or the user's previous move.
|
* This move was called indirectly by an out-of-turn effect other than Instruct or the user's previous move.
|
||||||
@ -39,7 +39,7 @@ export enum MoveUseMode {
|
|||||||
*
|
*
|
||||||
* They still respect the user's volatile status conditions and confusion (though will uniquely _cure freeze and sleep before use_).
|
* They still respect the user's volatile status conditions and confusion (though will uniquely _cure freeze and sleep before use_).
|
||||||
*/
|
*/
|
||||||
INDIRECT = 3,
|
INDIRECT: 3,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This move was called as part of another move's effect (such as for most {@link https://bulbapedia.bulbagarden.net/wiki/Category:Moves_that_call_other_moves | Move-calling moves}).
|
* This move was called as part of another move's effect (such as for most {@link https://bulbapedia.bulbagarden.net/wiki/Category:Moves_that_call_other_moves | Move-calling moves}).
|
||||||
@ -50,7 +50,7 @@ export enum MoveUseMode {
|
|||||||
* They are _not ignored_ by other move-calling moves and abilities (unlike {@linkcode MoveUseMode.FOLLOW_UP} and {@linkcode MoveUseMode.REFLECTED}),
|
* They are _not ignored_ by other move-calling moves and abilities (unlike {@linkcode MoveUseMode.FOLLOW_UP} and {@linkcode MoveUseMode.REFLECTED}),
|
||||||
* but still inherit the former's disregard for moveset-related effects.
|
* but still inherit the former's disregard for moveset-related effects.
|
||||||
*/
|
*/
|
||||||
FOLLOW_UP = 4,
|
FOLLOW_UP: 4,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This move was reflected by Magic Coat or Magic Bounce.
|
* This move was reflected by Magic Coat or Magic Bounce.
|
||||||
@ -59,9 +59,11 @@ export enum MoveUseMode {
|
|||||||
* and retain the same copy prevention as {@linkcode MoveUseMode.FOLLOW_UP}, but additionally
|
* and retain the same copy prevention as {@linkcode MoveUseMode.FOLLOW_UP}, but additionally
|
||||||
* **cannot be reflected by other reflecting effects**.
|
* **cannot be reflected by other reflecting effects**.
|
||||||
*/
|
*/
|
||||||
REFLECTED = 5
|
REFLECTED: 5
|
||||||
// TODO: Add use type TRANSPARENT for Future Sight and Doom Desire to prevent move history pushing
|
// TODO: Add use type TRANSPARENT for Future Sight and Doom Desire to prevent move history pushing
|
||||||
}
|
} as const;
|
||||||
|
|
||||||
|
export type MoveUseMode = (typeof MoveUseMode)[keyof typeof MoveUseMode];
|
||||||
|
|
||||||
// # HELPER FUNCTIONS
|
// # HELPER FUNCTIONS
|
||||||
// Please update the markdown tables if any new `MoveUseMode`s get added.
|
// Please update the markdown tables if any new `MoveUseMode`s get added.
|
||||||
|
@ -449,10 +449,8 @@ export class MovePhase extends BattlePhase {
|
|||||||
|
|
||||||
// Handle Dancer, which triggers immediately after a move is used (rather than waiting on `this.end()`).
|
// Handle Dancer, which triggers immediately after a move is used (rather than waiting on `this.end()`).
|
||||||
// Note the MoveUseMode check here prevents an infinite Dancer loop.
|
// Note the MoveUseMode check here prevents an infinite Dancer loop.
|
||||||
if (
|
const dancerModes: MoveUseMode[] = [MoveUseMode.INDIRECT, MoveUseMode.REFLECTED] as const;
|
||||||
this.move.getMove().hasFlag(MoveFlags.DANCE_MOVE) &&
|
if (this.move.getMove().hasFlag(MoveFlags.DANCE_MOVE) && !dancerModes.includes(this.useMode)) {
|
||||||
![MoveUseMode.INDIRECT, MoveUseMode.REFLECTED].includes(this.useMode)
|
|
||||||
) {
|
|
||||||
// TODO: Fix in dancer PR to move to MEP for hit checks
|
// TODO: Fix in dancer PR to move to MEP for hit checks
|
||||||
globalScene.getField(true).forEach(pokemon => {
|
globalScene.getField(true).forEach(pokemon => {
|
||||||
applyPostMoveUsedAbAttrs(PostMoveUsedAbAttr, pokemon, this.move, this.pokemon, this.targets);
|
applyPostMoveUsedAbAttrs(PostMoveUsedAbAttr, pokemon, this.move, this.pokemon, this.targets);
|
||||||
|
Loading…
Reference in New Issue
Block a user