From 6936d7235e302c8f2119dddbd163e2ba05ec3553 Mon Sep 17 00:00:00 2001 From: Bertie690 Date: Fri, 30 May 2025 11:08:28 -0400 Subject: [PATCH] Fixed code --- src/field/pokemon.ts | 31 +++++++++++++++++-------------- src/ui/party-ui-handler.ts | 10 +++++----- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 53cfa7aaade..c057682ce74 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -65,7 +65,6 @@ import { rgbToHsv, deltaRgb, isBetween, - type nil, type Constructor, randSeedIntRange, } from "#app/utils/common"; @@ -4389,11 +4388,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { * or `undefined` if no applicable moves have been used since switching in. */ getLastNonVirtualMove(ignoreStruggle = false, ignoreFollowUp = true): TurnMove | undefined { - return this.getLastXMoves(-1).find(m => - m.move !== Moves.NONE - && (!ignoreStruggle || m.move !== Moves.STRUGGLE) - && (!isVirtual(m.useType) || - (!ignoreFollowUp && m.useType === MoveUseType.FOLLOW_UP)) + return this.getLastXMoves(-1).find( + m => + m.move !== Moves.NONE && + (!ignoreStruggle || m.move !== Moves.STRUGGLE) && + (!isVirtual(m.useType) || (!ignoreFollowUp && m.useType === MoveUseType.FOLLOW_UP)), ); } @@ -4413,7 +4412,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { this.summonData.moveQueue.push(queuedMove); } - changeForm(formChange: SpeciesFormChange): Promise { return new Promise(resolve => { this.formIndex = Math.max( @@ -6247,7 +6245,7 @@ export class EnemyPokemon extends Pokemon { isVirtual(queuedMove.useType) || (moveIndex > -1 && this.getMoveset()[moveIndex].isUsable(this, isIgnorePP(queuedMove.useType))) ) { - moveQueue.splice(0, i) // TODO: This may be redundant and definitely should not be done here + moveQueue.splice(0, i); // TODO: This may be redundant and definitely should not be done here return queuedMove; } } @@ -6258,7 +6256,11 @@ export class EnemyPokemon extends Pokemon { if (movePool.length) { // If there's only 1 move in the move pool, use it. if (movePool.length === 1) { - return { move: movePool[0].moveId, targets: this.getNextTargets(movePool[0].moveId) , useType: MoveUseType.NORMAL}; + return { + move: movePool[0].moveId, + targets: this.getNextTargets(movePool[0].moveId), + useType: MoveUseType.NORMAL, + }; } // If a move is forced because of Encore, use it. // Said moves are executed normally @@ -6269,7 +6271,7 @@ export class EnemyPokemon extends Pokemon { return { move: encoreMove.moveId, targets: this.getNextTargets(encoreMove.moveId), - useType: MoveUseType.NORMAL + useType: MoveUseType.NORMAL, }; } } @@ -6440,15 +6442,17 @@ export class EnemyPokemon extends Pokemon { r++; } } - console.log(movePool.map(m => m.getName()), moveScores, r, sortedMovePool.map(m => m.getName())); - return { move: sortedMovePool[r]!.moveId, targets: moveTargets[sortedMovePool[r]!.moveId], useType: MoveUseType.NORMAL }; console.log( movePool.map(m => m.getName()), moveScores, r, sortedMovePool.map(m => m.getName()), ); - return { move: sortedMovePool[r]!.moveId, targets: moveTargets[sortedMovePool[r]!.moveId], useType: MoveUseType.NORMAL }; + return { + move: sortedMovePool[r]!.moveId, + targets: moveTargets[sortedMovePool[r]!.moveId], + useType: MoveUseType.NORMAL, + }; } } } @@ -6741,7 +6745,6 @@ export class EnemyPokemon extends Pokemon { return ret; } - /** * Show or hide the type effectiveness multiplier window * Passing undefined will hide the window diff --git a/src/ui/party-ui-handler.ts b/src/ui/party-ui-handler.ts index 6b905830d68..e0490c9f7f5 100644 --- a/src/ui/party-ui-handler.ts +++ b/src/ui/party-ui-handler.ts @@ -5,7 +5,7 @@ import { addBBCodeTextObject, addTextObject, getTextColor, TextStyle } from "#ap import { Command } from "#app/ui/command-ui-handler"; import MessageUiHandler from "#app/ui/message-ui-handler"; import { UiMode } from "#enums/ui-mode"; -import { BooleanHolder, toReadableString, randInt, getLocalizedSpriteKey, isNullOrUndefined } from "#app/utils/common"; +import { BooleanHolder, toReadableString, randInt, getLocalizedSpriteKey } from "#app/utils/common"; import { PokemonFormChangeItemModifier, PokemonHeldItemModifier, @@ -1165,19 +1165,19 @@ export default class PartyUiHandler extends MessageUiHandler { this.partyUiMode !== PartyUiMode.FAINT_SWITCH && globalScene.findModifier( m => - m instanceof SwitchEffectTransferModifier && - m.pokemonId === globalScene.getPlayerField()[this.fieldIndex].id, + m instanceof SwitchEffectTransferModifier && m.pokemonId === globalScene.getPlayerField()[this.fieldIndex].id, ) ); } // TODO: add FORCED_SWITCH (and perhaps also BATON_PASS_SWITCH) to the modes + // TODO: refactor once moves in flight become a thing... private isBatonPassMove(): boolean { const lastMove: TurnMove | undefined = globalScene.getPlayerField()[this.fieldIndex].getLastXMoves()[0]; return ( this.partyUiMode === PartyUiMode.FAINT_SWITCH && - allMoves[lastMove.move].getAttrs(ForceSwitchOutAttr)[0]?.isBatonPass() && - lastMove?.result === MoveResult.SUCCESS + lastMove?.result === MoveResult.SUCCESS && + allMoves[lastMove.move].getAttrs(ForceSwitchOutAttr)[0]?.isBatonPass() ); }