[Bug][UI/UX] Ensure pokemon hop when animations are selected (#5781)

Ensure pokemon hop when animations are selected
This commit is contained in:
Sirz Benjie 2025-05-05 16:36:22 -05:00 committed by GitHub
parent a3039ef6a6
commit ae25a70b4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 30 deletions

View File

@ -873,6 +873,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
const tweenChain: Phaser.Types.Tweens.TweenChainBuilderConfig = { const tweenChain: Phaser.Types.Tweens.TweenChainBuilderConfig = {
targets: icon, targets: icon,
loop: -1, loop: -1,
paused: startPaused,
// Make the initial bounce a little randomly delayed // Make the initial bounce a little randomly delayed
delay: randIntRange(0, 50) * 5, delay: randIntRange(0, 50) * 5,
loopDelay: 1000, loopDelay: 1000,
@ -894,19 +895,14 @@ export default class PokedexUiHandler extends MessageUiHandler {
], ],
}; };
const isPassiveAvailable = this.isPassiveAvailable(species.speciesId); if (
const isValueReductionAvailable = this.isValueReductionAvailable(species.speciesId); this.isPassiveAvailable(species.speciesId) ||
const isSameSpeciesEggAvailable = this.isSameSpeciesEggAvailable(species.speciesId); (globalScene.candyUpgradeNotification === 2 &&
(this.isValueReductionAvailable(species.speciesId) || this.isSameSpeciesEggAvailable(species.speciesId)))
// 'Passives Only' mode ) {
if (globalScene.candyUpgradeNotification === 1) { const chain = globalScene.tweens.chain(tweenChain);
if (isPassiveAvailable) { if (!startPaused) {
globalScene.tweens.chain(tweenChain).paused = startPaused; chain.play();
}
// 'On' mode
} else if (globalScene.candyUpgradeNotification === 2) {
if (isPassiveAvailable || isValueReductionAvailable || isSameSpeciesEggAvailable) {
globalScene.tweens.chain(tweenChain).paused = startPaused;
} }
} }
} }
@ -2040,7 +2036,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
this.checkIconId(lastSpeciesIcon, container.species, props.female, props.formIndex, props.shiny, props.variant); this.checkIconId(lastSpeciesIcon, container.species, props.female, props.formIndex, props.shiny, props.variant);
this.iconAnimHandler.addOrUpdate(lastSpeciesIcon, PokemonIconAnimMode.NONE); this.iconAnimHandler.addOrUpdate(lastSpeciesIcon, PokemonIconAnimMode.NONE);
// Resume the animation for the previously selected species // Resume the animation for the previously selected species
globalScene.tweens.getTweensOf(lastSpeciesIcon).forEach(tween => tween.resume()); globalScene.tweens.getTweensOf(lastSpeciesIcon).forEach(tween => tween.play());
} }
} }

View File

@ -1444,6 +1444,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
const tweenChain: Phaser.Types.Tweens.TweenChainBuilderConfig = { const tweenChain: Phaser.Types.Tweens.TweenChainBuilderConfig = {
targets: icon, targets: icon,
paused: startPaused,
loop: -1, loop: -1,
// Make the initial bounce a little randomly delayed // Make the initial bounce a little randomly delayed
delay: randIntRange(0, 50) * 5, delay: randIntRange(0, 50) * 5,
@ -1451,14 +1452,14 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
tweens: [ tweens: [
{ {
targets: icon, targets: icon,
y: 2 - 5, y: "-=5",
duration: fixedInt(125), duration: fixedInt(125),
ease: "Cubic.easeOut", ease: "Cubic.easeOut",
yoyo: true, yoyo: true,
}, },
{ {
targets: icon, targets: icon,
y: 2 - 3, y: "-=3",
duration: fixedInt(150), duration: fixedInt(150),
ease: "Cubic.easeOut", ease: "Cubic.easeOut",
yoyo: true, yoyo: true,
@ -1466,19 +1467,14 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
], ],
}; };
const isPassiveAvailable = this.isPassiveAvailable(species.speciesId); if (
const isValueReductionAvailable = this.isValueReductionAvailable(species.speciesId); this.isPassiveAvailable(species.speciesId) ||
const isSameSpeciesEggAvailable = this.isSameSpeciesEggAvailable(species.speciesId); (globalScene.candyUpgradeNotification === 2 &&
(this.isValueReductionAvailable(species.speciesId) || this.isSameSpeciesEggAvailable(species.speciesId)))
// 'Passives Only' mode ) {
if (globalScene.candyUpgradeNotification === 1) { const chain = globalScene.tweens.chain(tweenChain);
if (isPassiveAvailable) { if (!startPaused) {
globalScene.tweens.chain(tweenChain).paused = startPaused; chain.play();
}
// 'On' mode
} else if (globalScene.candyUpgradeNotification === 2) {
if (isPassiveAvailable || isValueReductionAvailable || isSameSpeciesEggAvailable) {
globalScene.tweens.chain(tweenChain).paused = startPaused;
} }
} }
} }
@ -3478,7 +3474,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
// Resume the animation for the previously selected species // Resume the animation for the previously selected species
const icon = this.starterContainers[speciesIndex].icon; const icon = this.starterContainers[speciesIndex].icon;
globalScene.tweens.getTweensOf(icon).forEach(tween => tween.resume()); globalScene.tweens.getTweensOf(icon).forEach(tween => tween.play());
} }
this.lastSpecies = species!; // TODO: is this bang correct? this.lastSpecies = species!; // TODO: is this bang correct?