From ed872938677921bb086dfcfa22a1a2d4dc95bb2f Mon Sep 17 00:00:00 2001 From: Griffin Zody Date: Mon, 13 May 2024 13:53:23 -0600 Subject: [PATCH 1/9] Fix Zygarge Complete form changing back into 50% (#786) --- src/data/ability.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index fee574e4a..b2899a33f 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -3463,9 +3463,9 @@ export function initAbilities() { .attr(UnsuppressableAbilityAbAttr) .attr(NoFusionAbilityAbAttr), new Ability(Abilities.POWER_CONSTRUCT, 7) // TODO: 10% Power Construct Zygarde isn't accounted for yet. If changed, update Zygarde's getSpeciesFormIndex entry accordingly - .attr(PostBattleInitFormChangeAbAttr, p => p.getHpRatio() <= 0.5 ? 4 : 2) - .attr(PostSummonFormChangeAbAttr, p => p.getHpRatio() <= 0.5 ? 4 : 2) - .attr(PostTurnFormChangeAbAttr, p => p.getHpRatio() <= 0.5 ? 4 : 2) + .attr(PostBattleInitFormChangeAbAttr, p => p.getHpRatio() <= 0.5 || p.getFormKey() === 'complete' ? 4 : 2) + .attr(PostSummonFormChangeAbAttr, p => p.getHpRatio() <= 0.5 || p.getFormKey() === 'complete' ? 4 : 2) + .attr(PostTurnFormChangeAbAttr, p => p.getHpRatio() <= 0.5 || p.getFormKey() === 'complete' ? 4 : 2) .attr(UncopiableAbilityAbAttr) .attr(UnswappableAbilityAbAttr) .attr(UnsuppressableAbilityAbAttr) From 7e5c7fb4f7e3cbc172dd36c634d1e0a2d8e83946 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Mon, 13 May 2024 17:03:53 -0400 Subject: [PATCH 2/9] Don't allow trainer egg moves before level 60 and no rare egg moves at all --- src/field/pokemon.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 245820484..fd1613df1 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -1225,24 +1225,18 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { } } - if (this.level >= 25) { // No egg moves below level 25 + if (this.level >= 60) { // No egg moves below level 60 for (let i = 0; i < 3; i++) { const moveId = speciesEggMoves[this.species.getRootSpeciesId()][i]; if (!movePool.some(m => m[0] === moveId) && !allMoves[moveId].name.endsWith(' (N)')) movePool.push([moveId, Math.min(this.level * 0.5, 40)]); } - const moveId = speciesEggMoves[this.species.getRootSpeciesId()][3]; - if (this.level >= 60 && !movePool.some(m => m[0] === moveId) && !allMoves[moveId].name.endsWith(' (N)')) // No rare egg moves before level 60 - movePool.push([moveId, Math.min(this.level * 0.2, 20)]); if (this.fusionSpecies) { for (let i = 0; i < 3; i++) { const moveId = speciesEggMoves[this.fusionSpecies.getRootSpeciesId()][i]; if (!movePool.some(m => m[0] === moveId) && !allMoves[moveId].name.endsWith(' (N)')) movePool.push([moveId, Math.min(this.level * 0.5, 30)]); } - const moveId = speciesEggMoves[this.fusionSpecies.getRootSpeciesId()][3]; - if (this.level >= 60 && !movePool.some(m => m[0] === moveId) && !allMoves[moveId].name.endsWith(' (N)')) // No rare egg moves before level 60 - movePool.push([moveId, Math.min(this.level * 0.2, 20)]); } } } From b45cd2f7e79fbe2ea65b8148ebbefccdf28bbb3f Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Mon, 13 May 2024 18:17:57 -0400 Subject: [PATCH 3/9] Implement hybrid saving for optimization --- src/phases.ts | 2 +- src/system/game-data.ts | 104 ++++++++++++++++++---------------------- 2 files changed, 48 insertions(+), 58 deletions(-) diff --git a/src/phases.ts b/src/phases.ts index 271e5350c..6cc6af93e 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -775,7 +775,7 @@ export class EncounterPhase extends BattlePhase { this.scene.ui.setMode(Mode.MESSAGE).then(() => { if (!this.loaded) { - this.scene.gameData.saveAll(this.scene, true).then(success => { + this.scene.gameData.saveAll(this.scene, true, battle.waveIndex % 5 === 1).then(success => { this.scene.disableMenu = false; if (!success) return this.scene.reset(true); diff --git a/src/system/game-data.ts b/src/system/game-data.ts index 7f6e1475b..90722d1ce 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -277,7 +277,7 @@ export class GameData { const maxIntAttrValue = Math.pow(2, 31); const systemData = JSON.stringify(data, (k: any, v: any) => typeof v === 'bigint' ? v <= maxIntAttrValue ? Number(v) : v.toString() : v); - if (!bypassLogin) { + if (!bypassLogin && !localStorage.getItem('data')) { Utils.apiPost(`savedata/update?datatype=${GameDataType.SYSTEM}`, systemData, undefined, true) .then(response => response.text()) .then(error => { @@ -293,12 +293,15 @@ export class GameData { console.error(error); return resolve(false); } + localStorage.removeItem('data'); resolve(true); }); } else { - localStorage.setItem('data_bak', localStorage.getItem('data')); + const encFunc = bypassLogin + ? (data: string) => btoa(data) + : (data: string) => AES.encrypt(data, saveKey); - localStorage.setItem('data', btoa(systemData)); + localStorage.setItem('data', encFunc(systemData)); this.scene.ui.savingIcon.hide(); @@ -309,7 +312,7 @@ export class GameData { public loadSystem(): Promise { return new Promise(resolve => { - if (bypassLogin && !localStorage.hasOwnProperty('data')) + if (bypassLogin && !localStorage.getItem('data')) return resolve(false); const handleSystemData = (systemDataStr: string) => { @@ -421,7 +424,7 @@ export class GameData { } } - if (!bypassLogin) { + if (!bypassLogin && !localStorage.getItem('data')) { Utils.apiFetch(`savedata/get?datatype=${GameDataType.SYSTEM}`, true) .then(response => response.text()) .then(response => { @@ -439,8 +442,12 @@ export class GameData { handleSystemData(response); }); - } else - handleSystemData(atob(localStorage.getItem('data'))); + } else { + const decFunc = bypassLogin + ? (data: string) => atob(data) + : (data: string) => AES.decrypt(data, saveKey).toString(enc.Utf8); + handleSystemData(decFunc(localStorage.getItem('data'))); + } }); } @@ -557,40 +564,6 @@ export class GameData { } as SessionSaveData; } - saveSession(scene: BattleScene, skipVerification?: boolean): Promise { - return new Promise(resolve => { - Utils.executeIf(!skipVerification, updateUserInfo).then(success => { - if (success !== null && !success) - return resolve(false); - - const sessionData = this.getSessionSaveData(scene); - - if (!bypassLogin) { - Utils.apiPost(`savedata/update?datatype=${GameDataType.SESSION}&slot=${scene.sessionSlotId}&trainerId=${this.trainerId}&secretId=${this.secretId}`, JSON.stringify(sessionData), undefined, true) - .then(response => response.text()) - .then(error => { - if (error) { - if (error.startsWith('session out of date')) { - this.scene.clearPhaseQueue(); - this.scene.unshiftPhase(new ReloadSessionPhase(this.scene)); - } - console.error(error); - return resolve(false); - } - console.debug('Session data saved'); - resolve(true); - }); - } else { - localStorage.setItem(`sessionData${scene.sessionSlotId ? scene.sessionSlotId : ''}`, btoa(JSON.stringify(sessionData))); - - console.debug('Session data saved'); - - resolve(true); - } - }); - }); - } - getSession(slotId: integer): Promise { return new Promise(async (resolve, reject) => { if (slotId < 0) @@ -605,7 +578,7 @@ export class GameData { } }; - if (!bypassLogin) { + if (!bypassLogin && !localStorage.getItem(`sessionData${slotId ? slotId : ''}`)) { Utils.apiFetch(`savedata/get?datatype=${GameDataType.SESSION}&slot=${slotId}`, true) .then(response => response.text()) .then(async response => { @@ -618,9 +591,12 @@ export class GameData { }); } else { const sessionData = localStorage.getItem(`sessionData${slotId ? slotId : ''}`); - if (sessionData) - await handleSessionData(atob(sessionData)); - else + if (sessionData) { + const decFunc = bypassLogin + ? (data: string) => atob(data) + : (data: string) => AES.decrypt(data, saveKey).toString(enc.Utf8); + await handleSessionData(decFunc(sessionData)); + } else return resolve(null); } }); @@ -731,7 +707,7 @@ export class GameData { deleteSession(slotId: integer): Promise { return new Promise(resolve => { if (bypassLogin) { - localStorage.removeItem('sessionData'); + localStorage.removeItem(`sessionData${this.scene.sessionSlotId ? this.scene.sessionSlotId : ''}`); return resolve(true); } @@ -741,6 +717,7 @@ export class GameData { Utils.apiFetch(`savedata/delete?datatype=${GameDataType.SESSION}&slot=${slotId}`, true).then(response => { if (response.ok) { loggedInUser.lastSessionSlot = -1; + localStorage.removeItem(`sessionData${this.scene.sessionSlotId ? this.scene.sessionSlotId : ''}`); resolve(true); } return response.text(); @@ -771,8 +748,10 @@ export class GameData { return resolve([false, false]); const sessionData = this.getSessionSaveData(scene); Utils.apiPost(`savedata/clear?slot=${slotId}&trainerId=${this.trainerId}&secretId=${this.secretId}`, JSON.stringify(sessionData), undefined, true).then(response => { - if (response.ok) + if (response.ok) { loggedInUser.lastSessionSlot = -1; + localStorage.removeItem(`sessionData${this.scene.sessionSlotId ? this.scene.sessionSlotId : ''}`); + } return response.json(); }).then(jsonResponse => { if (!jsonResponse.error) @@ -825,13 +804,12 @@ export class GameData { }) as SessionSaveData; } - saveAll(scene: BattleScene, skipVerification?: boolean): Promise { + saveAll(scene: BattleScene, skipVerification: boolean = false, sync: boolean = false): Promise { return new Promise(resolve => { Utils.executeIf(!skipVerification, updateUserInfo).then(success => { if (success !== null && !success) return resolve(false); this.scene.ui.savingIcon.show(); - const data = this.getSystemSaveData(); const sessionData = this.getSessionSaveData(scene); const maxIntAttrValue = Math.pow(2, 31); @@ -843,7 +821,7 @@ export class GameData { sessionSlotId: scene.sessionSlotId }; - if (!bypassLogin) { + if (!bypassLogin && sync) { Utils.apiPost('savedata/updateall', JSON.stringify(request, (k: any, v: any) => typeof v === 'bigint' ? v <= maxIntAttrValue ? Number(v) : v.toString() : v), undefined, true) .then(response => response.text()) .then(error => { @@ -859,14 +837,18 @@ export class GameData { console.error(error); return resolve(false); } + localStorage.removeItem('data'); + localStorage.removeItem(`sessionData${scene.sessionSlotId ? scene.sessionSlotId : ''}`); resolve(true); }); } else { - localStorage.setItem('data_bak', localStorage.getItem('data')); + const encFunc = bypassLogin + ? (data: string) => btoa(data) + : (data: string) => AES.encrypt(data, saveKey); - localStorage.setItem('data', btoa(JSON.stringify(systemData, (k: any, v: any) => typeof v === 'bigint' ? v <= maxIntAttrValue ? Number(v) : v.toString() : v))); + localStorage.setItem('data', encFunc(JSON.stringify(systemData, (k: any, v: any) => typeof v === 'bigint' ? v <= maxIntAttrValue ? Number(v) : v.toString() : v))); - localStorage.setItem(`sessionData${scene.sessionSlotId ? scene.sessionSlotId : ''}`, btoa(JSON.stringify(sessionData))); + localStorage.setItem(`sessionData${scene.sessionSlotId ? scene.sessionSlotId : ''}`, encFunc(JSON.stringify(sessionData))); console.debug('Session data saved'); @@ -910,8 +892,12 @@ export class GameData { }); } else { const data = localStorage.getItem(dataKey); - if (data) - handleData(atob(data)); + if (data) { + const decFunc = bypassLogin + ? (data: string) => atob(data) + : (data: string) => AES.decrypt(data, saveKey).toString(enc.Utf8); + handleData(decFunc(data)); + } resolve(!!data); } }); @@ -979,7 +965,7 @@ export class GameData { return this.scene.ui.showText(`Your ${dataName} data could not be loaded. It may be corrupted.`, null, () => this.scene.ui.showText(null, 0), Utils.fixedInt(1500)); this.scene.ui.showText(`Your ${dataName} data will be overridden and the page will reload. Proceed?`, null, () => { this.scene.ui.setOverlayMode(Mode.CONFIRM, () => { - if (!bypassLogin && dataType < GameDataType.SETTINGS) { + if (!bypassLogin && dataType < GameDataType.SETTINGS && localStorage.getItem(dataKey)) { updateUserInfo().then(success => { if (!success) return displayError(`Could not contact the server. Your ${dataName} data could not be imported.`); @@ -990,11 +976,15 @@ export class GameData { console.error(error); return displayError(`An error occurred while updating ${dataName} data. Please contact the administrator.`); } + localStorage.removeItem(dataKey); window.location = window.location; }); }); } else { - localStorage.setItem(dataKey, btoa(dataStr)); + const encFunc = bypassLogin || dataType === GameDataType.SETTINGS + ? (data: string) => btoa(data) + : (data: string) => AES.encrypt(data, saveKey); + localStorage.setItem(dataKey, encFunc(dataStr)); window.location = window.location; } }, () => { From 5d0dbfff98c19284a6fc65f0f36666a0011b86a6 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Mon, 13 May 2024 18:37:48 -0400 Subject: [PATCH 4/9] Only show save icon on server sync --- src/system/game-data.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/system/game-data.ts b/src/system/game-data.ts index 90722d1ce..d0e296cc4 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -809,7 +809,8 @@ export class GameData { Utils.executeIf(!skipVerification, updateUserInfo).then(success => { if (success !== null && !success) return resolve(false); - this.scene.ui.savingIcon.show(); + if (sync) + this.scene.ui.savingIcon.show(); const sessionData = this.getSessionSaveData(scene); const maxIntAttrValue = Math.pow(2, 31); @@ -825,7 +826,8 @@ export class GameData { Utils.apiPost('savedata/updateall', JSON.stringify(request, (k: any, v: any) => typeof v === 'bigint' ? v <= maxIntAttrValue ? Number(v) : v.toString() : v), undefined, true) .then(response => response.text()) .then(error => { - this.scene.ui.savingIcon.hide(); + if (sync) + this.scene.ui.savingIcon.hide(); if (error) { if (error.startsWith('client version out of date')) { this.scene.clearPhaseQueue(); From 3a3611dfc0d9ad72e7cb6df08d48b063f93ecc55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Ricardo=20Fleury=20Oliveira?= Date: Mon, 13 May 2024 19:59:09 -0300 Subject: [PATCH 5/9] Minor translation fixes (#829) --- src/locales/pt_BR/battle.ts | 2 +- src/locales/pt_BR/tutorial.ts | 54 ++++++++++++++++++++--------------- 2 files changed, 32 insertions(+), 24 deletions(-) diff --git a/src/locales/pt_BR/battle.ts b/src/locales/pt_BR/battle.ts index 6891e3b2e..ed579845c 100644 --- a/src/locales/pt_BR/battle.ts +++ b/src/locales/pt_BR/battle.ts @@ -9,7 +9,7 @@ export const battle: SimpleTranslationEntries = { "trainerComeBack": "{{trainerName}} retirou {{pokemonName}} da batalha!", "playerGo": "{{pokemonName}}, eu escolho você!", "trainerGo": "{{trainerName}} enviou {{pokemonName}}!", - "switchQuestion": "Quer trocar\n{{pokemonName}}?", + "switchQuestion": "Quer trocar\nde {{pokemonName}}?", "trainerDefeated": "Você derrotou\n{{trainerName}}!", "pokemonCaught": "{{pokemonName}} foi capturado!", "pokemon": "Pokémon", diff --git a/src/locales/pt_BR/tutorial.ts b/src/locales/pt_BR/tutorial.ts index d217cc2cd..1f7961648 100644 --- a/src/locales/pt_BR/tutorial.ts +++ b/src/locales/pt_BR/tutorial.ts @@ -1,43 +1,51 @@ import { SimpleTranslationEntries } from "#app/plugins/i18n"; export const tutorial: SimpleTranslationEntries = { - "intro": `Bem-vindo ao PokéRogue! Este é um jogo de Pokémon feito por fãs focado em batalha com elementos roguelite. - $Este jogo não é monetizado e não reivindicamos propriedade de Pokémon nem dos ativos protegidos por direitos autorais usados. - $O jogo é um trabalho em andamento, mas totalmente jogável.\nPara relatórios de bugs, use a comunidade no Discord. - $Se o jogo rodar lentamente, certifique-se de que a 'Aceleração de hardware' esteja ativada nas configurações do seu navegador.`, + "intro": `Bem-vindo ao PokéRogue! Este é um jogo Pokémon feito por fãs focado em batalhas com elementos roguelite. + $Este jogo não é monetizado e não reivindicamos propriedade de Pokémon nem dos ativos protegidos + $por direitos autorais usados. + $O jogo é um trabalho em andamento, mas é totalmente jogável. + $Para relatórios de bugs, use a comunidade no Discord. + $Se o jogo estiver rodando lentamente, certifique-se de que a 'Aceleração de hardware' esteja ativada + $nas configurações do seu navegador.`, "accessMenu": `Para acessar o menu, aperte M ou Esc. $O menu contém configurações e diversas funções.`, "menu": `A partir deste menu, você pode acessar as configurações. - $Nas configurações, você pode alterar a velocidade do jogo, o estilo da janela e outras opções. - $Existem também vários outros recursos aqui, então não deixe de conferir todos eles!`, + $Nas configurações, você pode alterar a velocidade do jogo, + $o estilo da janela, entre outras opções. + $Existem também vários outros recursos disponíveis aqui. + $Não deixe de conferir todos eles!`, - "starterSelect": `Nessa tela, você pode selecionar seus iniciais.\nEsses são os Pokémon iniciais da sua equipe. - $Cada inicial tem seu próprio custo. Sua equipe pode ter até \n6 membros contando que o preço não ultrapasse 10. - $Você pode também selecionar o gênero, habilidade, e formas dependendo \ndas variantes que você capturou ou chocou. - $Os IVs da espécie são os melhores de todos que você \njá capturou ou chocou, então tente conseguir vários Pokémon da mesma espécie!`, + "starterSelect": `Aqui você pode escolher seus iniciais.\nEsses serão os primeiro Pokémon da sua equipe. + $Cada inicial tem seu custo. Sua equipe pode ter até 6\nmembros, desde que a soma dos custos não ultrapasse 10. + $Você pode escolher o gênero, a habilidade\ne até a forma do seu inicial. + $Essas opções dependem das variantes dessa\nespécie que você já capturou ou chocou. + $Os IVs de cada inicial são os melhores de todos os Pokémon\ndaquela espécie que você já capturou ou chocou. + $Sempre capture vários Pokémon de várias espécies!`, - "pokerus": `Todo dia, 3 Pokémon iniciais ficam com uma borda roxa. + "pokerus": `Todo dia, 3 Pokémon iniciais ficam com uma borda roxa. $Caso veja um inicial que você possui com uma dessa, tente\nadicioná-lo a sua equipe. Lembre-se de olhar seu sumário!`, - "statChange": `As mudanças de estatísticas se mantém depois do combate\ndesde que o Pokémon não seja trocado. + "statChange": `As mudanças de atributos se mantém após a batalha desde que o Pokémon não seja trocado. $Seus Pokémon voltam a suas Poké Bolas antes de batalhas contra treinadores e de entrar em um novo bioma. - $Também é possível ver as mudanças de estatísticas dos Pokémon em campo mantendo pressionado C ou Shift.`, + $Para ver as mudanças de atributos dos Pokémon em campo, mantena C ou Shift pressionado durante a batalha.`, - "selectItem": `Após cada batalha você pode escolher entre 3 itens aleatórios.\nVocê pode escolher apenas um. - $Esses variam entre consumíveis, itens de segurar, e itens passivos permanentes. - $A maioria dos efeitos de itens não consumíveis serão acumulados de várias maneiras. - $Alguns itens só aparecerão se puderem ser usados, por exemplo, itens de evolução. - $Você também pode transferir itens de segurar entre os Pokémon utilizando a opção de transferir. + "selectItem": `Após cada batalha, você pode escolher entre 3 itens aleatórios. + $Você pode escolher apenas um deles. + $Esses itens variam entre consumíveis, itens de segurar e itens passivos permanentes. + $A maioria dos efeitos de itens não consumíveis podem ser acumulados. + $Alguns itens só aparecerão se puderem ser usados, como os itens de evolução. + $Você também pode transferir itens de segurar entre os Pokémon utilizando a opção "Transfer". $A opção de transferir irá aparecer no canto inferior direito assim que você obter um item de segurar. - $Você pode comprar itens consumíveis com dinheiro, e uma maior variedade ficará disponível conforme você for mais longe. - $Certifique-se de comprá-los antes de escolher seu item aleatório. Ao escolher, a próxima batalha começará.`, + $Você pode comprar itens consumíveis com dinheiro, e sua variedade aumentará conforme você for mais longe. + $Certifique-se de comprá-los antes de escolher seu item aleatório. Ao escolhê-lo, a próxima batalha começará.`, - "eggGacha": `Nesta tela você pode trocar seus vouchers\npor ovos de Pokémon. - $Ovos ficam mais próximos de chocar depois de cada batalha.\nOvos raros demoram mais para chocar. + "eggGacha": `Aqui você pode trocar seus vouchers\npor ovos de Pokémon. + $Ovos ficam mais próximos de chocar após cada batalha.\nOvos mais raros demoram mais para chocar. $Pokémon chocados não serão adicionados a sua equipe,\nmas sim aos seus iniciais. $Pokémon chocados geralmente possuem IVs melhores\nque Pokémon selvagens. $Alguns Pokémon só podem ser obtidos através de seus ovos. - $Há 3 máquinas, cada uma com um bônus diferente,\nentão escolha a que mais lhe convém!`, + $Temos 3 máquinas, cada uma com seu bônus específico,\nentão escolha a que mais lhe convém!`, } as const; \ No newline at end of file From 74ee3329f8ea6975b474f63b45255dac63d7a888 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Ricardo=20Fleury=20Oliveira?= Date: Mon, 13 May 2024 20:02:44 -0300 Subject: [PATCH 6/9] Added "Uncaught" localization in Starter Selection UI (#831) --- src/locales/de/starter-select-ui-handler.ts | 3 +- src/locales/en/starter-select-ui-handler.ts | 3 +- src/locales/es/starter-select-ui-handler.ts | 3 +- src/locales/fr/starter-select-ui-handler.ts | 3 +- src/locales/it/starter-select-ui-handler.ts | 3 +- .../pt_BR/starter-select-ui-handler.ts | 1 + .../zh_CN/starter-select-ui-handler.ts | 3 +- src/ui/starter-select-ui-handler.ts | 58 +++++++++---------- 8 files changed, 42 insertions(+), 35 deletions(-) diff --git a/src/locales/de/starter-select-ui-handler.ts b/src/locales/de/starter-select-ui-handler.ts index 791a7c053..2e733c1a0 100644 --- a/src/locales/de/starter-select-ui-handler.ts +++ b/src/locales/de/starter-select-ui-handler.ts @@ -30,5 +30,6 @@ export const starterSelectUiHandler: SimpleTranslationEntries = { "enablePassive": "Passiv-Skill aktivieren", "disablePassive": "Passiv-Skill deaktivieren", "locked": "Gesperrt", - "disabled": "Deaktiviert" + "disabled": "Deaktiviert", + "uncaught": "Uncaught" } \ 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 dd3904e12..2acceab69 100644 --- a/src/locales/en/starter-select-ui-handler.ts +++ b/src/locales/en/starter-select-ui-handler.ts @@ -30,5 +30,6 @@ export const starterSelectUiHandler: SimpleTranslationEntries = { "enablePassive": "Enable Passive", "disablePassive": "Disable Passive", "locked": "Locked", - "disabled": "Disabled" + "disabled": "Disabled", + "uncaught": "Uncaught" } \ 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 e8cd9bce0..9b0372098 100644 --- a/src/locales/es/starter-select-ui-handler.ts +++ b/src/locales/es/starter-select-ui-handler.ts @@ -30,5 +30,6 @@ export const starterSelectUiHandler: SimpleTranslationEntries = { "enablePassive": "Activar Pasiva", "disablePassive": "Desactivar Pasiva", "locked": "Locked", - "disabled": "Disabled" + "disabled": "Disabled", + "uncaught": "Uncaught" } \ 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 9f4309e40..d26fa3314 100644 --- a/src/locales/fr/starter-select-ui-handler.ts +++ b/src/locales/fr/starter-select-ui-handler.ts @@ -30,5 +30,6 @@ export const starterSelectUiHandler: SimpleTranslationEntries = { "enablePassive": "Activer Passif", "disablePassive": "Désactiver Passif", "locked": "Verrouillé", - "disabled": "Désactivé" + "disabled": "Désactivé", + "uncaught": "Uncaught" } diff --git a/src/locales/it/starter-select-ui-handler.ts b/src/locales/it/starter-select-ui-handler.ts index e8c58ad13..79c2e26c6 100644 --- a/src/locales/it/starter-select-ui-handler.ts +++ b/src/locales/it/starter-select-ui-handler.ts @@ -30,5 +30,6 @@ export const starterSelectUiHandler: SimpleTranslationEntries = { "enablePassive": "Attiva Passiva", "disablePassive": "Disattiva Passiva", "locked": "Locked", - "disabled": "Disabled" + "disabled": "Disabled", + "uncaught": "Uncaught" } \ No newline at end of file diff --git a/src/locales/pt_BR/starter-select-ui-handler.ts b/src/locales/pt_BR/starter-select-ui-handler.ts index 999b8bdfd..ba180c2cf 100644 --- a/src/locales/pt_BR/starter-select-ui-handler.ts +++ b/src/locales/pt_BR/starter-select-ui-handler.ts @@ -31,4 +31,5 @@ export const starterSelectUiHandler: SimpleTranslationEntries = { "disablePassive": "Desativar Passiva", "locked": "Bloqueado", "disabled": "Desativado", + "uncaught": "Não capturado" } \ 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 c2d0a82d8..ace02c1c2 100644 --- a/src/locales/zh_CN/starter-select-ui-handler.ts +++ b/src/locales/zh_CN/starter-select-ui-handler.ts @@ -30,5 +30,6 @@ export const starterSelectUiHandler: SimpleTranslationEntries = { "enablePassive": "启用被动", "disablePassive": "禁用被动", "locked": "Locked", - "disabled": "Disabled" + "disabled": "Disabled", + "uncaught": "Uncaught" } \ 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 b9ed8195c..8443ed574 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -1,34 +1,34 @@ -import BattleScene, { starterColors } from "../battle-scene"; -import PokemonSpecies, { allSpecies, getPokemonSpecies, getPokemonSpeciesForm, speciesStarters, starterPassiveAbilities, getStarterValueFriendshipCap } from "../data/pokemon-species"; -import { Species } from "../data/enums/species"; -import { TextStyle, addBBCodeTextObject, addTextObject } from "./text"; -import { Mode } from "./ui"; -import MessageUiHandler from "./message-ui-handler"; -import { Gender, getGenderColor, getGenderSymbol } from "../data/gender"; -import { allAbilities } from "../data/ability"; -import { GameModes, gameModes } from "../game-mode"; -import { GrowthRate, getGrowthRateColor } from "../data/exp"; -import { AbilityAttr, DexAttr, DexAttrProps, DexEntry, Passive as PassiveAttr, StarterFormMoveData, StarterMoveset } from "../system/game-data"; -import * as Utils from "../utils"; -import PokemonIconAnimHandler, { PokemonIconAnimMode } from "./pokemon-icon-anim-handler"; -import { StatsContainer } from "./stats-container"; -import { addWindow } from "./ui-theme"; -import { Nature, getNatureName } from "../data/nature"; -import BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext"; -import { pokemonFormChanges } from "../data/pokemon-forms"; -import { Tutorial, handleTutorial } from "../tutorial"; -import { LevelMoves, pokemonFormLevelMoves, pokemonSpeciesLevelMoves } from "../data/pokemon-level-moves"; -import { allMoves } from "../data/move"; -import { Type } from "../data/type"; -import { Moves } from "../data/enums/moves"; -import { speciesEggMoves } from "../data/egg-moves"; -import { TitlePhase } from "../phases"; -import { argbFromRgba } from "@material/material-color-utilities"; -import { OptionSelectItem } from "./abstact-option-select-ui-handler"; import { pokemonPrevolutions } from "#app/data/pokemon-evolutions"; import { Variant, getVariantTint } from "#app/data/variant"; +import { argbFromRgba } from "@material/material-color-utilities"; import i18next from "i18next"; -import {Button} from "../enums/buttons"; +import BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext"; +import BattleScene, { starterColors } from "../battle-scene"; +import { allAbilities } from "../data/ability"; +import { speciesEggMoves } from "../data/egg-moves"; +import { Moves } from "../data/enums/moves"; +import { Species } from "../data/enums/species"; +import { GrowthRate, getGrowthRateColor } from "../data/exp"; +import { Gender, getGenderColor, getGenderSymbol } from "../data/gender"; +import { allMoves } from "../data/move"; +import { Nature, getNatureName } from "../data/nature"; +import { pokemonFormChanges } from "../data/pokemon-forms"; +import { LevelMoves, pokemonFormLevelMoves, pokemonSpeciesLevelMoves } from "../data/pokemon-level-moves"; +import PokemonSpecies, { allSpecies, getPokemonSpecies, getPokemonSpeciesForm, getStarterValueFriendshipCap, speciesStarters, starterPassiveAbilities } from "../data/pokemon-species"; +import { Type } from "../data/type"; +import { Button } from "../enums/buttons"; +import { GameModes, gameModes } from "../game-mode"; +import { TitlePhase } from "../phases"; +import { AbilityAttr, DexAttr, DexAttrProps, DexEntry, Passive as PassiveAttr, StarterFormMoveData, StarterMoveset } from "../system/game-data"; +import { Tutorial, handleTutorial } from "../tutorial"; +import * as Utils from "../utils"; +import { OptionSelectItem } from "./abstact-option-select-ui-handler"; +import MessageUiHandler from "./message-ui-handler"; +import PokemonIconAnimHandler, { PokemonIconAnimMode } from "./pokemon-icon-anim-handler"; +import { StatsContainer } from "./stats-container"; +import { TextStyle, addBBCodeTextObject, addTextObject } from "./text"; +import { Mode } from "./ui"; +import { addWindow } from "./ui-theme"; export type StarterSelectCallback = (starters: Starter[]) => void; @@ -241,7 +241,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { this.pokemonGenderText.setOrigin(0, 0); this.starterSelectContainer.add(this.pokemonGenderText); - this.pokemonUncaughtText = addTextObject(this.scene, 6, 127, 'Uncaught', TextStyle.SUMMARY_ALT, { fontSize: '56px' }); + this.pokemonUncaughtText = addTextObject(this.scene, 6, 127, i18next.t("starterSelectUiHandler:uncaught"), TextStyle.SUMMARY_ALT, { fontSize: '56px' }); this.pokemonUncaughtText.setOrigin(0, 0); this.starterSelectContainer.add(this.pokemonUncaughtText); From 1c56efc860d5531d754c07f8785aa9cf8d0603af Mon Sep 17 00:00:00 2001 From: Benjamin Odom Date: Mon, 13 May 2024 18:12:28 -0500 Subject: [PATCH 7/9] Added Ability Triggers Localization (#811) Adds the base files needed to start translating Ability trigger messages. Provides one as an example. --- src/data/ability.ts | 4 ++-- src/locales/de/ability-trigger.ts | 5 +++++ src/locales/de/config.ts | 2 ++ src/locales/en/ability-trigger.ts | 5 +++++ src/locales/en/config.ts | 4 +++- src/locales/es/ability-trigger.ts | 5 +++++ src/locales/es/config.ts | 2 ++ src/locales/fr/ability-trigger.ts | 5 +++++ src/locales/fr/config.ts | 2 ++ src/locales/it/ability-trigger.ts | 5 +++++ src/locales/it/config.ts | 2 ++ src/locales/zh_CN/ability-trigger.ts | 5 +++++ src/locales/zh_CN/config.ts | 2 ++ src/plugins/i18n.ts | 3 ++- 14 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 src/locales/de/ability-trigger.ts create mode 100644 src/locales/en/ability-trigger.ts create mode 100644 src/locales/es/ability-trigger.ts create mode 100644 src/locales/fr/ability-trigger.ts create mode 100644 src/locales/it/ability-trigger.ts create mode 100644 src/locales/zh_CN/ability-trigger.ts diff --git a/src/data/ability.ts b/src/data/ability.ts index b2899a33f..5ef07c39f 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -3,7 +3,7 @@ import { Type } from "./type"; import * as Utils from "../utils"; import { BattleStat, getBattleStatName } from "./battle-stat"; import { PokemonHealPhase, ShowAbilityPhase, StatChangePhase } from "../phases"; -import { getPokemonMessage } from "../messages"; +import { getPokemonMessage, getPokemonPrefix } from "../messages"; import { Weather, WeatherType } from "./weather"; import { BattlerTag } from "./battler-tags"; import { BattlerTagType } from "./enums/battler-tag-type"; @@ -144,7 +144,7 @@ export class BlockRecoilDamageAttr extends AbAttr { } getTriggerMessage(pokemon: Pokemon, abilityName: string, ...args: any[]) { - return getPokemonMessage(pokemon, `'s ${abilityName}\nprotected it from recoil!`); + return i18next.t('abilityTriggers:blockRecoilDamage', {pokemonName: `${getPokemonPrefix(pokemon)}${pokemon.name}`, abilityName: abilityName}); } } diff --git a/src/locales/de/ability-trigger.ts b/src/locales/de/ability-trigger.ts new file mode 100644 index 000000000..889007412 --- /dev/null +++ b/src/locales/de/ability-trigger.ts @@ -0,0 +1,5 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const abilityTriggers: SimpleTranslationEntries = { + 'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`, +} as const; \ No newline at end of file diff --git a/src/locales/de/config.ts b/src/locales/de/config.ts index 2cc7a52c8..a9f4cd682 100644 --- a/src/locales/de/config.ts +++ b/src/locales/de/config.ts @@ -1,4 +1,5 @@ import { ability } from "./ability"; +import { abilityTriggers } from "./ability-trigger"; import { battle } from "./battle"; import { commandUiHandler } from "./command-ui-handler"; import { fightUiHandler } from "./fight-ui-handler"; @@ -16,6 +17,7 @@ import { tutorial } from "./tutorial"; export const deConfig = { ability: ability, + abilityTriggers: abilityTriggers, battle: battle, commandUiHandler: commandUiHandler, fightUiHandler: fightUiHandler, diff --git a/src/locales/en/ability-trigger.ts b/src/locales/en/ability-trigger.ts new file mode 100644 index 000000000..889007412 --- /dev/null +++ b/src/locales/en/ability-trigger.ts @@ -0,0 +1,5 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const abilityTriggers: SimpleTranslationEntries = { + 'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`, +} as const; \ No newline at end of file diff --git a/src/locales/en/config.ts b/src/locales/en/config.ts index 029791a70..f5e8a68b0 100644 --- a/src/locales/en/config.ts +++ b/src/locales/en/config.ts @@ -1,4 +1,5 @@ import { ability } from "./ability"; +import { abilityTriggers } from "./ability-trigger"; import { battle } from "./battle"; import { commandUiHandler } from "./command-ui-handler"; import { fightUiHandler } from "./fight-ui-handler"; @@ -14,8 +15,9 @@ import { starterSelectUiHandler } from "./starter-select-ui-handler"; import { tutorial } from "./tutorial"; -export const enConfig = { +export const enConfig = { ability: ability, + abilityTriggers: abilityTriggers, battle: battle, commandUiHandler: commandUiHandler, fightUiHandler: fightUiHandler, diff --git a/src/locales/es/ability-trigger.ts b/src/locales/es/ability-trigger.ts new file mode 100644 index 000000000..889007412 --- /dev/null +++ b/src/locales/es/ability-trigger.ts @@ -0,0 +1,5 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const abilityTriggers: SimpleTranslationEntries = { + 'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`, +} as const; \ No newline at end of file diff --git a/src/locales/es/config.ts b/src/locales/es/config.ts index 564b8dd32..c56a8d384 100644 --- a/src/locales/es/config.ts +++ b/src/locales/es/config.ts @@ -1,4 +1,5 @@ import { ability } from "./ability"; +import { abilityTriggers } from "./ability-trigger"; import { battle } from "./battle"; import { commandUiHandler } from "./command-ui-handler"; import { fightUiHandler } from "./fight-ui-handler"; @@ -16,6 +17,7 @@ import { tutorial } from "./tutorial"; export const esConfig = { ability: ability, + abilityTriggers: abilityTriggers, battle: battle, commandUiHandler: commandUiHandler, fightUiHandler: fightUiHandler, diff --git a/src/locales/fr/ability-trigger.ts b/src/locales/fr/ability-trigger.ts new file mode 100644 index 000000000..889007412 --- /dev/null +++ b/src/locales/fr/ability-trigger.ts @@ -0,0 +1,5 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const abilityTriggers: SimpleTranslationEntries = { + 'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`, +} as const; \ No newline at end of file diff --git a/src/locales/fr/config.ts b/src/locales/fr/config.ts index 90f9fb83c..89669aceb 100644 --- a/src/locales/fr/config.ts +++ b/src/locales/fr/config.ts @@ -1,4 +1,5 @@ import { ability } from "./ability"; +import { abilityTriggers } from "./ability-trigger"; import { battle } from "./battle"; import { commandUiHandler } from "./command-ui-handler"; import { fightUiHandler } from "./fight-ui-handler"; @@ -16,6 +17,7 @@ import { tutorial } from "./tutorial"; export const frConfig = { ability: ability, + abilityTriggers: abilityTriggers, battle: battle, commandUiHandler: commandUiHandler, fightUiHandler: fightUiHandler, diff --git a/src/locales/it/ability-trigger.ts b/src/locales/it/ability-trigger.ts new file mode 100644 index 000000000..889007412 --- /dev/null +++ b/src/locales/it/ability-trigger.ts @@ -0,0 +1,5 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const abilityTriggers: SimpleTranslationEntries = { + 'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`, +} as const; \ No newline at end of file diff --git a/src/locales/it/config.ts b/src/locales/it/config.ts index bbfd452dc..6ba9aa3af 100644 --- a/src/locales/it/config.ts +++ b/src/locales/it/config.ts @@ -1,4 +1,5 @@ import { ability } from "./ability"; +import { abilityTriggers } from "./ability-trigger"; import { battle } from "./battle"; import { commandUiHandler } from "./command-ui-handler"; import { fightUiHandler } from "./fight-ui-handler"; @@ -16,6 +17,7 @@ import { tutorial } from "./tutorial"; export const itConfig = { ability: ability, + abilityTriggers: abilityTriggers, battle: battle, commandUiHandler: commandUiHandler, fightUiHandler: fightUiHandler, diff --git a/src/locales/zh_CN/ability-trigger.ts b/src/locales/zh_CN/ability-trigger.ts new file mode 100644 index 000000000..889007412 --- /dev/null +++ b/src/locales/zh_CN/ability-trigger.ts @@ -0,0 +1,5 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const abilityTriggers: SimpleTranslationEntries = { + 'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`, +} as const; \ No newline at end of file diff --git a/src/locales/zh_CN/config.ts b/src/locales/zh_CN/config.ts index a8f5f878b..496fd983c 100644 --- a/src/locales/zh_CN/config.ts +++ b/src/locales/zh_CN/config.ts @@ -1,4 +1,5 @@ import { ability } from "./ability"; +import { abilityTriggers } from "./ability-trigger"; import { battle } from "./battle"; import { commandUiHandler } from "./command-ui-handler"; import { fightUiHandler } from "./fight-ui-handler"; @@ -15,6 +16,7 @@ import { nature } from "./nature"; export const zhCnConfig = { ability: ability, + abilityTriggers: abilityTriggers, battle: battle, commandUiHandler: commandUiHandler, fightUiHandler: fightUiHandler, diff --git a/src/plugins/i18n.ts b/src/plugins/i18n.ts index 676e691ee..82a5a51ba 100644 --- a/src/plugins/i18n.ts +++ b/src/plugins/i18n.ts @@ -98,7 +98,8 @@ declare module 'i18next' { menu: SimpleTranslationEntries; menuUiHandler: SimpleTranslationEntries; move: MoveTranslationEntries; - battle: SimpleTranslationEntries, + battle: SimpleTranslationEntries; + abilityTriggers: SimpleTranslationEntries; ability: AbilityTranslationEntries; pokeball: SimpleTranslationEntries; pokemon: SimpleTranslationEntries; From 19d244ee949ef071847dce2806b2a1ac9e367798 Mon Sep 17 00:00:00 2001 From: JackGilham <46994951+JackGilham@users.noreply.github.com> Date: Tue, 14 May 2024 00:38:27 +0100 Subject: [PATCH 8/9] Update modifier-type.ts (#636) Issue#613. Have added additional EvolutionItemModifierType condition that prevents none base form pokes from taking Evo Items. --- src/modifier/modifier-type.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modifier/modifier-type.ts b/src/modifier/modifier-type.ts index 2457a705b..6b3365230 100644 --- a/src/modifier/modifier-type.ts +++ b/src/modifier/modifier-type.ts @@ -554,10 +554,10 @@ export class EvolutionItemModifierType extends PokemonModifierType implements Ge super(Utils.toReadableString(EvolutionItem[evolutionItem]), `Causes certain Pokémon to evolve`, (_type, args) => new Modifiers.EvolutionItemModifier(this, (args[0] as PlayerPokemon).id), (pokemon: PlayerPokemon) => { if (pokemonEvolutions.hasOwnProperty(pokemon.species.speciesId) && pokemonEvolutions[pokemon.species.speciesId].filter(e => e.item === this.evolutionItem - && (!e.condition || e.condition.predicate(pokemon))).length) + && (!e.condition || e.condition.predicate(pokemon))).length && (pokemon.formIndex == 0)) return null; else if (pokemon.isFusion() && pokemonEvolutions.hasOwnProperty(pokemon.fusionSpecies.speciesId) && pokemonEvolutions[pokemon.fusionSpecies.speciesId].filter(e => e.item === this.evolutionItem - && (!e.condition || e.condition.predicate(pokemon))).length) + && (!e.condition || e.condition.predicate(pokemon))).length && (pokemon.fusionFormIndex == 0)) return null; return PartyUiHandler.NoEffectMessage; From 1d29ca797462ceeff3dbdbc9d005ec9c9ead113b Mon Sep 17 00:00:00 2001 From: LaukkaE <73663099+LaukkaE@users.noreply.github.com> Date: Tue, 14 May 2024 02:48:22 +0300 Subject: [PATCH 9/9] Fix Comeuppance (#781) --- src/data/move.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/move.ts b/src/data/move.ts index 652e832fd..2b61d30b8 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -6841,7 +6841,7 @@ export function initMoves() { const turnMove = user.getLastXMoves(1); return !turnMove.length || turnMove[0].move !== move.id || turnMove[0].result !== MoveResult.SUCCESS; }), // TODO Add Instruct/Encore interaction - new AttackMove(Moves.COMEUPPANCE, Type.DARK, MoveCategory.PHYSICAL, 1, 100, 10, -1, 0, 9) + new AttackMove(Moves.COMEUPPANCE, Type.DARK, MoveCategory.PHYSICAL, -1, 100, 10, -1, 0, 9) .attr(CounterDamageAttr, (move: Move) => (move.category === MoveCategory.PHYSICAL || move.category === MoveCategory.SPECIAL), 1.5) .target(MoveTarget.ATTACKER), new AttackMove(Moves.AQUA_CUTTER, Type.WATER, MoveCategory.PHYSICAL, 70, 100, 20, -1, 0, 9)