mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-29 19:52:27 +02:00
Merging shiny and variant buttons
This commit is contained in:
parent
bd61ac6c9f
commit
e0c2343827
@ -223,7 +223,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
private canCycleShiny: boolean;
|
private canCycleShiny: boolean;
|
||||||
private canCycleForm: boolean;
|
private canCycleForm: boolean;
|
||||||
private canCycleGender: boolean;
|
private canCycleGender: boolean;
|
||||||
private canCycleVariant: boolean;
|
|
||||||
|
|
||||||
private assetLoadCancelled: BooleanHolder | null;
|
private assetLoadCancelled: BooleanHolder | null;
|
||||||
public cursorObj: Phaser.GameObjects.Image;
|
public cursorObj: Phaser.GameObjects.Image;
|
||||||
@ -1545,10 +1544,8 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
switch (button) {
|
switch (button) {
|
||||||
case Button.CYCLE_SHINY:
|
case Button.CYCLE_SHINY:
|
||||||
if (this.canCycleShiny) {
|
if (this.canCycleShiny) {
|
||||||
starterAttributes.shiny = starterAttributes.shiny !== undefined ? !starterAttributes.shiny : false;
|
|
||||||
this.savedStarterAttributes.shiny = starterAttributes.shiny;
|
|
||||||
|
|
||||||
if (starterAttributes.shiny) {
|
if (!starterAttributes.shiny) {
|
||||||
// Change to shiny, we need to get the proper default variant
|
// Change to shiny, we need to get the proper default variant
|
||||||
const newVariant = starterAttributes.variant ? starterAttributes.variant as Variant : 0;
|
const newVariant = starterAttributes.variant ? starterAttributes.variant as Variant : 0;
|
||||||
this.setSpeciesDetails(this.species, { shiny: true, variant: newVariant });
|
this.setSpeciesDetails(this.species, { shiny: true, variant: newVariant });
|
||||||
@ -1559,15 +1556,9 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
this.pokemonShinyIcon.setFrame(getVariantIcon(newVariant));
|
this.pokemonShinyIcon.setFrame(getVariantIcon(newVariant));
|
||||||
this.pokemonShinyIcon.setTint(tint);
|
this.pokemonShinyIcon.setTint(tint);
|
||||||
this.pokemonShinyIcon.setVisible(true);
|
this.pokemonShinyIcon.setVisible(true);
|
||||||
|
|
||||||
|
starterAttributes.shiny = true;
|
||||||
} else {
|
} else {
|
||||||
this.setSpeciesDetails(this.species, { shiny: false, variant: 0 });
|
|
||||||
this.pokemonShinyIcon.setVisible(false);
|
|
||||||
success = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Button.V:
|
|
||||||
if (this.canCycleVariant) {
|
|
||||||
let newVariant = props.variant;
|
let newVariant = props.variant;
|
||||||
do {
|
do {
|
||||||
newVariant = (newVariant + 1) % 3;
|
newVariant = (newVariant + 1) % 3;
|
||||||
@ -1585,14 +1576,25 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (newVariant !== props.variant);
|
} while (newVariant !== props.variant);
|
||||||
|
|
||||||
starterAttributes.variant = newVariant; // store the selected variant
|
starterAttributes.variant = newVariant; // store the selected variant
|
||||||
this.savedStarterAttributes.variant = starterAttributes.variant;
|
this.savedStarterAttributes.variant = starterAttributes.variant;
|
||||||
|
if (newVariant > props.variant) {
|
||||||
this.setSpeciesDetails(this.species, { variant: newVariant as Variant });
|
this.setSpeciesDetails(this.species, { variant: newVariant as Variant });
|
||||||
// Cycle tint based on current sprite tint
|
// Cycle tint based on current sprite tint
|
||||||
const tint = getVariantTint(newVariant as Variant);
|
const tint = getVariantTint(newVariant as Variant);
|
||||||
this.pokemonShinyIcon.setFrame(getVariantIcon(newVariant as Variant));
|
this.pokemonShinyIcon.setFrame(getVariantIcon(newVariant as Variant));
|
||||||
this.pokemonShinyIcon.setTint(tint);
|
this.pokemonShinyIcon.setTint(tint);
|
||||||
success = true;
|
success = true;
|
||||||
|
} else {
|
||||||
|
this.setSpeciesDetails(this.species, { shiny: false, variant: 0 });
|
||||||
|
this.pokemonShinyIcon.setVisible(false);
|
||||||
|
success = true;
|
||||||
|
|
||||||
|
starterAttributes.shiny = false;
|
||||||
|
this.savedStarterAttributes.shiny = starterAttributes.shiny;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Button.CYCLE_FORM:
|
case Button.CYCLE_FORM:
|
||||||
@ -1828,9 +1830,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
case SettingKeyboard.Button_Cycle_Gender:
|
case SettingKeyboard.Button_Cycle_Gender:
|
||||||
iconPath = "G.png";
|
iconPath = "G.png";
|
||||||
break;
|
break;
|
||||||
case SettingKeyboard.Button_Cycle_Variant:
|
|
||||||
iconPath = "V.png";
|
|
||||||
break;
|
|
||||||
case SettingKeyboard.Button_Cycle_Ability:
|
case SettingKeyboard.Button_Cycle_Ability:
|
||||||
iconPath = "E.png";
|
iconPath = "E.png";
|
||||||
break;
|
break;
|
||||||
@ -1885,9 +1884,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
if (this.canCycleGender) {
|
if (this.canCycleGender) {
|
||||||
this.updateButtonIcon(SettingKeyboard.Button_Cycle_Gender, gamepadType, this.genderIconElement, this.genderLabel);
|
this.updateButtonIcon(SettingKeyboard.Button_Cycle_Gender, gamepadType, this.genderIconElement, this.genderLabel);
|
||||||
}
|
}
|
||||||
if (this.canCycleVariant) {
|
|
||||||
this.updateButtonIcon(SettingKeyboard.Button_Cycle_Variant, gamepadType, this.variantIconElement, this.variantLabel);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (this.canCycleForm) {
|
if (this.canCycleForm) {
|
||||||
this.updateButtonIcon(SettingKeyboard.Button_Cycle_Form, gamepadType, this.formIconElement, this.formLabel);
|
this.updateButtonIcon(SettingKeyboard.Button_Cycle_Form, gamepadType, this.formIconElement, this.formLabel);
|
||||||
@ -2232,12 +2228,8 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
|
|
||||||
const isNonShinyCaught = !!(caughtAttr & DexAttr.NON_SHINY);
|
const isNonShinyCaught = !!(caughtAttr & DexAttr.NON_SHINY);
|
||||||
const isShinyCaught = !!(caughtAttr & DexAttr.SHINY);
|
const isShinyCaught = !!(caughtAttr & DexAttr.SHINY);
|
||||||
const isVariant1Caught = isShinyCaught && !!(caughtAttr & DexAttr.DEFAULT_VARIANT);
|
|
||||||
const isVariant2Caught = isShinyCaught && !!(caughtAttr & DexAttr.VARIANT_2);
|
|
||||||
const isVariant3Caught = isShinyCaught && !!(caughtAttr & DexAttr.VARIANT_3);
|
|
||||||
|
|
||||||
this.canCycleShiny = isNonShinyCaught && isShinyCaught;
|
this.canCycleShiny = isNonShinyCaught && isShinyCaught;
|
||||||
this.canCycleVariant = !!shiny && [ isVariant1Caught, isVariant2Caught, isVariant3Caught ].filter(v => v).length > 1;
|
|
||||||
|
|
||||||
const isMaleCaught = !!(caughtAttr & DexAttr.MALE);
|
const isMaleCaught = !!(caughtAttr & DexAttr.MALE);
|
||||||
const isFemaleCaught = !!(caughtAttr & DexAttr.FEMALE);
|
const isFemaleCaught = !!(caughtAttr & DexAttr.FEMALE);
|
||||||
|
Loading…
Reference in New Issue
Block a user