Fix IV text not comparing against starter species
This commit is contained in:
parent
eac9b4d385
commit
3b09e176a2
|
@ -138,9 +138,9 @@ export abstract class PokemonSpeciesForm {
|
||||||
this.genderDiffs = genderDiffs;
|
this.genderDiffs = genderDiffs;
|
||||||
}
|
}
|
||||||
|
|
||||||
getRootSpeciesId(): Species {
|
getRootSpeciesId(forStarter: boolean = false): Species {
|
||||||
let ret = this.speciesId;
|
let ret = this.speciesId;
|
||||||
while (pokemonPrevolutions.hasOwnProperty(ret))
|
while (pokemonPrevolutions.hasOwnProperty(ret) && (!forStarter || !speciesStarters.hasOwnProperty(ret)))
|
||||||
ret = pokemonPrevolutions[ret];
|
ret = pokemonPrevolutions[ret];
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import * as Utils from "../utils";
|
||||||
import MessageUiHandler from "./message-ui-handler";
|
import MessageUiHandler from "./message-ui-handler";
|
||||||
import { getStatName, Stat } from "../data/pokemon-stat";
|
import { getStatName, Stat } from "../data/pokemon-stat";
|
||||||
import { addWindow } from "./ui-theme";
|
import { addWindow } from "./ui-theme";
|
||||||
|
import BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext";
|
||||||
|
|
||||||
export default class BattleMessageUiHandler extends MessageUiHandler {
|
export default class BattleMessageUiHandler extends MessageUiHandler {
|
||||||
private levelUpStatsContainer: Phaser.GameObjects.Container;
|
private levelUpStatsContainer: Phaser.GameObjects.Container;
|
||||||
|
@ -223,8 +224,9 @@ export default class BattleMessageUiHandler extends MessageUiHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
getIvDescriptor(value: integer, typeIv: integer): string {
|
getIvDescriptor(value: integer, typeIv: integer): string {
|
||||||
let starterIvs: number[] = this.scene.gameData.dexData[this.scene.getEnemyPokemon().species.speciesId].ivs;
|
const starterSpecies = this.scene.getEnemyPokemon().species.getRootSpeciesId(true);
|
||||||
let uiTheme = (this.scene as BattleScene).uiTheme; // Assuming uiTheme is accessible
|
const starterIvs: number[] = this.scene.gameData.dexData[starterSpecies].ivs;
|
||||||
|
const uiTheme = (this.scene as BattleScene).uiTheme; // Assuming uiTheme is accessible
|
||||||
|
|
||||||
// Function to wrap text in color based on comparison
|
// Function to wrap text in color based on comparison
|
||||||
const coloredText = (text: string, isBetter: boolean) => {
|
const coloredText = (text: string, isBetter: boolean) => {
|
||||||
|
|
|
@ -161,8 +161,9 @@ export default class PokemonInfoContainer extends Phaser.GameObjects.Container {
|
||||||
if (isFusion)
|
if (isFusion)
|
||||||
this.pokemonFusionShinyIcon.setTint(getVariantTint(pokemon.fusionVariant));
|
this.pokemonFusionShinyIcon.setTint(getVariantTint(pokemon.fusionVariant));
|
||||||
|
|
||||||
const originalIvs: integer[] = this.scene.gameData.dexData[pokemon.species.speciesId].caughtAttr
|
const starterSpeciesId = pokemon.species.getRootSpeciesId(true);
|
||||||
? this.scene.gameData.dexData[pokemon.species.speciesId].ivs
|
const originalIvs: integer[] = this.scene.gameData.dexData[starterSpeciesId].caughtAttr
|
||||||
|
? this.scene.gameData.dexData[starterSpeciesId].ivs
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
this.statsContainer.updateIvs(pokemon.ivs, originalIvs);
|
this.statsContainer.updateIvs(pokemon.ivs, originalIvs);
|
||||||
|
|
Loading…
Reference in New Issue