diff --git a/src/locales/de/starter-select-ui-handler.ts b/src/locales/de/starter-select-ui-handler.ts index a982f30d8..fec805a6c 100644 --- a/src/locales/de/starter-select-ui-handler.ts +++ b/src/locales/de/starter-select-ui-handler.ts @@ -28,5 +28,6 @@ export const starterSelectUiHandler: SimpleTranslationEntries = { "cycleNature": "N: Wesen Ändern", "cycleVariant": "V: Seltenheit ändern", "enablePassive": "Passiv-Skill aktivieren", - "disablePassive": "Passiv-Skill deaktivieren" + "disablePassive": "Passiv-Skill deaktivieren", + "maxIV": "Max a Random IV" } \ No newline at end of file diff --git a/src/locales/en/starter-select-ui-handler.ts b/src/locales/en/starter-select-ui-handler.ts index c7595cb2f..f820dda19 100644 --- a/src/locales/en/starter-select-ui-handler.ts +++ b/src/locales/en/starter-select-ui-handler.ts @@ -28,5 +28,6 @@ export const starterSelectUiHandler: SimpleTranslationEntries = { "cycleNature": 'N: Cycle Nature', "cycleVariant": 'V: Cycle Variant', "enablePassive": "Enable Passive", - "disablePassive": "Disable Passive" + "disablePassive": "Disable Passive", + "maxIV": "Max a Random IV" } \ No newline at end of file diff --git a/src/locales/es/starter-select-ui-handler.ts b/src/locales/es/starter-select-ui-handler.ts index 629e25632..70ed0e1c9 100644 --- a/src/locales/es/starter-select-ui-handler.ts +++ b/src/locales/es/starter-select-ui-handler.ts @@ -28,5 +28,6 @@ export const starterSelectUiHandler: SimpleTranslationEntries = { "cycleNature": 'N: Cambiar Naturaleza', "cycleVariant": 'V: Cambiar Variante', "enablePassive": "Activar Pasiva", - "disablePassive": "Desactivar Pasiva" + "disablePassive": "Desactivar Pasiva", + "maxIV": "Max a Random IV" } \ No newline at end of file diff --git a/src/locales/fr/starter-select-ui-handler.ts b/src/locales/fr/starter-select-ui-handler.ts index 77a79387a..fa9dff3ec 100644 --- a/src/locales/fr/starter-select-ui-handler.ts +++ b/src/locales/fr/starter-select-ui-handler.ts @@ -28,5 +28,6 @@ export const starterSelectUiHandler: SimpleTranslationEntries = { "cycleNature": "N: » Natures", "cycleVariant": "V: » Variants", "enablePassive": "Activer Passif", - "disablePassive": "Désactiver Passif" + "disablePassive": "Désactiver Passif", + "maxIV": "Max a Random IV" } diff --git a/src/locales/it/starter-select-ui-handler.ts b/src/locales/it/starter-select-ui-handler.ts index 1a442ffe9..5c1cb84dc 100644 --- a/src/locales/it/starter-select-ui-handler.ts +++ b/src/locales/it/starter-select-ui-handler.ts @@ -28,5 +28,6 @@ export const starterSelectUiHandler: SimpleTranslationEntries = { "cycleNature": 'N: Alterna Natura', "cycleVariant": 'V: Alterna Variante', "enablePassive": "Attiva Passiva", - "disablePassive": "Disattiva Passiva" + "disablePassive": "Disattiva Passiva", + "maxIV": "Max a Random IV" } \ No newline at end of file diff --git a/src/locales/zh_CN/starter-select-ui-handler.ts b/src/locales/zh_CN/starter-select-ui-handler.ts index 9d3a076e5..75f56881c 100644 --- a/src/locales/zh_CN/starter-select-ui-handler.ts +++ b/src/locales/zh_CN/starter-select-ui-handler.ts @@ -28,5 +28,6 @@ export const starterSelectUiHandler: SimpleTranslationEntries = { "cycleNature": 'N: 切换性格', "cycleVariant": 'V: 切换变种', "enablePassive": "启用被动", - "disablePassive": "禁用被动" + "disablePassive": "禁用被动", + "maxIV": "Max a Random IV" } \ No newline at end of file diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index 81f081e4c..cc2910ea6 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -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' ]; export default class StarterSelectUiHandler extends MessageUiHandler { @@ -929,6 +950,38 @@ export default class StarterSelectUiHandler extends MessageUiHandler { 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({ label: i18next.t("menu:cancel"), handler: () => {