From a8a0465cf113668cfc8062c523925878ce4e1eef Mon Sep 17 00:00:00 2001 From: Hisuian Zoroark <96159984+HisuianZoroark@users.noreply.github.com> Date: Thu, 22 Dec 2022 20:00:49 -0500 Subject: [PATCH] CAP: Improve Persistent activation (#9214) --- data/mods/gen4/moves.ts | 40 ++++++++++++++++++++--------- data/moves.ts | 56 +++++++++++++++++++++++++++++------------ 2 files changed, 68 insertions(+), 28 deletions(-) diff --git a/data/mods/gen4/moves.ts b/data/mods/gen4/moves.ts index bcc968bea9..6632192ad7 100644 --- a/data/mods/gen4/moves.ts +++ b/data/mods/gen4/moves.ts @@ -637,13 +637,17 @@ export const Moves: {[k: string]: ModdedMoveData} = { duration: 5, durationCallback(source, effect) { if (source?.hasAbility('persistent')) { - this.add('-activate', source, 'ability: Persistent', effect); + this.add('-activate', source, 'ability: Persistent', '[move] Gravity'); return 7; } return 5; }, - onFieldStart() { - this.add('-fieldstart', 'move: Gravity'); + onFieldStart(target, source) { + if (source?.hasAbility('persistent')) { + this.add('-fieldstart', 'move: Gravity', '[persistent]'); + } else { + this.add('-fieldstart', 'move: Gravity'); + } for (const pokemon of this.getAllActive()) { let applies = false; if (pokemon.removeVolatile('bounce') || pokemon.removeVolatile('fly')) { @@ -727,7 +731,7 @@ export const Moves: {[k: string]: ModdedMoveData} = { duration: 5, durationCallback(target, source, effect) { if (source?.hasAbility('persistent')) { - this.add('-activate', source, 'ability: Persistent', effect); + this.add('-activate', source, 'ability: Persistent', '[move] Heal Block'); return 7; } return 5; @@ -1373,7 +1377,7 @@ export const Moves: {[k: string]: ModdedMoveData} = { duration: 5, durationCallback(target, source, effect) { if (source?.hasAbility('persistent')) { - this.add('-activate', source, 'ability: Persistent', effect); + this.add('-activate', source, 'ability: Persistent', '[move] Safeguard'); return 7; } return 5; @@ -1398,8 +1402,12 @@ export const Moves: {[k: string]: ModdedMoveData} = { return null; } }, - onSideStart(side) { - this.add('-sidestart', side, 'Safeguard'); + onSideStart(side, source) { + if (source?.hasAbility('persistent')) { + this.add('-sidestart', side, 'Safeguard', '[persistent]'); + } else { + this.add('-sidestart', side, 'Safeguard'); + } }, onSideResidualOrder: 4, onSideEnd(side) { @@ -1602,13 +1610,17 @@ export const Moves: {[k: string]: ModdedMoveData} = { duration: 3, durationCallback(target, source, effect) { if (source?.hasAbility('persistent')) { - this.add('-activate', source, 'ability: Persistent', effect); + this.add('-activate', source, 'ability: Persistent', '[move] Tailwind'); return 5; } return 3; }, - onSideStart(side) { - this.add('-sidestart', side, 'move: Tailwind'); + onSideStart(side, source) { + if (source?.hasAbility('persistent')) { + this.add('-sidestart', side, 'move: Tailwind', '[persistent]'); + } else { + this.add('-sidestart', side, 'move: Tailwind'); + } }, onModifySpe(spe) { return spe * 2; @@ -1709,13 +1721,17 @@ export const Moves: {[k: string]: ModdedMoveData} = { duration: 5, durationCallback(source, effect) { if (source?.hasAbility('persistent')) { - this.add('-activate', source, 'ability: Persistent', effect); + this.add('-activate', source, 'ability: Persistent', '[move] Trick Room'); return 7; } return 5; }, onFieldStart(target, source) { - this.add('-fieldstart', 'move: Trick Room', '[of] ' + source); + if (source?.hasAbility('persistent')) { + this.add('-fieldstart', 'move: Trick Room', '[of] ' + source, '[persistent]'); + } else { + this.add('-fieldstart', 'move: Trick Room', '[of] ' + source); + } }, onFieldRestart(target, source) { this.field.removePseudoWeather('trickroom'); diff --git a/data/moves.ts b/data/moves.ts index 73825cf3bf..a2f58a33dc 100644 --- a/data/moves.ts +++ b/data/moves.ts @@ -7876,13 +7876,17 @@ export const Moves: {[moveid: string]: MoveData} = { duration: 5, durationCallback(source, effect) { if (source?.hasAbility('persistent')) { - this.add('-activate', source, 'ability: Persistent', effect); + this.add('-activate', source, 'ability: Persistent', '[move] Gravity'); return 7; } return 5; }, - onFieldStart() { - this.add('-fieldstart', 'move: Gravity'); + onFieldStart(target, source) { + if (source?.hasAbility('persistent')) { + this.add('-fieldstart', 'move: Gravity', '[persistent]'); + } else { + this.add('-fieldstart', 'move: Gravity'); + } for (const pokemon of this.getAllActive()) { let applies = false; if (pokemon.removeVolatile('bounce') || pokemon.removeVolatile('fly')) { @@ -8381,7 +8385,7 @@ export const Moves: {[moveid: string]: MoveData} = { duration: 5, durationCallback(target, source, effect) { if (source?.hasAbility('persistent')) { - this.add('-activate', source, 'ability: Persistent', effect); + this.add('-activate', source, 'ability: Persistent', '[move] Heal Block'); return 7; } return 5; @@ -10902,13 +10906,17 @@ export const Moves: {[moveid: string]: MoveData} = { duration: 5, durationCallback(source, effect) { if (source?.hasAbility('persistent')) { - this.add('-activate', source, 'ability: Persistent', effect); + this.add('-activate', source, 'ability: Persistent', '[move] Magic Room'); return 7; } return 5; }, onFieldStart(target, source) { - this.add('-fieldstart', 'move: Magic Room', '[of] ' + source); + if (source?.hasAbility('persistent')) { + this.add('-fieldstart', 'move: Magic Room', '[of] ' + source, '[persistent]'); + } else { + this.add('-fieldstart', 'move: Magic Room', '[of] ' + source); + } for (const mon of this.getAllActive()) { this.singleEvent('End', mon.getItem(), mon.itemState, mon); } @@ -15831,7 +15839,7 @@ export const Moves: {[moveid: string]: MoveData} = { duration: 5, durationCallback(target, source, effect) { if (source?.hasAbility('persistent')) { - this.add('-activate', source, 'ability: Persistent', effect); + this.add('-activate', source, 'ability: Persistent', '[move] Safeguard'); return 7; } return 5; @@ -15856,8 +15864,12 @@ export const Moves: {[moveid: string]: MoveData} = { return null; } }, - onSideStart(side) { - this.add('-sidestart', side, 'Safeguard'); + onSideStart(side, source) { + if (source?.hasAbility('persistent')) { + this.add('-sidestart', side, 'Safeguard', '[persistent]'); + } else { + this.add('-sidestart', side, 'Safeguard'); + } }, onSideResidualOrder: 26, onSideResidualSubOrder: 3, @@ -19227,13 +19239,17 @@ export const Moves: {[moveid: string]: MoveData} = { duration: 4, durationCallback(target, source, effect) { if (source?.hasAbility('persistent')) { - this.add('-activate', source, 'ability: Persistent', effect); + this.add('-activate', source, 'ability: Persistent', '[move] Tailwind'); return 6; } return 4; }, - onSideStart(side) { - this.add('-sidestart', side, 'move: Tailwind'); + onSideStart(side, source) { + if (source?.hasAbility('persistent')) { + this.add('-sidestart', side, 'move: Tailwind', '[persistent]'); + } else { + this.add('-sidestart', side, 'move: Tailwind'); + } }, onModifySpe(spe, pokemon) { return this.chainModify(2); @@ -20253,13 +20269,17 @@ export const Moves: {[moveid: string]: MoveData} = { duration: 5, durationCallback(source, effect) { if (source?.hasAbility('persistent')) { - this.add('-activate', source, 'ability: Persistent', effect); + this.add('-activate', source, 'ability: Persistent', '[move] Trick Room'); return 7; } return 5; }, onFieldStart(target, source) { - this.add('-fieldstart', 'move: Trick Room', '[of] ' + source); + if (source?.hasAbility('persistent')) { + this.add('-fieldstart', 'move: Trick Room', '[of] ' + source, '[persistent]'); + } else { + this.add('-fieldstart', 'move: Trick Room', '[of] ' + source); + } }, onFieldRestart(target, source) { this.field.removePseudoWeather('trickroom'); @@ -21284,7 +21304,7 @@ export const Moves: {[moveid: string]: MoveData} = { duration: 5, durationCallback(source, effect) { if (source?.hasAbility('persistent')) { - this.add('-activate', source, 'ability: Persistent', effect); + this.add('-activate', source, 'ability: Persistent', '[move] Wonder Room'); return 7; } return 5; @@ -21298,7 +21318,11 @@ export const Moves: {[moveid: string]: MoveData} = { this.hint(`${move.name} uses ${statAndBoosts === 'def' ? '' : 'Sp. '}Def boosts when Wonder Room is active.`); }, onFieldStart(field, source) { - this.add('-fieldstart', 'move: Wonder Room', '[of] ' + source); + if (source?.hasAbility('persistent')) { + this.add('-fieldstart', 'move: Wonder Room', '[of] ' + source, '[persistent]'); + } else { + this.add('-fieldstart', 'move: Wonder Room', '[of] ' + source); + } }, onFieldRestart(target, source) { this.field.removePseudoWeather('wonderroom');