Skip to content

Commit

Permalink
Gen 5 Magic Coat doesn't bounce hazards while semi-invulnerable
Browse files Browse the repository at this point in the history
  • Loading branch information
andrebastosdias committed Feb 10, 2025
1 parent d17d000 commit 238d07f
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions data/mods/gen5/moves.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,41 @@ export const Moves: import('../../../sim/dex-moves').ModdedMoveDataTable = {
inherit: true,
basePower: 60,
},
magiccoat: {
inherit: true,
condition: {
duration: 1,
onStart(target, source, effect) {
this.add('-singleturn', target, 'move: Magic Coat');
if (effect?.effectType === 'Move') {
this.effectState.pranksterBoosted = effect.pranksterBoosted;
}
},
onTryHitPriority: 2,
onTryHit(target, source, move) {
if (target === source || move.hasBounced || !move.flags['reflectable'] ||
(target.isSemiInvulnerable() && move.target !== 'foeSide')) {
return;
}
const newMove = this.dex.getActiveMove(move.id);
newMove.hasBounced = true;
newMove.pranksterBoosted = this.effectState.pranksterBoosted;
this.actions.useMove(newMove, target, {target: source});
return null;
},
onAllyTryHitSide(target, source, move) {
if (target.isAlly(source) || move.hasBounced || !move.flags['reflectable'] ||
(target.isSemiInvulnerable() && move.target !== 'foeSide')) {
return;
}
const newMove = this.dex.getActiveMove(move.id);
newMove.hasBounced = true;
newMove.pranksterBoosted = false;
this.actions.useMove(newMove, this.effectState.target, {target: source});
return null;
},
},
},
magicroom: {
inherit: true,
priority: -7,
Expand Down

0 comments on commit 238d07f

Please sign in to comment.