Adds the ability for users to spend candy to max a random IV
parent
9e453c5b0f
commit
61203ff358
|
@ -28,5 +28,6 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
|
||||||
"cycleNature": "N: Wesen Ändern",
|
"cycleNature": "N: Wesen Ändern",
|
||||||
"cycleVariant": "V: Seltenheit ändern",
|
"cycleVariant": "V: Seltenheit ändern",
|
||||||
"enablePassive": "Passiv-Skill aktivieren",
|
"enablePassive": "Passiv-Skill aktivieren",
|
||||||
"disablePassive": "Passiv-Skill deaktivieren"
|
"disablePassive": "Passiv-Skill deaktivieren",
|
||||||
|
"maxIV": "Max a Random IV"
|
||||||
}
|
}
|
|
@ -28,5 +28,6 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
|
||||||
"cycleNature": 'N: Cycle Nature',
|
"cycleNature": 'N: Cycle Nature',
|
||||||
"cycleVariant": 'V: Cycle Variant',
|
"cycleVariant": 'V: Cycle Variant',
|
||||||
"enablePassive": "Enable Passive",
|
"enablePassive": "Enable Passive",
|
||||||
"disablePassive": "Disable Passive"
|
"disablePassive": "Disable Passive",
|
||||||
|
"maxIV": "Max a Random IV"
|
||||||
}
|
}
|
|
@ -28,5 +28,6 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
|
||||||
"cycleNature": 'N: Cambiar Naturaleza',
|
"cycleNature": 'N: Cambiar Naturaleza',
|
||||||
"cycleVariant": 'V: Cambiar Variante',
|
"cycleVariant": 'V: Cambiar Variante',
|
||||||
"enablePassive": "Activar Pasiva",
|
"enablePassive": "Activar Pasiva",
|
||||||
"disablePassive": "Desactivar Pasiva"
|
"disablePassive": "Desactivar Pasiva",
|
||||||
|
"maxIV": "Max a Random IV"
|
||||||
}
|
}
|
|
@ -28,5 +28,6 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
|
||||||
"cycleNature": "N: » Natures",
|
"cycleNature": "N: » Natures",
|
||||||
"cycleVariant": "V: » Variants",
|
"cycleVariant": "V: » Variants",
|
||||||
"enablePassive": "Activer Passif",
|
"enablePassive": "Activer Passif",
|
||||||
"disablePassive": "Désactiver Passif"
|
"disablePassive": "Désactiver Passif",
|
||||||
|
"maxIV": "Max a Random IV"
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,5 +28,6 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
|
||||||
"cycleNature": 'N: Alterna Natura',
|
"cycleNature": 'N: Alterna Natura',
|
||||||
"cycleVariant": 'V: Alterna Variante',
|
"cycleVariant": 'V: Alterna Variante',
|
||||||
"enablePassive": "Attiva Passiva",
|
"enablePassive": "Attiva Passiva",
|
||||||
"disablePassive": "Disattiva Passiva"
|
"disablePassive": "Disattiva Passiva",
|
||||||
|
"maxIV": "Max a Random IV"
|
||||||
}
|
}
|
|
@ -28,5 +28,6 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
|
||||||
"cycleNature": 'N: 切换性格',
|
"cycleNature": 'N: 切换性格',
|
||||||
"cycleVariant": 'V: 切换变种',
|
"cycleVariant": 'V: 切换变种',
|
||||||
"enablePassive": "启用被动",
|
"enablePassive": "启用被动",
|
||||||
"disablePassive": "禁用被动"
|
"disablePassive": "禁用被动",
|
||||||
|
"maxIV": "Max a Random IV"
|
||||||
}
|
}
|
|
@ -86,6 +86,27 @@ function getValueReductionCandyCounts(baseValue: integer): [integer, integer] {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getMaxIVCandyCount(baseValue: integer): integer {
|
||||||
|
switch (baseValue) {
|
||||||
|
case 1:
|
||||||
|
return 30;
|
||||||
|
case 2:
|
||||||
|
return 25;
|
||||||
|
case 3:
|
||||||
|
return 20;
|
||||||
|
case 4:
|
||||||
|
return 15;
|
||||||
|
case 5:
|
||||||
|
return 12;
|
||||||
|
case 6:
|
||||||
|
return 10;
|
||||||
|
case 7:
|
||||||
|
return 8;
|
||||||
|
default:
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const gens = [ 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX' ];
|
const gens = [ 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX' ];
|
||||||
|
|
||||||
export default class StarterSelectUiHandler extends MessageUiHandler {
|
export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||||
|
@ -929,6 +950,38 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||||
itemArgs: starterColors[this.lastSpecies.speciesId]
|
itemArgs: starterColors[this.lastSpecies.speciesId]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
const dexData = this.scene.gameData.dexData[this.lastSpecies.speciesId];
|
||||||
|
if (dexData.ivs.findIndex(iv => iv <= 30) != -1) {
|
||||||
|
const maxIVCost = getMaxIVCandyCount(speciesStarters[this.lastSpecies.speciesId]);
|
||||||
|
options.push({
|
||||||
|
label: `x${maxIVCost} ${i18next.t("starterSelectUiHandler:maxIV")}`,
|
||||||
|
handler: () => {
|
||||||
|
if (candyCount >= maxIVCost){
|
||||||
|
let ivSelected = false;
|
||||||
|
let randomIV = 0
|
||||||
|
while (!ivSelected){
|
||||||
|
randomIV = Math.floor(Math.random()*6);
|
||||||
|
ivSelected = dexData.ivs[randomIV] == 31 ? false : true
|
||||||
|
}
|
||||||
|
dexData.ivs[randomIV] = 31
|
||||||
|
starterData.candyCount -= maxIVCost;
|
||||||
|
this.pokemonCandyCountText.setText(`x${starterData.candyCount}`);
|
||||||
|
this.scene.gameData.saveSystem().then(success => {
|
||||||
|
if (!success)
|
||||||
|
return this.scene.reset(true);
|
||||||
|
});
|
||||||
|
this.toggleStatsMode(false);
|
||||||
|
this.toggleStatsMode(true);
|
||||||
|
ui.setMode(Mode.STARTER_SELECT);
|
||||||
|
this.scene.playSound('buy');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
item: 'candy',
|
||||||
|
itemArgs: starterColors[this.lastSpecies.speciesId]
|
||||||
|
})
|
||||||
|
}
|
||||||
options.push({
|
options.push({
|
||||||
label: i18next.t("menu:cancel"),
|
label: i18next.t("menu:cancel"),
|
||||||
handler: () => {
|
handler: () => {
|
||||||
|
|
Loading…
Reference in New Issue