mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-29 10:16:14 +00:00
candy upgrade (#3720)
This commit is contained in:
parent
e5e71c1702
commit
1813009443
@ -131,6 +131,8 @@ const starterCandyCosts: { passive: integer, costReduction: [integer, integer],
|
|||||||
{ passive: 10, costReduction: [5, 15], egg: 10 }, // 10 Cost
|
{ passive: 10, costReduction: [5, 15], egg: 10 }, // 10 Cost
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const valueReductionMax = 2;
|
||||||
|
|
||||||
// Position of UI elements
|
// Position of UI elements
|
||||||
const filterBarHeight = 17;
|
const filterBarHeight = 17;
|
||||||
const speciesContainerX = 109; // if team on the RIGHT: 109 / if on the LEFT: 143
|
const speciesContainerX = 109; // if team on the RIGHT: 109 / if on the LEFT: 143
|
||||||
@ -1009,11 +1011,11 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
const starterData = this.scene.gameData.starterData[speciesId];
|
const starterData = this.scene.gameData.starterData[speciesId];
|
||||||
|
|
||||||
return starterData.candyCount >= getValueReductionCandyCounts(speciesStarters[speciesId])[starterData.valueReduction]
|
return starterData.candyCount >= getValueReductionCandyCounts(speciesStarters[speciesId])[starterData.valueReduction]
|
||||||
&& starterData.valueReduction < 2;
|
&& starterData.valueReduction < valueReductionMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if an same species egg can be baught for the given species ID
|
* Determines if an same species egg can be bought for the given species ID
|
||||||
* @param speciesId The ID of the species to check the value reduction of
|
* @param speciesId The ID of the species to check the value reduction of
|
||||||
* @returns true if the user has enough candies
|
* @returns true if the user has enough candies
|
||||||
*/
|
*/
|
||||||
@ -1062,15 +1064,18 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
}
|
}
|
||||||
],};
|
],};
|
||||||
|
|
||||||
const passiveAvailable = this.isPassiveAvailable(species.speciesId);
|
const isPassiveAvailable = this.isPassiveAvailable(species.speciesId);
|
||||||
// 'Only Passives' mode
|
const isValueReductionAvailable = this.isValueReductionAvailable(species.speciesId);
|
||||||
|
const isSameSpeciesEggAvailable = this.isSameSpeciesEggAvailable(species.speciesId);
|
||||||
|
|
||||||
|
// 'Passives Only' mode
|
||||||
if (this.scene.candyUpgradeNotification === 1) {
|
if (this.scene.candyUpgradeNotification === 1) {
|
||||||
if (passiveAvailable) {
|
if (isPassiveAvailable) {
|
||||||
this.scene.tweens.chain(tweenChain).paused = startPaused;
|
this.scene.tweens.chain(tweenChain).paused = startPaused;
|
||||||
}
|
}
|
||||||
// 'On' mode
|
// 'On' mode
|
||||||
} else if (this.scene.candyUpgradeNotification === 2) {
|
} else if (this.scene.candyUpgradeNotification === 2) {
|
||||||
if (passiveAvailable || this.isValueReductionAvailable(species.speciesId)) {
|
if (isPassiveAvailable || isValueReductionAvailable || isSameSpeciesEggAvailable) {
|
||||||
this.scene.tweens.chain(tweenChain).paused = startPaused;
|
this.scene.tweens.chain(tweenChain).paused = startPaused;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1089,16 +1094,19 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const passiveAvailable = this.isPassiveAvailable(species.speciesId);
|
const isPassiveAvailable = this.isPassiveAvailable(species.speciesId);
|
||||||
// 'Only Passive Unlocks' mode
|
const isValueReductionAvailable = this.isValueReductionAvailable(species.speciesId);
|
||||||
|
const isSameSpeciesEggAvailable = this.isSameSpeciesEggAvailable(species.speciesId);
|
||||||
|
|
||||||
|
// 'Passive Only' mode
|
||||||
if (this.scene.candyUpgradeNotification === 1) {
|
if (this.scene.candyUpgradeNotification === 1) {
|
||||||
starter.candyUpgradeIcon.setVisible(slotVisible && passiveAvailable);
|
starter.candyUpgradeIcon.setVisible(slotVisible && isPassiveAvailable);
|
||||||
starter.candyUpgradeOverlayIcon.setVisible(slotVisible && starter.candyUpgradeIcon.visible);
|
starter.candyUpgradeOverlayIcon.setVisible(slotVisible && starter.candyUpgradeIcon.visible);
|
||||||
|
|
||||||
// 'On' mode
|
// 'On' mode
|
||||||
} else if (this.scene.candyUpgradeNotification === 2) {
|
} else if (this.scene.candyUpgradeNotification === 2) {
|
||||||
starter.candyUpgradeIcon.setVisible(
|
starter.candyUpgradeIcon.setVisible(
|
||||||
slotVisible && ( passiveAvailable || this.isValueReductionAvailable(species.speciesId)));
|
slotVisible && ( isPassiveAvailable || isValueReductionAvailable || isSameSpeciesEggAvailable ));
|
||||||
starter.candyUpgradeOverlayIcon.setVisible(slotVisible && starter.candyUpgradeIcon.visible);
|
starter.candyUpgradeOverlayIcon.setVisible(slotVisible && starter.candyUpgradeIcon.visible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1630,7 +1638,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
const valueReduction = starterData.valueReduction;
|
const valueReduction = starterData.valueReduction;
|
||||||
if (valueReduction < 2) {
|
if (valueReduction < valueReductionMax) {
|
||||||
const reductionCost = getValueReductionCandyCounts(speciesStarters[this.lastSpecies.speciesId])[valueReduction];
|
const reductionCost = getValueReductionCandyCounts(speciesStarters[this.lastSpecies.speciesId])[valueReduction];
|
||||||
options.push({
|
options.push({
|
||||||
label: `x${reductionCost} ${i18next.t("starterSelectUiHandler:reduceCost")}`,
|
label: `x${reductionCost} ${i18next.t("starterSelectUiHandler:reduceCost")}`,
|
||||||
|
Loading…
Reference in New Issue
Block a user