Added Unlocking Egg Moves with Candy

This commit is contained in:
Lloyd Delacroix 2024-05-19 23:18:34 -04:00
parent 1ae5847e49
commit bddb1fd5ce
8 changed files with 63 additions and 0 deletions

View File

@ -30,6 +30,7 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
"selectMoveSwapWith": "Wähle die gewünschte Attacke.",
"unlockPassive": "Passiv-Skill freischalten",
"reduceCost": "Preis reduzieren",
"learnEggMove": "Lerne Eierangriff",
"cycleShiny": "R: Schillernd Ja/Nein",
"cycleForm": "F: Form ändern",
"cycleGender": "G: Geschlecht ändern",

View File

@ -30,6 +30,7 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
"selectMoveSwapWith": "Select a move to swap with",
"unlockPassive": "Unlock Passive",
"reduceCost": "Reduce Cost",
"learnEggMove": "Learn Egg Move",
"cycleShiny": "R: Cycle Shiny",
"cycleForm": 'F: Cycle Form',
"cycleGender": 'G: Cycle Gender',

View File

@ -30,6 +30,7 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
"selectMoveSwapWith": "Elige el movimiento que sustituirá a",
"unlockPassive": "Añadir Pasiva",
"reduceCost": "Reducir Coste",
"learnEggMove": "Aprende ataque de huevo",
"cycleShiny": "R: Cambiar Shiny",
"cycleForm": 'F: Cambiar Forma',
"cycleGender": 'G: Cambiar Género',

View File

@ -30,6 +30,7 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
"selectMoveSwapWith": "Sélectionnez laquelle échanger avec",
"unlockPassive": "Débloquer Passif",
"reduceCost": "Diminuer le cout",
"learnEggMove": "Apprendre l'attaque aux œufs",
"cycleShiny": "R: » Chromatiques",
"cycleForm": "F: » Formes",
"cycleGender": "G: » Sexes",

View File

@ -30,6 +30,7 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
"selectMoveSwapWith": "Seleziona una mossa da scambiare con",
"unlockPassive": "Sblocca Passiva",
"reduceCost": "Riduci Costo",
"learnEggMove": "Impara l'attacco dell'uovo",
"cycleShiny": "R: Alterna Shiny",
"cycleForm": 'F: Alterna Forma',
"cycleGender": 'G: Alterna Sesso',

View File

@ -30,6 +30,7 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
"selectMoveSwapWith": "Escolha o movimento que substituirá",
"unlockPassive": "Aprender Passiva",
"reduceCost": "Reduzir Custo",
"learnEggMove": "Aprenda Mov. de Ovo",
"cycleShiny": "R: Mudar Shiny",
"cycleForm": 'F: Mudar Forma',
"cycleGender": 'G: Mudar Gênero',

View File

@ -30,6 +30,7 @@ export const starterSelectUiHandler: SimpleTranslationEntries = {
"selectMoveSwapWith": "选择要替换成的招式",
"unlockPassive": "解锁被动",
"reduceCost": "降低花费",
"learnEggMove": "学习鸡蛋攻击",
"cycleShiny": "R: 切换闪光",
"cycleForm": 'F: 切换形态',
"cycleGender": 'G: 切换性别',

View File

@ -86,6 +86,27 @@ function getValueReductionCandyCounts(baseValue: integer): [integer, integer] {
}
}
function getEggMoveCandyCount(baseValue: integer): integer {
switch (baseValue) {
case 1:
return 50;
case 2:
return 45;
case 3:
return 40;
case 4:
return 30;
case 5:
return 25;
case 6:
return 20;
case 7:
return 15;
default:
return 10;
}
}
const gens = [
i18next.t("starterSelectUiHandler:gen1"),
i18next.t("starterSelectUiHandler:gen2"),
@ -999,6 +1020,41 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
itemArgs: starterColors[this.lastSpecies.speciesId]
});
}
const eggMovesAvailableCount = speciesEggMoves[this.lastSpecies.speciesId].length;
const eggMovesLearnedCount = starterData.eggMoves;
//There's probably a more elegant way to do the bitwise comparison
if (eggMovesAvailableCount != 0 && eggMovesLearnedCount != (Math.pow(2, eggMovesAvailableCount) - 1)) {
const eggMoveCost = getEggMoveCandyCount(speciesStarters[this.lastSpecies.speciesId]);
options.push({
label: `x${eggMoveCost} ${i18next.t("starterSelectUiHandler:learnEggMove")}`,
handler: () => {
if (candyCount >= eggMoveCost || 1==1) {
//starterData.valueReduction++;
console.log("Egg Move Value: " + this.scene.gameData.starterData[this.lastSpecies.speciesId].eggMoves);
for (let em = 0; em < 4; em++) {
if (!(this.scene.gameData.starterData[this.lastSpecies.speciesId].eggMoves & Math.pow(2, em))) {
this.scene.gameData.setEggMoveUnlocked(this.lastSpecies, em);
break;
}
}
starterData.candyCount -= eggMoveCost;
this.pokemonCandyCountText.setText(`x${starterData.candyCount}`);
this.scene.gameData.saveSystem().then(success => {
if (!success)
return this.scene.reset(true);
});
this.updateStarterValueLabel(this.cursor);
this.tryUpdateValue(0);
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: () => {