From 1318dd5225df0ecbd9856f55c0e66c571912647f Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Fri, 6 Jun 2025 16:55:56 -0700 Subject: [PATCH] Use early return in `Pokemon#isOffsetBySubstitute` --- src/field/pokemon.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index b8edeb3301a..df953f06834 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -1292,16 +1292,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { */ isOffsetBySubstitute(): boolean { const substitute = this.getTag(SubstituteTag); - if (substitute) { - if (substitute.sprite === undefined) { - return false; - } - - // During the Pokemon's MoveEffect phase, the offset is removed to put the Pokemon "in focus" - const currentPhase = globalScene.getCurrentPhase(); - return !(currentPhase?.is("MoveEffectPhase") && currentPhase.getPokemon() === this); + if (!substitute || substitute.sprite === undefined) { + return false; } - return false; + // During the Pokemon's MoveEffect phase, the offset is removed to put the Pokemon "in focus" + const currentPhase = globalScene.getCurrentPhase(); + return !(currentPhase?.is("MoveEffectPhase") && currentPhase.getPokemon() === this); } /** If this Pokemon has a Substitute on the field, removes its sprite from the field. */