[Move] Implement Core Enforcer (#2024)

* [Move] Implement Core Enforcer

* Documentation

* Documentation
This commit is contained in:
Zach Day 2024-06-10 21:17:28 -04:00 committed by GitHub
parent dc6c8f22ac
commit 5762409b17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 31 additions and 2 deletions

View File

@ -5117,7 +5117,7 @@ export class SuppressAbilitiesAttr extends MoveEffectAttr {
target.summonData.abilitySuppressed = true;
target.scene.queueMessage(getPokemonMessage(target, " ability\nwas suppressed!"));
target.scene.queueMessage(getPokemonMessage(target, "'s ability\nwas suppressed!"));
return true;
}
@ -5127,6 +5127,35 @@ export class SuppressAbilitiesAttr extends MoveEffectAttr {
}
}
/**
* Applies the effects of {@linkcode SuppressAbilitiesAttr} if the target has already moved this turn.
* @extends MoveEffectAttr
* @see {@linkcode Moves.CORE_ENFORCER} (the move which uses this effect)
*/
export class SuppressAbilitiesIfActedAttr extends MoveEffectAttr {
/**
* If the target has already acted this turn, apply a {@linkcode SuppressAbilitiesAttr} effect unless the
* abillity cannot be suppressed. This is a secondary effect and has no bearing on the success or failure of the move.
*
* @returns True if the move occurred, otherwise false. Note that true will be returned even if the target has not
* yet moved or if the target's abiilty is un-suppressable.
*/
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
if (!super.apply(user, target, move, args)) {
return false;
}
if (target.turnData.acted) {
const suppressAttr = new SuppressAbilitiesAttr();
if (suppressAttr.getCondition()(user, target, move)) {
suppressAttr.apply(user, target, move, args);
}
}
return true;
}
}
export class TransformAttr extends MoveEffectAttr {
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): Promise<boolean> {
return new Promise(resolve => {
@ -7311,7 +7340,7 @@ export function initMoves() {
.attr(MatchUserTypeAttr),
new AttackMove(Moves.CORE_ENFORCER, Type.DRAGON, MoveCategory.SPECIAL, 100, 100, 10, -1, 0, 7)
.target(MoveTarget.ALL_NEAR_ENEMIES)
.partial(),
.attr(SuppressAbilitiesIfActedAttr),
new AttackMove(Moves.TROP_KICK, Type.GRASS, MoveCategory.PHYSICAL, 70, 100, 15, 100, 0, 7)
.attr(StatChangeAttr, BattleStat.ATK, -1),
new StatusMove(Moves.INSTRUCT, Type.PSYCHIC, -1, 15, -1, 0, 7)