[Bug] fix starter select alpha in challenge modes (#2924)

* fix starter select alpha in challenge modes

* [NIT] resolve review comment

https://github.com/pagefaultgames/pokerogue/pull/2924#discussion_r1670587051

* chore
This commit is contained in:
flx-sta 2024-07-09 11:05:45 -07:00 committed by GitHub
parent 0c18e95fa4
commit 18dcef5b4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -2322,10 +2322,13 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
const isValidForChallenge = new Utils.BooleanHolder(true);
const currentPartyValue = this.starterGens.reduce((total: number, gen: number, i: number) => total += this.scene.gameData.getSpeciesStarterValue(this.genSpecies[gen][this.starterCursors[i]].speciesId), 0);
const cursorCost = this.scene.gameData.getSpeciesStarterValue(species.speciesId);
const isValidNextPartyValue = (currentPartyValue + cursorCost) <= this.getValueLimit();
Challenge.applyChallenges(this.scene.gameMode, Challenge.ChallengeType.STARTER_CHOICE, species, isValidForChallenge, this.scene.gameData.getSpeciesDexAttrProps(species, this.dexAttrCursor), this.starterGens.length);
const starterSprite = this.starterSelectGenIconContainers[this.getGenCursorWithScroll()].getAt(this.cursor) as Phaser.GameObjects.Sprite;
starterSprite.setTexture(species.getIconAtlasKey(formIndex, shiny, variant), species.getIconId(female, formIndex, shiny, variant));
starterSprite.setAlpha(isValidForChallenge.value ? 1 : 0.375);
starterSprite.setAlpha(isValidForChallenge.value && isValidNextPartyValue ? 1 : 0.375);
this.checkIconId((this.starterSelectGenIconContainers[this.getGenCursorWithScroll()].getAt(this.cursor) as Phaser.GameObjects.Sprite), species, female, formIndex, shiny, variant);
this.canCycleShiny = !!(dexEntry.caughtAttr & DexAttr.NON_SHINY && dexEntry.caughtAttr & DexAttr.SHINY);
this.canCycleGender = !!(dexEntry.caughtAttr & DexAttr.MALE && dexEntry.caughtAttr & DexAttr.FEMALE);