mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-27 10:42:25 +02:00
Filtering correctly passive abilities and form abilities. Passive candy symbol is now colored
This commit is contained in:
parent
d1ef1f34fb
commit
4bf332fbc0
@ -28,6 +28,8 @@ export class PokedexMonContainer extends Phaser.GameObjects.Container {
|
|||||||
public tmMove2Icon: Phaser.GameObjects.Image;
|
public tmMove2Icon: Phaser.GameObjects.Image;
|
||||||
public passive1Icon: Phaser.GameObjects.Image;
|
public passive1Icon: Phaser.GameObjects.Image;
|
||||||
public passive2Icon: Phaser.GameObjects.Image;
|
public passive2Icon: Phaser.GameObjects.Image;
|
||||||
|
public passive1OverlayIcon: Phaser.GameObjects.Image;
|
||||||
|
public passive2OverlayIcon: Phaser.GameObjects.Image;
|
||||||
public cost: number = 0;
|
public cost: number = 0;
|
||||||
|
|
||||||
constructor(species: PokemonSpecies, options: SpeciesDetails = {}) {
|
constructor(species: PokemonSpecies, options: SpeciesDetails = {}) {
|
||||||
@ -53,6 +55,7 @@ export class PokedexMonContainer extends Phaser.GameObjects.Container {
|
|||||||
defaultProps.female = female;
|
defaultProps.female = female;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// starter passive bg
|
// starter passive bg
|
||||||
const starterPassiveBg = globalScene.add.image(2, 5, "passive_bg");
|
const starterPassiveBg = globalScene.add.image(2, 5, "passive_bg");
|
||||||
starterPassiveBg.setOrigin(0, 0);
|
starterPassiveBg.setOrigin(0, 0);
|
||||||
@ -161,7 +164,7 @@ export class PokedexMonContainer extends Phaser.GameObjects.Container {
|
|||||||
this.tmMove2Icon = tmMove2Icon;
|
this.tmMove2Icon = tmMove2Icon;
|
||||||
|
|
||||||
|
|
||||||
// move icons
|
// passive icons
|
||||||
const passive1Icon = globalScene.add.image(3, 3, "candy");
|
const passive1Icon = globalScene.add.image(3, 3, "candy");
|
||||||
passive1Icon.setOrigin(0, 0);
|
passive1Icon.setOrigin(0, 0);
|
||||||
passive1Icon.setScale(0.25);
|
passive1Icon.setScale(0.25);
|
||||||
@ -169,13 +172,27 @@ export class PokedexMonContainer extends Phaser.GameObjects.Container {
|
|||||||
this.add(passive1Icon);
|
this.add(passive1Icon);
|
||||||
this.passive1Icon = passive1Icon;
|
this.passive1Icon = passive1Icon;
|
||||||
|
|
||||||
// move icons
|
const passive1OverlayIcon = globalScene.add.image(12, 12, "candy_overlay");
|
||||||
|
passive1OverlayIcon.setOrigin(0, 0);
|
||||||
|
passive1OverlayIcon.setScale(0.25);
|
||||||
|
passive1OverlayIcon.setVisible(false);
|
||||||
|
this.add(passive1OverlayIcon);
|
||||||
|
this.passive1OverlayIcon = passive1OverlayIcon;
|
||||||
|
|
||||||
|
// passive icons
|
||||||
const passive2Icon = globalScene.add.image(12, 3, "candy");
|
const passive2Icon = globalScene.add.image(12, 3, "candy");
|
||||||
passive2Icon.setOrigin(0, 0);
|
passive2Icon.setOrigin(0, 0);
|
||||||
passive2Icon.setScale(0.25);
|
passive2Icon.setScale(0.25);
|
||||||
passive2Icon.setVisible(false);
|
passive2Icon.setVisible(false);
|
||||||
this.add(passive2Icon);
|
this.add(passive2Icon);
|
||||||
this.passive2Icon = passive2Icon;
|
this.passive2Icon = passive2Icon;
|
||||||
|
|
||||||
|
const passive2OverlayIcon = globalScene.add.image(12, 12, "candy_overlay");
|
||||||
|
passive2OverlayIcon.setOrigin(0, 0);
|
||||||
|
passive2OverlayIcon.setScale(0.25);
|
||||||
|
passive2OverlayIcon.setVisible(false);
|
||||||
|
this.add(passive2OverlayIcon);
|
||||||
|
this.passive2OverlayIcon = passive2OverlayIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
checkIconId(female, formIndex, shiny, variant) {
|
checkIconId(female, formIndex, shiny, variant) {
|
||||||
|
@ -1287,13 +1287,14 @@ export default class PokedexUiHandler extends MessageUiHandler {
|
|||||||
const passives = starterPassiveAbilities[this.getStarterSpeciesId(container.species.speciesId)] ?? {} as PassiveAbilities;
|
const passives = starterPassiveAbilities[this.getStarterSpeciesId(container.species.speciesId)] ?? {} as PassiveAbilities;
|
||||||
|
|
||||||
const selectedAbility1 = this.filterText.getValue(FilterTextRow.ABILITY_1);
|
const selectedAbility1 = this.filterText.getValue(FilterTextRow.ABILITY_1);
|
||||||
const fitsFormAbility = container.species.forms.some(form => allAbilities[form.ability1].name === selectedAbility1);
|
const fitsFormAbility1 = container.species.forms.some(form => [ form.ability1, form.ability2, form.abilityHidden ].map(a => allAbilities[a].name).includes(selectedAbility1));
|
||||||
const fitsAbility1 = abilities.includes(selectedAbility1) || fitsFormAbility || selectedAbility1 === this.filterText.defaultText;
|
const fitsAbility1 = abilities.includes(selectedAbility1) || fitsFormAbility1 || selectedAbility1 === this.filterText.defaultText;
|
||||||
const fitsPassive1 = Object.values(passives).some(p => p.name === selectedAbility1);
|
const fitsPassive1 = Object.values(passives).some(p => allAbilities[p].name === selectedAbility1);
|
||||||
|
|
||||||
const selectedAbility2 = this.filterText.getValue(FilterTextRow.ABILITY_2);
|
const selectedAbility2 = this.filterText.getValue(FilterTextRow.ABILITY_2);
|
||||||
const fitsAbility2 = abilities.includes(selectedAbility2) || fitsFormAbility || selectedAbility2 === this.filterText.defaultText;
|
const fitsFormAbility2 = container.species.forms.some(form => [ form.ability1, form.ability2, form.abilityHidden ].map(a => allAbilities[a].name).includes(selectedAbility2));
|
||||||
const fitsPassive2 = Object.values(passives).some(p => p.name === selectedAbility2);
|
const fitsAbility2 = abilities.includes(selectedAbility2) || fitsFormAbility2 || selectedAbility2 === this.filterText.defaultText;
|
||||||
|
const fitsPassive2 = Object.values(passives).some(p => allAbilities[p].name === selectedAbility2);
|
||||||
|
|
||||||
// If both fields have been set to the same ability, show both ability and passive
|
// If both fields have been set to the same ability, show both ability and passive
|
||||||
const fitsAbilities = (fitsAbility1 && (fitsPassive2 || selectedAbility2 === this.filterText.defaultText)) ||
|
const fitsAbilities = (fitsAbility1 && (fitsPassive2 || selectedAbility2 === this.filterText.defaultText)) ||
|
||||||
@ -1301,11 +1302,18 @@ export default class PokedexUiHandler extends MessageUiHandler {
|
|||||||
|
|
||||||
container.passive1Icon.setVisible(false);
|
container.passive1Icon.setVisible(false);
|
||||||
container.passive2Icon.setVisible(false);
|
container.passive2Icon.setVisible(false);
|
||||||
if (fitsPassive1) {
|
if (fitsPassive1 || fitsPassive2) {
|
||||||
container.passive1Icon.setVisible(true);
|
const starterId = starterColors.hasOwnProperty(container.species.speciesId) ? container.species.speciesId : pokemonStarters[container.species.speciesId];
|
||||||
}
|
const colorScheme = starterColors[starterId];
|
||||||
if (fitsPassive2) {
|
if (fitsPassive1) {
|
||||||
container.passive2Icon.setVisible(true);
|
container.passive1Icon.setTint(argbFromRgba(rgbHexToRgba(colorScheme[0])));
|
||||||
|
container.passive1OverlayIcon.setTint(argbFromRgba(rgbHexToRgba(colorScheme[1])));
|
||||||
|
container.passive1Icon.setVisible(true);
|
||||||
|
} else {
|
||||||
|
container.passive2Icon.setTint(argbFromRgba(rgbHexToRgba(colorScheme[0])));
|
||||||
|
container.passive2OverlayIcon.setTint(argbFromRgba(rgbHexToRgba(colorScheme[1])));
|
||||||
|
container.passive2Icon.setVisible(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gen filter
|
// Gen filter
|
||||||
|
Loading…
Reference in New Issue
Block a user