Fix some bugs

Fix softlock with charging moves; fix double summon bug with Dragon Tail and similar moves in a trainer battle
pull/14/head
Flashfyre 2023-12-21 23:57:11 -05:00
parent 957b5d0fa7
commit 4a575a45a9
7 changed files with 12 additions and 13 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 359 B

View File

@ -1085,7 +1085,7 @@ export class CommandPhase extends FieldPhase {
let useStruggle = false; let useStruggle = false;
if (cursor === -1 || playerPokemon.trySelectMove(cursor, args[0] as boolean) || (useStruggle = cursor > -1 && !playerPokemon.getMoveset().filter(m => m.isUsable(playerPokemon)).length)) { 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 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]; const moveTargets: MoveTargetSet = args.length < 3 ? getMoveTargets(playerPokemon, moveId) : args[2];
if (!moveId) if (!moveId)
turnCommand.targets = [ this.fieldIndex ]; turnCommand.targets = [ this.fieldIndex ];

View File

@ -237,7 +237,6 @@ export default class BattleScene extends Phaser.Scene {
this.loadImage(`summary_tabs_${t}`, 'ui'); this.loadImage(`summary_tabs_${t}`, 'ui');
this.loadImage('starter_select_bg', 'ui'); this.loadImage('starter_select_bg', 'ui');
this.loadImage('starter_select_message', 'ui');
this.loadImage('starter_select_cursor', 'ui'); this.loadImage('starter_select_cursor', 'ui');
this.loadImage('starter_select_cursor_highlight', 'ui'); this.loadImage('starter_select_cursor_highlight', 'ui');
this.loadImage('starter_select_cursor_pokerus', 'ui'); this.loadImage('starter_select_cursor_pokerus', 'ui');

View File

@ -13,7 +13,6 @@ import { Abilities, BlockRecoilDamageAttr, IgnoreContactAbAttr, applyAbAttrs } f
import { PokemonHeldItemModifier } from "../modifier/modifier"; import { PokemonHeldItemModifier } from "../modifier/modifier";
import { BattlerIndex } from "../battle"; import { BattlerIndex } from "../battle";
import { Stat } from "./pokemon-stat"; import { Stat } from "./pokemon-stat";
import { Species } from "./species";
export enum MoveCategory { export enum MoveCategory {
PHYSICAL, PHYSICAL,
@ -2580,7 +2579,8 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
switchOutTarget.hideInfo(); switchOutTarget.hideInfo();
switchOutTarget.setVisible(false); 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 { } else {
switchOutTarget.hideInfo().then(() => switchOutTarget.destroy()); switchOutTarget.hideInfo().then(() => switchOutTarget.destroy());
switchOutTarget.hp = 0; switchOutTarget.hp = 0;

View File

@ -527,9 +527,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
: this.moveset; : this.moveset;
if (MOVE_OVERRIDE && this.isPlayer()) 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()) 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; return ret;
} }

View File

@ -36,9 +36,9 @@ export default class EggListUiHandler extends MessageUiHandler {
bgColor.setOrigin(0, 0); bgColor.setOrigin(0, 0);
this.eggListContainer.add(bgColor); this.eggListContainer.add(bgColor);
const starterSelectBg = this.scene.add.image(1, 1, 'egg_list_bg'); const eggListBg = this.scene.add.image(1, 1, 'egg_list_bg');
starterSelectBg.setOrigin(0, 0); eggListBg.setOrigin(0, 0);
this.eggListContainer.add(starterSelectBg); this.eggListContainer.add(eggListBg);
this.eggListContainer.add(addWindow(this.scene, 1, 85, 106, 22)); this.eggListContainer.add(addWindow(this.scene, 1, 85, 106, 22));
this.eggListContainer.add(addWindow(this.scene, 1, 102, 106, 50, true)); 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.eggListMessageBoxContainer.setVisible(false);
this.eggListContainer.add(this.eggListMessageBoxContainer); this.eggListContainer.add(this.eggListMessageBoxContainer);
const starterSelectMessageBox = this.scene.add.image(0, 0, 'starter_select_message'); const eggListMessageBox = addWindow(this.scene, 1, -1, 318, 28);
starterSelectMessageBox.setOrigin(0, 1); eggListMessageBox.setOrigin(0, 1);
this.eggListMessageBoxContainer.add(starterSelectMessageBox); this.eggListMessageBoxContainer.add(eggListMessageBox);
this.message = addTextObject(this.scene, 8, -8, '', TextStyle.WINDOW, { maxLines: 1 }); this.message = addTextObject(this.scene, 8, -8, '', TextStyle.WINDOW, { maxLines: 1 });
this.message.setOrigin(0, 1); this.message.setOrigin(0, 1);

View File

@ -261,7 +261,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.starterSelectMessageBoxContainer.setVisible(false); this.starterSelectMessageBoxContainer.setVisible(false);
this.starterSelectContainer.add(this.starterSelectMessageBoxContainer); 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); starterSelectMessageBox.setOrigin(0, 1);
this.starterSelectMessageBoxContainer.add(starterSelectMessageBox); this.starterSelectMessageBoxContainer.add(starterSelectMessageBox);