Fix issue with undefined variant

pull/192/head
Flashfyre 2024-04-19 01:25:19 -04:00
parent b546203118
commit 6220165315
2 changed files with 14 additions and 14 deletions

View File

@ -551,18 +551,18 @@ export default class BattleScene extends SceneBase {
hasExpSprite(key: string): boolean { hasExpSprite(key: string): boolean {
const keyMatch = /^pkmn__?(back__)?(shiny__)?(female__)?(\d+)(\-.*?)?(?:_[1-3])?$/g.exec(key); const keyMatch = /^pkmn__?(back__)?(shiny__)?(female__)?(\d+)(\-.*?)?(?:_[1-3])?$/g.exec(key);
let k = keyMatch[4]; let k = keyMatch[4];
if (keyMatch[2]) if (keyMatch[2])
k += 's'; k += 's';
if (keyMatch[1]) if (keyMatch[1])
k += 'b'; k += 'b';
if (keyMatch[3]) if (keyMatch[3])
k += 'f'; k += 'f';
if (keyMatch[5]) if (keyMatch[5])
k += keyMatch[5]; k += keyMatch[5];
if (!expSpriteKeys.includes(k)) if (!expSpriteKeys.includes(k))
return false; return false;
return true; return true;
} }
setupControls() { setupControls() {

View File

@ -162,8 +162,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
if (this.shiny === undefined) if (this.shiny === undefined)
this.trySetShiny(); this.trySetShiny();
if (this.shiny && this.variant === undefined) if (this.variant === undefined)
this.variant = this.generateVariant(); this.variant = this.shiny ? this.generateVariant() : 0;
if (nature !== undefined) if (nature !== undefined)
this.setNature(nature); this.setNature(nature);