diff --git a/src/data/ability.ts b/src/data/ability.ts index 8f49e2dfd9a..61bd215caf3 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -2645,6 +2645,8 @@ function getAnticipationCondition(): AbAttrCondition { return (pokemon: Pokemon) => { for (const opponent of pokemon.getOpponents()) { for (const move of opponent.moveset) { + if (move == undefined) + continue; // move is super effective if (move.getMove() instanceof AttackMove && pokemon.getAttackTypeEffectiveness(move.getMove().type, opponent, true) >= 2) { return true; diff --git a/src/phases.ts b/src/phases.ts index 5277e35fde6..01349fa2555 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -2406,6 +2406,27 @@ export class CheckSwitchPhase extends BattlePhase { pk.getBattleInfo().flyoutMenu.flyoutText[2].setColor("#e8e8a8") } } + if (false) { + this.scene.pokemonInfoContainer.show(this.scene.getEnemyField()[0], false, 1, true); + if (this.scene.getEnemyField()[1] != undefined) { + this.scene.tweens.add({ + targets: this.scene.pokemonInfoContainer, + alpha: 1, + duration: 5000, + onComplete: () => { + this.scene.pokemonInfoContainer.hide(1.3) + this.scene.tweens.add({ + targets: this.scene.pokemonInfoContainer, + alpha: 1, + duration: 1000, + onComplete: () => { + this.scene.pokemonInfoContainer.show(this.scene.getEnemyField()[1], false, 1, true); + } + }) + } + }) + } + } this.scene.ui.showText(i18next.t("battle:switchQuestion", { pokemonName: this.useName ? pokemon.name : i18next.t("battle:pokemon") }), null, () => { this.scene.ui.setMode(Mode.CONFIRM, () => { @@ -2421,6 +2442,7 @@ export class CheckSwitchPhase extends BattlePhase { this.scene.getEnemyField()[i].getBattleInfo().flyoutMenu.flyoutText[3].text = "???" this.scene.getEnemyField()[i].getBattleInfo().flyoutMenu.flyoutText[2].setColor("#f8f8f8") } + //this.scene.pokemonInfoContainer.hide() this.end(); }, () => { this.scene.ui.setMode(Mode.MESSAGE); @@ -2432,6 +2454,7 @@ export class CheckSwitchPhase extends BattlePhase { this.scene.getEnemyField()[i].getBattleInfo().flyoutMenu.flyoutText[3].text = "???" this.scene.getEnemyField()[i].getBattleInfo().flyoutMenu.flyoutText[2].setColor("#f8f8f8") } + //this.scene.pokemonInfoContainer.hide() this.end(); }); }); diff --git a/src/ui/pokemon-info-container.ts b/src/ui/pokemon-info-container.ts index 9f4df2b20b4..30d1c956791 100644 --- a/src/ui/pokemon-info-container.ts +++ b/src/ui/pokemon-info-container.ts @@ -207,7 +207,7 @@ export default class PokemonInfoContainer extends Phaser.GameObjects.Container { this.setVisible(false); } - show(pokemon: Pokemon, showMoves: boolean = false, speedMultiplier: number = 1): Promise { + show(pokemon: Pokemon, showMoves: boolean = false, speedMultiplier: number = 1, lessInfo: boolean = false): Promise { return new Promise(resolve => { const caughtAttr = BigInt(pokemon.scene.gameData.dexData[pokemon.species.speciesId].caughtAttr); if (pokemon.gender > Gender.GENDERLESS) { @@ -290,6 +290,11 @@ export default class PokemonInfoContainer extends Phaser.GameObjects.Container { this.pokemonNatureLabelText.setColor(getTextColor(TextStyle.WINDOW, false, this.scene.uiTheme)); this.pokemonNatureLabelText.setShadowColor(getTextColor(TextStyle.WINDOW, true, this.scene.uiTheme)); } + + this.pokemonAbilityText.setVisible(!lessInfo) + this.pokemonAbilityLabelText.setVisible(!lessInfo) + this.pokemonNatureText.setVisible(!lessInfo) + this.pokemonNatureLabelText.setVisible(!lessInfo) const isFusion = pokemon.isFusion(); const doubleShiny = isFusion && pokemon.shiny && pokemon.fusionShiny; @@ -328,7 +333,11 @@ export default class PokemonInfoContainer extends Phaser.GameObjects.Container { ? this.scene.gameData.dexData[starterSpeciesId].ivs : null; - this.statsContainer.updateIvs(pokemon.ivs, originalIvs); + if (lessInfo) { + this.statsContainer.updateIvs(pokemon.species.baseStats, undefined, 255); + } else { + this.statsContainer.updateIvs(pokemon.ivs, originalIvs); + } this.scene.tweens.add({ targets: this, diff --git a/src/ui/stats-container.ts b/src/ui/stats-container.ts index b4e799bafc0..f94861cdc4b 100644 --- a/src/ui/stats-container.ts +++ b/src/ui/stats-container.ts @@ -65,9 +65,10 @@ export class StatsContainer extends Phaser.GameObjects.Container { }); } - updateIvs(ivs: integer[], originalIvs?: integer[]): void { + updateIvs(ivs: integer[], originalIvs?: integer[], max?: integer): void { if (ivs) { - const ivChartData = new Array(6).fill(null).map((_, i) => [ (ivs[ivChartStatIndexes[i]] / 31) * ivChartSize * ivChartStatCoordMultipliers[ivChartStatIndexes[i]][0], (ivs[ivChartStatIndexes[i]] / 31) * ivChartSize * ivChartStatCoordMultipliers[ivChartStatIndexes[i]][1] ] ).flat(); + var maxIV = max || 31 + const ivChartData = new Array(6).fill(null).map((_, i) => [ (ivs[ivChartStatIndexes[i]] / maxIV) * ivChartSize * ivChartStatCoordMultipliers[ivChartStatIndexes[i]][0], (ivs[ivChartStatIndexes[i]] / maxIV) * ivChartSize * ivChartStatCoordMultipliers[ivChartStatIndexes[i]][1] ] ).flat(); const lastIvChartData = this.statsIvsCache || defaultIvChartData; const perfectIVColor: string = getTextColor(TextStyle.SUMMARY_GOLD, false, (this.scene as BattleScene).uiTheme); this.statsIvsCache = ivChartData.slice(0);