mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-02-18 02:07:44 +00:00
Fix crash when using enemy move override (#4352)
Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com>
This commit is contained in:
parent
23b64b94b5
commit
59f28efa1d
@ -915,12 +915,12 @@ export abstract class BattleAnim {
|
|||||||
this.srcLine = [ userFocusX, userFocusY, targetFocusX, targetFocusY ];
|
this.srcLine = [ userFocusX, userFocusY, targetFocusX, targetFocusY ];
|
||||||
this.dstLine = [ userInitialX, userInitialY, targetInitialX, targetInitialY ];
|
this.dstLine = [ userInitialX, userInitialY, targetInitialX, targetInitialY ];
|
||||||
|
|
||||||
let r = anim!.frames.length; // TODO: is this bang correct?
|
let r = anim?.frames.length ?? 0;
|
||||||
let f = 0;
|
let f = 0;
|
||||||
|
|
||||||
scene.tweens.addCounter({
|
scene.tweens.addCounter({
|
||||||
duration: Utils.getFrameMs(3),
|
duration: Utils.getFrameMs(3),
|
||||||
repeat: anim!.frames.length, // TODO: is this bang correct?
|
repeat: anim?.frames.length ?? 0,
|
||||||
onRepeat: () => {
|
onRepeat: () => {
|
||||||
if (!f) {
|
if (!f) {
|
||||||
userSprite.setVisible(false);
|
userSprite.setVisible(false);
|
||||||
@ -1264,7 +1264,7 @@ export class CommonBattleAnim extends BattleAnim {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getAnim(): AnimConfig | null {
|
getAnim(): AnimConfig | null {
|
||||||
return this.commonAnim ? commonAnims.get(this.commonAnim)! : null; // TODO: is this bang correct?
|
return this.commonAnim ? commonAnims.get(this.commonAnim) ?? null : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
isOppAnim(): boolean {
|
isOppAnim(): boolean {
|
||||||
@ -1284,7 +1284,7 @@ export class MoveAnim extends BattleAnim {
|
|||||||
getAnim(): AnimConfig {
|
getAnim(): AnimConfig {
|
||||||
return moveAnims.get(this.move) instanceof AnimConfig
|
return moveAnims.get(this.move) instanceof AnimConfig
|
||||||
? moveAnims.get(this.move) as AnimConfig
|
? moveAnims.get(this.move) as AnimConfig
|
||||||
: moveAnims.get(this.move)![this.user?.isPlayer() ? 0 : 1] as AnimConfig; // TODO: is this bang correct?
|
: moveAnims.get(this.move)?.[this.user?.isPlayer() ? 0 : 1] as AnimConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
isOppAnim(): boolean {
|
isOppAnim(): boolean {
|
||||||
@ -1316,7 +1316,7 @@ export class MoveChargeAnim extends MoveAnim {
|
|||||||
getAnim(): AnimConfig {
|
getAnim(): AnimConfig {
|
||||||
return chargeAnims.get(this.chargeAnim) instanceof AnimConfig
|
return chargeAnims.get(this.chargeAnim) instanceof AnimConfig
|
||||||
? chargeAnims.get(this.chargeAnim) as AnimConfig
|
? chargeAnims.get(this.chargeAnim) as AnimConfig
|
||||||
: chargeAnims.get(this.chargeAnim)![this.user?.isPlayer() ? 0 : 1] as AnimConfig; // TODO: is this bang correct?
|
: chargeAnims.get(this.chargeAnim)?.[this.user?.isPlayer() ? 0 : 1] as AnimConfig;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user