mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-19 22:09:27 +02:00
Prevent crash if enemy Future Sight user is caught
This commit is contained in:
parent
89a3edba1c
commit
cb2ae7ec33
@ -3243,11 +3243,14 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
return null;
|
||||
}
|
||||
|
||||
getMoveHistory(): TurnMove[] {
|
||||
public getMoveHistory(): TurnMove[] {
|
||||
return this.battleSummonData.moveHistory;
|
||||
}
|
||||
|
||||
pushMoveHistory(turnMove: TurnMove) {
|
||||
public pushMoveHistory(turnMove: TurnMove): void {
|
||||
if (!this.isOnField()) {
|
||||
return;
|
||||
}
|
||||
turnMove.turn = this.scene.currentBattle?.turn;
|
||||
this.getMoveHistory().push(turnMove);
|
||||
}
|
||||
|
@ -92,8 +92,12 @@ export class MoveEffectPhase extends PokemonPhase {
|
||||
|
||||
const isDelayedAttack = this.move.getMove().hasAttr(DelayedAttackAttr);
|
||||
/** If the user was somehow removed from the field and it's not a delayed attack, end this phase */
|
||||
if (!user.isOnField() && !isDelayedAttack) {
|
||||
return super.end();
|
||||
if (!user.isOnField()) {
|
||||
if (!isDelayedAttack) {
|
||||
return super.end();
|
||||
} else {
|
||||
user.resetTurnData();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -174,7 +178,7 @@ export class MoveEffectPhase extends PokemonPhase {
|
||||
|
||||
const playOnEmptyField = this.scene.currentBattle?.mysteryEncounter?.hasBattleAnimationsWithoutTargets ?? false;
|
||||
// Move animation only needs one target
|
||||
new MoveAnim(move.id as Moves, user, this.getFirstTarget()!.getBattlerIndex()!, playOnEmptyField).play(this.scene, move.hitsSubstitute(user, this.getFirstTarget()!), () => {
|
||||
new MoveAnim(move.id as Moves, user, this.getFirstTarget()!.getBattlerIndex(), playOnEmptyField).play(this.scene, move.hitsSubstitute(user, this.getFirstTarget()!), () => {
|
||||
/** Has the move successfully hit a target (for damage) yet? */
|
||||
let hasHit: boolean = false;
|
||||
for (const target of targets) {
|
||||
|
Loading…
Reference in New Issue
Block a user