Fix Protean interaction with Sucker Punch

and other assorted things
This commit is contained in:
Marty-D
2020-07-22 12:33:18 -04:00
committed by GitHub
parent e9611b7ce2
commit d1e91acb6f

View File

@@ -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 {