Remove beak blast tag after attack finishes to not burn late contact moves like dragon tail

This commit is contained in:
jatinkohli 2024-05-18 02:56:35 -07:00
parent af36c087fa
commit 78d7cd23b8

View File

@ -553,6 +553,31 @@ export class MoveEffectAttr extends MoveAttr {
} }
} }
export class RemoveBeakBlastTagArr extends MoveEffectAttr {
constructor() {
super(true, MoveEffectTrigger.PRE_APPLY, false);
}
canApply(user: Pokemon, target: Pokemon, move: Move, args: any[]) {
// We want to remove the tag at the start of the second portion of beak blast
// to not burn lower priority contact moves like dragon tail:
// we want to return false if checking during the move effect phase of the first portion,
// and return true if checking during the move effect phase of the second portion.
// We can check the user's previous move to see if it was beak blast's (690) first portion or not
return (user.getLastXMoves(1)[0] && user.getLastXMoves(1)[0].move == Moves.BEAK_BLAST);
}
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]) {
const canApply = this.canApply(user, target, move, args);
if (canApply)
user.removeTag(BattlerTagType.BEAK_BLAST);
return canApply;
}
}
export class PreMoveMessageAttr extends MoveAttr { export class PreMoveMessageAttr extends MoveAttr {
private message: string | ((user: Pokemon, target: Pokemon, move: Move) => string); private message: string | ((user: Pokemon, target: Pokemon, move: Move) => string);
@ -6341,6 +6366,7 @@ export function initMoves() {
.attr(ChargeAttr, ChargeAnim.BEAK_BLAST_CHARGING, "started\nheating up its beak!", BattlerTagType.BEAK_BLAST, true, true, -3) .attr(ChargeAttr, ChargeAnim.BEAK_BLAST_CHARGING, "started\nheating up its beak!", BattlerTagType.BEAK_BLAST, true, true, -3)
.ballBombMove() .ballBombMove()
.makesContact(false) .makesContact(false)
.attr(RemoveBeakBlastTagArr)
.partial(), .partial(),
new AttackMove(Moves.CLANGING_SCALES, Type.DRAGON, MoveCategory.SPECIAL, 110, 100, 5, 100, 0, 7) new AttackMove(Moves.CLANGING_SCALES, Type.DRAGON, MoveCategory.SPECIAL, 110, 100, 5, 100, 0, 7)
.attr(StatChangeAttr, BattleStat.DEF, -1, true) .attr(StatChangeAttr, BattleStat.DEF, -1, true)