From d1e91acb6fc2a3a09c728dc34d40da2f259b8a63 Mon Sep 17 00:00:00 2001 From: Marty-D Date: Wed, 22 Jul 2020 12:33:18 -0400 Subject: [PATCH] Fix Protean interaction with Sucker Punch and other assorted things --- data/scripts.ts | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/data/scripts.ts b/data/scripts.ts index cbdff55949..8406aba83f 100644 --- a/data/scripts.ts +++ b/data/scripts.ts @@ -337,7 +337,16 @@ export const BattleScripts: BattleScriptsData = { this.setActiveMove(move, pokemon, targets[0]); - let hitResult = this.singleEvent('PrepareHit', move, {}, targets[0], pokemon, move); + let hitResult = this.singleEvent('Try', move, null, pokemon, targets[0], move); + if (!hitResult) { + if (hitResult === false) { + this.add('-fail', pokemon); + this.attrLastMove('[still]'); + } + return false; + } + + hitResult = this.singleEvent('PrepareHit', move, {}, targets[0], pokemon, move); if (!hitResult) { if (hitResult === false) { this.add('-fail', pokemon); @@ -347,15 +356,6 @@ export const BattleScripts: BattleScriptsData = { } this.runEvent('PrepareHit', pokemon, targets[0], move); - hitResult = this.singleEvent('Try', move, null, pokemon, targets[0], move); - if (!hitResult) { - if (hitResult === false) { - this.add('-fail', pokemon); - this.attrLastMove('[still]'); - } - return false; - } - let atLeastOneFailure!: boolean; for (const step of moveSteps) { // @ts-ignore @@ -574,6 +574,10 @@ export const BattleScripts: BattleScriptsData = { tryMoveHit(target, pokemon, move) { this.setActiveMove(move, pokemon, target); + if (!this.singleEvent('Try', move, null, pokemon, target, move)) { + return false; + } + let hitResult = this.singleEvent('PrepareHit', move, {}, target, pokemon, move); if (!hitResult) { if (hitResult === false) { @@ -584,10 +588,6 @@ export const BattleScripts: BattleScriptsData = { } this.runEvent('PrepareHit', pokemon, target, move); - if (!this.singleEvent('Try', move, null, pokemon, target, move)) { - return false; - } - if (move.target === 'all') { hitResult = this.runEvent('TryHitField', target, pokemon, move); } else {