Fix crash for edge case with double battles
This commit is contained in:
parent
9e0a8a3030
commit
969d54dd2e
|
@ -1749,6 +1749,8 @@ export class FaintPhase extends PokemonPhase {
|
|||
this.scene.unshiftPhase(new GameOverPhase(this.scene));
|
||||
else if (nonFaintedPartyMemberCount >= this.scene.currentBattle.getBattlerCount())
|
||||
this.scene.unshiftPhase(new SwitchPhase(this.scene, this.fieldIndex, true, false));
|
||||
else if (nonFaintedPartyMemberCount === 1 && this.scene.currentBattle.double)
|
||||
this.scene.unshiftPhase(new ToggleDoublePositionPhase(this.scene, false));
|
||||
} else
|
||||
this.scene.unshiftPhase(new VictoryPhase(this.scene, this.battlerIndex));
|
||||
|
||||
|
|
|
@ -361,17 +361,6 @@ export default class BattleScene extends Phaser.Scene {
|
|||
field.add(a);
|
||||
});
|
||||
|
||||
if (this.quickStart) {
|
||||
for (let s = 0; s < 3; s++) {
|
||||
const playerSpecies = getPokemonSpecies((getPokemonSpecies(s === 0 ? Species.TORCHIC : s === 1 ? Species.TREECKO : Species.MUDKIP)).getSpeciesForLevel(startingLevel, true));
|
||||
const playerPokemon = new PlayerPokemon(this, playerSpecies, startingLevel, 0, 0);
|
||||
playerPokemon.setVisible(false);
|
||||
loadPokemonAssets.push(playerPokemon.loadAssets());
|
||||
|
||||
this.party.push(playerPokemon);
|
||||
}
|
||||
}
|
||||
|
||||
const trainerPbFrameNames = this.anims.generateFrameNames('trainer_m_pb', { zeroPad: 2, start: 1, end: 12 });
|
||||
this.anims.create({
|
||||
key: 'trainer_m_pb',
|
||||
|
@ -396,6 +385,17 @@ export default class BattleScene extends Phaser.Scene {
|
|||
|
||||
this.reset();
|
||||
|
||||
if (this.quickStart) {
|
||||
for (let s = 0; s < 3; s++) {
|
||||
const playerSpecies = this.randomSpecies(startingWave, startingLevel, false);
|
||||
const playerPokemon = new PlayerPokemon(this, playerSpecies, startingLevel, 0, 0);
|
||||
playerPokemon.setVisible(false);
|
||||
this.party.push(playerPokemon);
|
||||
|
||||
loadPokemonAssets.push(playerPokemon.loadAssets());
|
||||
}
|
||||
}
|
||||
|
||||
const ui = new UI(this);
|
||||
this.uiContainer.add(ui);
|
||||
|
||||
|
|
|
@ -2581,7 +2581,7 @@ export function initMoves() {
|
|||
.attr(StealHeldItemAttr),
|
||||
new StatusMove(Moves.SPIDER_WEB, "Spider Web", Type.BUG, -1, 10, -1, "Opponent cannot escape/switch.", -1, 0, 2)
|
||||
.attr(AddBattlerTagAttr, BattlerTagType.TRAPPED, false, 1, true),
|
||||
new SelfStatusMove(Moves.MIND_READER, "Mind Reader", Type.NORMAL, -1, 5, -1, "User's next attack is guaranteed to hit.", -1, 0, 2)
|
||||
new StatusMove(Moves.MIND_READER, "Mind Reader", Type.NORMAL, -1, 5, -1, "User's next attack is guaranteed to hit.", -1, 0, 2)
|
||||
.attr(IgnoreAccuracyAttr),
|
||||
new StatusMove(Moves.NIGHTMARE, "Nightmare", Type.GHOST, 100, 15, -1, "The sleeping opponent loses 25% of its max HP each turn.", -1, 0, 2)
|
||||
.attr(AddBattlerTagAttr, BattlerTagType.NIGHTMARE)
|
||||
|
@ -2643,7 +2643,7 @@ export function initMoves() {
|
|||
new AttackMove(Moves.BONE_RUSH, "Bone Rush", Type.GROUND, MoveCategory.PHYSICAL, 25, 90, 10, -1, "Hits 2-5 times in one turn.", -1, 0, 2)
|
||||
.attr(MultiHitAttr)
|
||||
.makesContact(false),
|
||||
new SelfStatusMove(Moves.LOCK_ON, "Lock-On", Type.NORMAL, -1, 5, -1, "User's next attack is guaranteed to hit.", -1, 0, 2)
|
||||
new StatusMove(Moves.LOCK_ON, "Lock-On", Type.NORMAL, -1, 5, -1, "User's next attack is guaranteed to hit.", -1, 0, 2)
|
||||
.attr(IgnoreAccuracyAttr),
|
||||
new AttackMove(Moves.OUTRAGE, "Outrage", Type.DRAGON, MoveCategory.PHYSICAL, 120, 100, 10, 156, "User attacks for 2-3 turns but then becomes confused.", -1, 0, 2)
|
||||
.attr(FrenzyAttr)
|
||||
|
|
Loading…
Reference in New Issue