From 4a575a45a9b8ce9a376d685dc3bd9cc3f13bad3c Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Thu, 21 Dec 2023 23:57:11 -0500 Subject: [PATCH] Fix some bugs Fix softlock with charging moves; fix double summon bug with Dragon Tail and similar moves in a trainer battle --- public/images/ui/starter_select_message.png | Bin 359 -> 0 bytes src/battle-phases.ts | 2 +- src/battle-scene.ts | 1 - src/data/move.ts | 4 ++-- src/pokemon.ts | 4 ++-- src/ui/egg-list-ui-handler.ts | 12 ++++++------ src/ui/starter-select-ui-handler.ts | 2 +- 7 files changed, 12 insertions(+), 13 deletions(-) delete mode 100644 public/images/ui/starter_select_message.png diff --git a/public/images/ui/starter_select_message.png b/public/images/ui/starter_select_message.png deleted file mode 100644 index 68ad3273a4436814cbf63c0233644092b016a0a3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 359 zcmeAS@N?(olHy`uVBq!ia0y~yU~~Yo|;s-n98P#ak73YF(%e`aSS!Z1TA+u(|svmzVH80iV<(D(} z9~Md8p(VWHd`+J6qC5MUw&#BT%dp_ykFB}o^-MNXKYnxGC>XF-XsOTkXQqOJwO-w?5zyM_MboFyt=akR{0EP&QEdT%j diff --git a/src/battle-phases.ts b/src/battle-phases.ts index 94f38c319ee..8d6f8778e16 100644 --- a/src/battle-phases.ts +++ b/src/battle-phases.ts @@ -1085,7 +1085,7 @@ export class CommandPhase extends FieldPhase { let useStruggle = false; if (cursor === -1 || playerPokemon.trySelectMove(cursor, args[0] as boolean) || (useStruggle = cursor > -1 && !playerPokemon.getMoveset().filter(m => m.isUsable(playerPokemon)).length)) { const moveId = !useStruggle ? cursor > -1 ? playerPokemon.getMoveset()[cursor].moveId : Moves.NONE : Moves.STRUGGLE; - const turnCommand: TurnCommand = { command: Command.FIGHT, cursor: cursor, move: { move: moveId, targets: [] }, args: args }; + const turnCommand: TurnCommand = { command: Command.FIGHT, cursor: cursor, move: { move: moveId, targets: [], ignorePP: args[0] }, args: args }; const moveTargets: MoveTargetSet = args.length < 3 ? getMoveTargets(playerPokemon, moveId) : args[2]; if (!moveId) turnCommand.targets = [ this.fieldIndex ]; diff --git a/src/battle-scene.ts b/src/battle-scene.ts index ec81aa53731..700c67630a0 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -237,7 +237,6 @@ export default class BattleScene extends Phaser.Scene { this.loadImage(`summary_tabs_${t}`, 'ui'); this.loadImage('starter_select_bg', 'ui'); - this.loadImage('starter_select_message', 'ui'); this.loadImage('starter_select_cursor', 'ui'); this.loadImage('starter_select_cursor_highlight', 'ui'); this.loadImage('starter_select_cursor_pokerus', 'ui'); diff --git a/src/data/move.ts b/src/data/move.ts index 2f728aff4bf..dbb7c87c40d 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -13,7 +13,6 @@ import { Abilities, BlockRecoilDamageAttr, IgnoreContactAbAttr, applyAbAttrs } f import { PokemonHeldItemModifier } from "../modifier/modifier"; import { BattlerIndex } from "../battle"; import { Stat } from "./pokemon-stat"; -import { Species } from "./species"; export enum MoveCategory { PHYSICAL, @@ -2580,7 +2579,8 @@ export class ForceSwitchOutAttr extends MoveEffectAttr { switchOutTarget.hideInfo(); switchOutTarget.setVisible(false); - user.scene.unshiftPhase(new SwitchSummonPhase(user.scene, switchOutTarget.getFieldIndex(), user.scene.currentBattle.trainer.getNextSummonIndex(), false, this.batonPass, false)); + if (switchOutTarget.hp) + user.scene.unshiftPhase(new SwitchSummonPhase(user.scene, switchOutTarget.getFieldIndex(), user.scene.currentBattle.trainer.getNextSummonIndex(), false, this.batonPass, false)); } else { switchOutTarget.hideInfo().then(() => switchOutTarget.destroy()); switchOutTarget.hp = 0; diff --git a/src/pokemon.ts b/src/pokemon.ts index da912fc961b..8acbbaf87ef 100644 --- a/src/pokemon.ts +++ b/src/pokemon.ts @@ -527,9 +527,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { : this.moveset; if (MOVE_OVERRIDE && this.isPlayer()) - this.moveset[0] = new PokemonMove(MOVE_OVERRIDE); + this.moveset[0] = new PokemonMove(MOVE_OVERRIDE, Math.min(this.moveset[0].ppUsed, allMoves[MOVE_OVERRIDE].pp)); else if (OPP_MOVE_OVERRIDE && !this.isPlayer()) - this.moveset[0] = new PokemonMove(OPP_MOVE_OVERRIDE); + this.moveset[0] = new PokemonMove(OPP_MOVE_OVERRIDE, Math.min(this.moveset[0].ppUsed, allMoves[OPP_MOVE_OVERRIDE].pp)); return ret; } diff --git a/src/ui/egg-list-ui-handler.ts b/src/ui/egg-list-ui-handler.ts index 5be0eef9093..f487eb9a025 100644 --- a/src/ui/egg-list-ui-handler.ts +++ b/src/ui/egg-list-ui-handler.ts @@ -36,9 +36,9 @@ export default class EggListUiHandler extends MessageUiHandler { bgColor.setOrigin(0, 0); this.eggListContainer.add(bgColor); - const starterSelectBg = this.scene.add.image(1, 1, 'egg_list_bg'); - starterSelectBg.setOrigin(0, 0); - this.eggListContainer.add(starterSelectBg); + const eggListBg = this.scene.add.image(1, 1, 'egg_list_bg'); + eggListBg.setOrigin(0, 0); + this.eggListContainer.add(eggListBg); this.eggListContainer.add(addWindow(this.scene, 1, 85, 106, 22)); this.eggListContainer.add(addWindow(this.scene, 1, 102, 106, 50, true)); @@ -77,9 +77,9 @@ export default class EggListUiHandler extends MessageUiHandler { this.eggListMessageBoxContainer.setVisible(false); this.eggListContainer.add(this.eggListMessageBoxContainer); - const starterSelectMessageBox = this.scene.add.image(0, 0, 'starter_select_message'); - starterSelectMessageBox.setOrigin(0, 1); - this.eggListMessageBoxContainer.add(starterSelectMessageBox); + const eggListMessageBox = addWindow(this.scene, 1, -1, 318, 28); + eggListMessageBox.setOrigin(0, 1); + this.eggListMessageBoxContainer.add(eggListMessageBox); this.message = addTextObject(this.scene, 8, -8, '', TextStyle.WINDOW, { maxLines: 1 }); this.message.setOrigin(0, 1); diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index 64ddc9a0279..7a31f7df778 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -261,7 +261,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { this.starterSelectMessageBoxContainer.setVisible(false); this.starterSelectContainer.add(this.starterSelectMessageBoxContainer); - const starterSelectMessageBox = this.scene.add.image(0, 0, 'starter_select_message'); + const starterSelectMessageBox = addWindow(this.scene, 1, -1, 318, 28); starterSelectMessageBox.setOrigin(0, 1); this.starterSelectMessageBoxContainer.add(starterSelectMessageBox);