mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-25 08:16:04 +00:00
starter select defaults to shiny with highest variant again (#4001)
This commit is contained in:
parent
200deef0ed
commit
1055386949
@ -53,9 +53,6 @@ describe("UI - Starter select", () => {
|
|||||||
const handler = game.scene.ui.getHandler() as StarterSelectUiHandler;
|
const handler = game.scene.ui.getHandler() as StarterSelectUiHandler;
|
||||||
handler.processInput(Button.RIGHT);
|
handler.processInput(Button.RIGHT);
|
||||||
handler.processInput(Button.LEFT);
|
handler.processInput(Button.LEFT);
|
||||||
handler.processInput(Button.CYCLE_SHINY);
|
|
||||||
handler.processInput(Button.V);
|
|
||||||
handler.processInput(Button.V);
|
|
||||||
handler.processInput(Button.ACTION);
|
handler.processInput(Button.ACTION);
|
||||||
game.phaseInterceptor.unlock();
|
game.phaseInterceptor.unlock();
|
||||||
});
|
});
|
||||||
@ -117,9 +114,6 @@ describe("UI - Starter select", () => {
|
|||||||
handler.processInput(Button.RIGHT);
|
handler.processInput(Button.RIGHT);
|
||||||
handler.processInput(Button.LEFT);
|
handler.processInput(Button.LEFT);
|
||||||
handler.processInput(Button.CYCLE_GENDER);
|
handler.processInput(Button.CYCLE_GENDER);
|
||||||
handler.processInput(Button.CYCLE_SHINY);
|
|
||||||
handler.processInput(Button.V);
|
|
||||||
handler.processInput(Button.V);
|
|
||||||
handler.processInput(Button.ACTION);
|
handler.processInput(Button.ACTION);
|
||||||
game.phaseInterceptor.unlock();
|
game.phaseInterceptor.unlock();
|
||||||
});
|
});
|
||||||
@ -184,9 +178,6 @@ describe("UI - Starter select", () => {
|
|||||||
handler.processInput(Button.CYCLE_GENDER);
|
handler.processInput(Button.CYCLE_GENDER);
|
||||||
handler.processInput(Button.CYCLE_NATURE);
|
handler.processInput(Button.CYCLE_NATURE);
|
||||||
handler.processInput(Button.CYCLE_ABILITY);
|
handler.processInput(Button.CYCLE_ABILITY);
|
||||||
handler.processInput(Button.CYCLE_SHINY);
|
|
||||||
handler.processInput(Button.V);
|
|
||||||
handler.processInput(Button.V);
|
|
||||||
handler.processInput(Button.ACTION);
|
handler.processInput(Button.ACTION);
|
||||||
game.phaseInterceptor.unlock();
|
game.phaseInterceptor.unlock();
|
||||||
});
|
});
|
||||||
@ -227,11 +218,12 @@ describe("UI - Starter select", () => {
|
|||||||
expect(game.scene.getParty()[0].species.speciesId).toBe(Species.BULBASAUR);
|
expect(game.scene.getParty()[0].species.speciesId).toBe(Species.BULBASAUR);
|
||||||
expect(game.scene.getParty()[0].shiny).toBe(true);
|
expect(game.scene.getParty()[0].shiny).toBe(true);
|
||||||
expect(game.scene.getParty()[0].variant).toBe(2);
|
expect(game.scene.getParty()[0].variant).toBe(2);
|
||||||
|
expect(game.scene.getParty()[0].gender).toBe(Gender.FEMALE);
|
||||||
expect(game.scene.getParty()[0].nature).toBe(Nature.LONELY);
|
expect(game.scene.getParty()[0].nature).toBe(Nature.LONELY);
|
||||||
expect(game.scene.getParty()[0].getAbility().id).toBe(Abilities.CHLOROPHYLL);
|
expect(game.scene.getParty()[0].getAbility().id).toBe(Abilities.CHLOROPHYLL);
|
||||||
}, 20000);
|
}, 20000);
|
||||||
|
|
||||||
it("Bulbasaur - shiny - variant 2 female lonely chlorophyl", async() => {
|
it("Bulbasaur - shiny - variant 2 female", async() => {
|
||||||
await game.importData("src/test/utils/saves/everything.prsv");
|
await game.importData("src/test/utils/saves/everything.prsv");
|
||||||
const caughtCount = Object.keys(game.scene.gameData.dexData).filter((key) => {
|
const caughtCount = Object.keys(game.scene.gameData.dexData).filter((key) => {
|
||||||
const species = game.scene.gameData.dexData[key];
|
const species = game.scene.gameData.dexData[key];
|
||||||
@ -249,9 +241,6 @@ describe("UI - Starter select", () => {
|
|||||||
handler.processInput(Button.RIGHT);
|
handler.processInput(Button.RIGHT);
|
||||||
handler.processInput(Button.LEFT);
|
handler.processInput(Button.LEFT);
|
||||||
handler.processInput(Button.CYCLE_GENDER);
|
handler.processInput(Button.CYCLE_GENDER);
|
||||||
handler.processInput(Button.CYCLE_SHINY);
|
|
||||||
handler.processInput(Button.V);
|
|
||||||
handler.processInput(Button.V);
|
|
||||||
handler.processInput(Button.ACTION);
|
handler.processInput(Button.ACTION);
|
||||||
game.phaseInterceptor.unlock();
|
game.phaseInterceptor.unlock();
|
||||||
});
|
});
|
||||||
@ -313,6 +302,7 @@ describe("UI - Starter select", () => {
|
|||||||
handler.processInput(Button.RIGHT);
|
handler.processInput(Button.RIGHT);
|
||||||
handler.processInput(Button.LEFT);
|
handler.processInput(Button.LEFT);
|
||||||
handler.processInput(Button.ACTION);
|
handler.processInput(Button.ACTION);
|
||||||
|
handler.processInput(Button.CYCLE_SHINY);
|
||||||
game.phaseInterceptor.unlock();
|
game.phaseInterceptor.unlock();
|
||||||
});
|
});
|
||||||
await game.phaseInterceptor.run(SelectStarterPhase);
|
await game.phaseInterceptor.run(SelectStarterPhase);
|
||||||
@ -371,7 +361,7 @@ describe("UI - Starter select", () => {
|
|||||||
const handler = game.scene.ui.getHandler() as StarterSelectUiHandler;
|
const handler = game.scene.ui.getHandler() as StarterSelectUiHandler;
|
||||||
handler.processInput(Button.RIGHT);
|
handler.processInput(Button.RIGHT);
|
||||||
handler.processInput(Button.LEFT);
|
handler.processInput(Button.LEFT);
|
||||||
handler.processInput(Button.CYCLE_SHINY);
|
handler.processInput(Button.V);
|
||||||
handler.processInput(Button.V);
|
handler.processInput(Button.V);
|
||||||
handler.processInput(Button.ACTION);
|
handler.processInput(Button.ACTION);
|
||||||
game.phaseInterceptor.unlock();
|
game.phaseInterceptor.unlock();
|
||||||
@ -415,7 +405,7 @@ describe("UI - Starter select", () => {
|
|||||||
expect(game.scene.getParty()[0].variant).toBe(1);
|
expect(game.scene.getParty()[0].variant).toBe(1);
|
||||||
}, 20000);
|
}, 20000);
|
||||||
|
|
||||||
it("Bulbasaur - shiny - variant 2", async() => {
|
it("Bulbasaur - shiny - variant 0", async() => {
|
||||||
await game.importData("src/test/utils/saves/everything.prsv");
|
await game.importData("src/test/utils/saves/everything.prsv");
|
||||||
const caughtCount = Object.keys(game.scene.gameData.dexData).filter((key) => {
|
const caughtCount = Object.keys(game.scene.gameData.dexData).filter((key) => {
|
||||||
const species = game.scene.gameData.dexData[key];
|
const species = game.scene.gameData.dexData[key];
|
||||||
@ -432,8 +422,6 @@ describe("UI - Starter select", () => {
|
|||||||
const handler = game.scene.ui.getHandler() as StarterSelectUiHandler;
|
const handler = game.scene.ui.getHandler() as StarterSelectUiHandler;
|
||||||
handler.processInput(Button.RIGHT);
|
handler.processInput(Button.RIGHT);
|
||||||
handler.processInput(Button.LEFT);
|
handler.processInput(Button.LEFT);
|
||||||
handler.processInput(Button.CYCLE_SHINY);
|
|
||||||
handler.processInput(Button.V);
|
|
||||||
handler.processInput(Button.V);
|
handler.processInput(Button.V);
|
||||||
handler.processInput(Button.ACTION);
|
handler.processInput(Button.ACTION);
|
||||||
game.phaseInterceptor.unlock();
|
game.phaseInterceptor.unlock();
|
||||||
@ -474,7 +462,7 @@ describe("UI - Starter select", () => {
|
|||||||
|
|
||||||
expect(game.scene.getParty()[0].species.speciesId).toBe(Species.BULBASAUR);
|
expect(game.scene.getParty()[0].species.speciesId).toBe(Species.BULBASAUR);
|
||||||
expect(game.scene.getParty()[0].shiny).toBe(true);
|
expect(game.scene.getParty()[0].shiny).toBe(true);
|
||||||
expect(game.scene.getParty()[0].variant).toBe(2);
|
expect(game.scene.getParty()[0].variant).toBe(0);
|
||||||
}, 20000);
|
}, 20000);
|
||||||
|
|
||||||
it("Check if first pokemon in party is caterpie from gen 1 and 1rd row, 3rd column", async() => {
|
it("Check if first pokemon in party is caterpie from gen 1 and 1rd row, 3rd column", async() => {
|
||||||
|
@ -1853,10 +1853,14 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
switch (button) {
|
switch (button) {
|
||||||
case Button.CYCLE_SHINY:
|
case Button.CYCLE_SHINY:
|
||||||
if (this.canCycleShiny) {
|
if (this.canCycleShiny) {
|
||||||
const newVariant = starterAttributes.variant ? starterAttributes.variant as Variant : props.variant;
|
starterAttributes.shiny = starterAttributes.shiny !== undefined ? !starterAttributes.shiny : false;
|
||||||
starterAttributes.shiny = starterAttributes.shiny ? !starterAttributes.shiny : true;
|
|
||||||
this.setSpeciesDetails(this.lastSpecies, !props.shiny, undefined, undefined, props.shiny ? 0 : newVariant, undefined, undefined);
|
|
||||||
if (starterAttributes.shiny) {
|
if (starterAttributes.shiny) {
|
||||||
|
// Change to shiny, we need to get the proper default variant
|
||||||
|
const newProps = this.scene.gameData.getSpeciesDexAttrProps(this.lastSpecies, this.getCurrentDexProps(this.lastSpecies.speciesId));
|
||||||
|
const newVariant = starterAttributes.variant ? starterAttributes.variant as Variant : newProps.variant;
|
||||||
|
this.setSpeciesDetails(this.lastSpecies, true, undefined, undefined, newVariant, undefined, undefined);
|
||||||
|
|
||||||
this.scene.playSound("se/sparkle");
|
this.scene.playSound("se/sparkle");
|
||||||
// Set the variant label to the shiny tint
|
// Set the variant label to the shiny tint
|
||||||
const tint = getVariantTint(newVariant);
|
const tint = getVariantTint(newVariant);
|
||||||
@ -1864,6 +1868,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
this.pokemonShinyIcon.setTint(tint);
|
this.pokemonShinyIcon.setTint(tint);
|
||||||
this.pokemonShinyIcon.setVisible(true);
|
this.pokemonShinyIcon.setVisible(true);
|
||||||
} else {
|
} else {
|
||||||
|
this.setSpeciesDetails(this.lastSpecies, false, undefined, undefined, 0, undefined, undefined);
|
||||||
this.pokemonShinyIcon.setVisible(false);
|
this.pokemonShinyIcon.setVisible(false);
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
@ -3487,23 +3492,22 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
props += DexAttr.MALE;
|
props += DexAttr.MALE;
|
||||||
}
|
}
|
||||||
/* This part is very similar to above, but instead of for gender, it checks for shiny within starter preferences.
|
/* This part is very similar to above, but instead of for gender, it checks for shiny within starter preferences.
|
||||||
* If they're not there, it checks the caughtAttr for shiny only (i.e. SHINY === true && NON_SHINY === false)
|
* If they're not there, it enables shiny state by default if any shiny was caught
|
||||||
*/
|
*/
|
||||||
if (this.starterPreferences[speciesId]?.shiny || ((caughtAttr & DexAttr.SHINY) > 0n && (caughtAttr & DexAttr.NON_SHINY) === 0n)) {
|
if (this.starterPreferences[speciesId]?.shiny || ((caughtAttr & DexAttr.SHINY) > 0n && this.starterPreferences[speciesId]?.shiny !== false)) {
|
||||||
props += DexAttr.SHINY;
|
props += DexAttr.SHINY;
|
||||||
if (this.starterPreferences[speciesId]?.variant) {
|
if (this.starterPreferences[speciesId]?.variant !== undefined) {
|
||||||
props += BigInt(Math.pow(2, this.starterPreferences[speciesId]?.variant)) * DexAttr.DEFAULT_VARIANT;
|
props += BigInt(Math.pow(2, this.starterPreferences[speciesId]?.variant)) * DexAttr.DEFAULT_VARIANT;
|
||||||
} else {
|
} else {
|
||||||
/* This calculates the correct variant if there's no starter preferences for it.
|
/* This calculates the correct variant if there's no starter preferences for it.
|
||||||
* This gets the lowest tier variant that you've caught (in line with other mechanics) and adds it to the temp props
|
* This gets the highest tier variant that you've caught and adds it to the temp props
|
||||||
*/
|
*/
|
||||||
if ((caughtAttr & DexAttr.DEFAULT_VARIANT) > 0) {
|
if ((caughtAttr & DexAttr.VARIANT_3) > 0) {
|
||||||
props += DexAttr.DEFAULT_VARIANT;
|
|
||||||
}
|
|
||||||
if ((caughtAttr & DexAttr.VARIANT_2) > 0) {
|
|
||||||
props += DexAttr.VARIANT_2;
|
|
||||||
} else if ((caughtAttr & DexAttr.VARIANT_3) > 0) {
|
|
||||||
props += DexAttr.VARIANT_3;
|
props += DexAttr.VARIANT_3;
|
||||||
|
} else if ((caughtAttr & DexAttr.VARIANT_2) > 0) {
|
||||||
|
props += DexAttr.VARIANT_2;
|
||||||
|
} else {
|
||||||
|
props += DexAttr.DEFAULT_VARIANT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user