Compare commits

...

3 Commits

Author SHA1 Message Date
sodam
145a79f8ef
[Localization] Fixed typo in Korean tutorial (#1757) 2024-06-03 11:38:37 -04:00
José Ricardo Fleury Oliveira
1abc591318
[ptBR Translations] Dialogue, game-stats and more (#1559)
* fixed translations and started dialogues

* ptBR translations

* fixes

* minor fix

* minor fixes 2

* firebreather

* minor translations

* minor translations
2024-06-03 15:30:27 +01:00
Frede
12bd22f2ca
Added "Skip Seen Dialogues" option (#1431)
* Added "Skip Dialogues" option (if at least 1 classic win)

* Removed error sound and hide option instead when classic wins = 0

* Add skip dialogues option to Unlockables and show unlocked message on first classic win

* Only skips seen dialogues, removed dialogue option from unlockables, seen dialogues get saved to local storage

* oops

* dont show charSprite when skipping a dialogue, small fixes

---------

Co-authored-by: Frederik Hobein <frederik.hobein@nterra.com>
2024-06-03 11:49:13 +01:00
15 changed files with 1208 additions and 1143 deletions

View File

@ -114,6 +114,8 @@ export default class BattleScene extends SceneBase {
public experimentalSprites: boolean = false;
public moveAnimations: boolean = true;
public expGainsSpeed: integer = 0;
public skipSeenDialogues: boolean = false;
/**
* Defines the experience gain display mode.
*

View File

@ -1,4 +1,4 @@
import {DialogueTranslationEntries, SimpleTranslationEntries} from "#app/plugins/i18n";
import { DialogueTranslationEntries, SimpleTranslationEntries } from "#app/plugins/i18n";
// Dialogue of the NPCs in the game when the player character is male (or unset)
export const PGMdialogue: DialogueTranslationEntries = {
@ -2398,12 +2398,12 @@ export const PGMdoubleBattleDialogue: DialogueTranslationEntries = {
},
"steven_wallace_double": {
"encounter": {
1: `Steven: Do you have any rare pokémon?
$Wallace: Steven... We are here for a battle, not to show off our pokémon.
1: `Steven: Do you have any rare Pokémon?
$Wallace: Steven... We are here for a battle, not to show off our Pokémon.
$Steven: Oh... I see... Let's go then!`,
},
"victory": {
1: `Steven: Now that we are done with the battle, let's show off our pokémon!
1: `Steven: Now that we are done with the battle, let's show off our Pokémon!
$Wallace: Steven...`,
},
},

View File

@ -29,8 +29,8 @@ export const tutorial: SimpleTranslationEntries = {
$종류는 , , .
$대부분의 .
$진화용과 .
$지닌 .
$지닌 .
$지닌 .
$지닌 .
$돈으로 , .
$아이템을 , .`,

View File

@ -3,5 +3,5 @@ import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const abilityTriggers: SimpleTranslationEntries = {
"blockRecoilDamage" : "{{abilityName}} de {{pokemonName}}\nprotegeu-o do dano de recuo!",
"badDreams": "{{pokemonName}} está tendo pesadelos!",
"windPowerCharged": "Being hit by {{moveName}} charged {{pokemonName}} with power!"
"windPowerCharged": "Ser atingido por {{moveName}} carregou {{pokemonName}} com poder!"
} as const;

View File

@ -48,7 +48,7 @@ export const battle: SimpleTranslationEntries = {
"noEscapeForce": "Uma força misteriosa\nte impede de fugir.",
"noEscapeTrainer": "Não se pode fugir de\nbatalhas contra treinadores!",
"noEscapePokemon": "O movimento {{moveName}} de {{pokemonName}} te impede de fugir!",
"runAwaySuccess": "Você fugiu com sucesso",
"runAwaySuccess": "Você fugiu com sucesso.",
"runAwayCannotEscape": "Você nao conseguiu fugir!",
"escapeVerbSwitch": "trocar",
"escapeVerbFlee": "fugir",
@ -56,6 +56,6 @@ export const battle: SimpleTranslationEntries = {
"skipItemQuestion": "Tem certeza de que não quer escolher um item?",
"eggHatching": "Opa?",
"ivScannerUseQuestion": "Quer usar o Scanner de IVs em {{pokemonName}}?",
"drainMessage": "{{pokemonName}} had its\nenergy drained!",
"regainHealth": "{{pokemonName}} regained\nhealth!"
"drainMessage": "{{pokemonName}} teve sua\nenergia drenada!",
"regainHealth": "{{pokemonName}} recuperou\npontos de saúde!"
} as const;

View File

@ -4,8 +4,8 @@ export const biome: SimpleTranslationEntries = {
"unknownLocation": "Em algum lugar do qual você não se lembra",
"TOWN": "Cidade",
"PLAINS": "Planície",
"GRASS": "Campo de Grama",
"TALL_GRASS": "Campo de Grama Alta",
"GRASS": "Grama",
"TALL_GRASS": "Grama Alta",
"METROPOLIS": "Metrópole",
"FOREST": "Floresta",
"SEA": "Mar",

File diff suppressed because it is too large Load Diff

View File

@ -1,44 +1,44 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const gameStatsUiHandler: SimpleTranslationEntries = {
"stats": "Stats",
"playTime": "Play Time",
"totalBattles": "Total Battles",
"starters": "Starters",
"shinyStarters": "Shiny Starters",
"speciesSeen": "Species Seen",
"speciesCaught": "Species Caught",
"ribbonsOwned": "Ribbons Owned",
"classicRuns": "Classic Runs",
"classicWins": "Classic Wins",
"dailyRunAttempts": "Daily Run Attempts",
"dailyRunWins": "Daily Run Wins",
"endlessRuns": "Endless Runs",
"highestWaveEndless": "Highest Wave (Endless)",
"highestMoney": "Highest Money",
"highestDamage": "Highest Damage",
"highestHPHealed": "Highest HP Healed",
"pokemonEncountered": "Pokémon Encountered",
"pokemonDefeated": "Pokémon Defeated",
"pokemonCaught": "Pokémon Caught",
"eggsHatched": "Eggs Hatched",
"subLegendsSeen": "Sub-Legends Seen",
"subLegendsCaught": "Sub-Legends Caught",
"subLegendsHatched": "Sub-Legends Hatched",
"legendsSeen": "Legends Seen",
"legendsCaught": "Legends Caught",
"legendsHatched": "Legends Hatched",
"mythicalsSeen": "Mythicals Seen",
"mythicalsCaught": "Mythicals Caught",
"mythicalsHatched": "Mythicals Hatched",
"shiniesSeen": "Shinies Seen",
"shiniesCaught": "Shinies Caught",
"shiniesHatched": "Shinies Hatched",
"pokemonFused": "Pokémon Fused",
"trainersDefeated": "Trainers Defeated",
"eggsPulled": "Eggs Pulled",
"rareEggsPulled": "Rare Eggs Pulled",
"epicEggsPulled": "Epic Eggs Pulled",
"legendaryEggsPulled": "Legendary Eggs Pulled",
"manaphyEggsPulled": "Manaphy Eggs Pulled",
"stats": "Estatísticas",
"playTime": "Tempo de Jogo",
"totalBattles": "Total de Batalhas",
"starters": "Iniciais",
"shinyStarters": "Iniciais Shiny",
"speciesSeen": "Espécies Vistas",
"speciesCaught": "Capturadas",
"ribbonsOwned": "Fitas Obtidas",
"classicRuns": "Jogos Clássicos",
"classicWins": "Vitórias Clássicas",
"dailyRunAttempts": "Jogos de Desafio Diário",
"dailyRunWins": "Vitórias de Desafio Diário",
"endlessRuns": "Jogos Infinitos",
"highestWaveEndless": "Maior Onda (Infinito)",
"highestMoney": "Maior Dinheiro",
"highestDamage": "Maior Dano",
"highestHPHealed": "Maior PS Curado",
"pokemonEncountered": "Pokémon Encontrados",
"pokemonDefeated": "Pokémon Derrotados",
"pokemonCaught": "Pokémon Capturados",
"eggsHatched": "Ovos Chocados",
"subLegendsSeen": "Sub-Lendários Vistos",
"subLegendsCaught": "Sub-Lend. Capturados",
"subLegendsHatched": "Sub-Lendários Chocados",
"legendsSeen": "Lendários Vistos",
"legendsCaught": "Lendários Capturados",
"legendsHatched": "Legendários Chocados",
"mythicalsSeen": "Míticos Vistos",
"mythicalsCaught": "Míticos Capturados",
"mythicalsHatched": "Míticos Chocados",
"shiniesSeen": "Shinies Vistos",
"shiniesCaught": "Shinies Capturados",
"shiniesHatched": "Shinies Chocados",
"pokemonFused": "Pokémon Fundidos",
"trainersDefeated": "Treinadores Derrotados",
"eggsPulled": "Ovos Ganhos",
"rareEggsPulled": "Ovos Raros Ganhos",
"epicEggsPulled": "Ovos Épicos Ganhos",
"legendaryEggsPulled": "Ovos Lendários Ganhos",
"manaphyEggsPulled": "Ovos de Manaphy Ganhos",
} as const;

View File

@ -209,8 +209,8 @@ export const modifierType: ModifierTypeTranslationEntries = {
"LEFTOVERS": { name: "Sobras", description: "Cura 1/16 dos PS máximos de um Pokémon a cada turno" },
"SHELL_BELL": { name: "Concha-Sino", description: "Cura 1/8 do dano causado por um Pokémon" },
"TOXIC_ORB": { name: "Toxic Orb", description: "It's a bizarre orb that exudes toxins when touched and will badly poison the holder during battle" },
"FLAME_ORB": { name: "Flame Orb", description: "It's a bizarre orb that gives off heat when touched and will affect the holder with a burn during battle" },
"TOXIC_ORB": { name: "Esfera Tóxica", description: "Uma esfera estranha que exala toxinas quando tocada e envenena seriamente quem a segurar" },
"FLAME_ORB": { name: "Esfera da Chama", description: "Uma esfera estranha que aquece quando tocada e queima quem a segurar" },
"BATON": { name: "Bastão", description: "Permite passar mudanças de atributo ao trocar Pokémon, ignorando armadilhas" },

View File

@ -1943,7 +1943,7 @@ export const move: MoveTranslationEntries = {
},
"electroBall": {
name: "Electro Ball",
effect: "O usuário arremessa uma orbe elétrica no alvo. Quanto mais rápido for o usuário comparado ao alvo, maior será o poder do movimento."
effect: "O usuário arremessa uma esfera elétrica no alvo. Quanto mais rápido for o usuário comparado ao alvo, maior será o poder do movimento."
},
"soak": {
name: "Soak",
@ -2495,7 +2495,7 @@ export const move: MoveTranslationEntries = {
},
"allOutPummelingPhysical": {
name: "All-Out Pummeling",
effect: "Utilizando o Poder Z, o usuário cria e arremessa um orbe de energia no alvo com força total. Seu poder varia dependendo do movimento original."
effect: "Utilizando o Poder Z, o usuário cria e arremessa uma esfera de energia no alvo com força total. Seu poder varia dependendo do movimento original."
},
"allOutPummelingSpecial": {
name: "All-Out Pummeling",

View File

@ -48,7 +48,7 @@ export const trainerClasses: SimpleTranslationEntries = {
"depot_agent": "Ferroviário",
"doctor": "Doutor",
"doctor_female": "Doutora",
"firebreather": "Firebreather",
"firebreather": "Cospe-Fogo",
"fishermen": "Pescador",
"fishermen_female": "Pescadora",
"gentleman": "Cavalheiro",

View File

@ -959,14 +959,15 @@ export class EncounterPhase extends BattlePhase {
if (!encounterMessages?.length) {
doSummon();
} else {
let message: string;
this.scene.executeWithSeedOffset(() => message = Utils.randSeedItem(encounterMessages), this.scene.currentBattle.waveIndex);
const showDialogueAndSummon = () => {
let message: string;
this.scene.executeWithSeedOffset(() => message = Utils.randSeedItem(encounterMessages), this.scene.currentBattle.waveIndex);
this.scene.ui.showDialogue(message, trainer.getName(TrainerSlot.NONE,true), null, () => {
this.scene.charSprite.hide().then(() => this.scene.hideFieldOverlay(250).then(() => doSummon()));
});
};
if (this.scene.currentBattle.trainer.config.hasCharSprite) {
if (this.scene.currentBattle.trainer.config.hasCharSprite && !this.scene.ui.shouldSkipDialogue(message)) {
this.scene.showFieldOverlay(500).then(() => this.scene.charSprite.showCharacter(trainer.getKey(), getCharVariantFromDialogue(encounterMessages[0])).then(() => showDialogueAndSummon()));
} else {
showDialogueAndSummon();
@ -3789,21 +3790,18 @@ export class TrainerVictoryPhase extends BattlePhase {
this.scene.ui.showText(i18next.t("battle:trainerDefeated", { trainerName: this.scene.currentBattle.trainer.getName(TrainerSlot.NONE, true) }), null, () => {
const victoryMessages = this.scene.currentBattle.trainer.getVictoryMessages();
const showMessage = () => {
let message: string;
this.scene.executeWithSeedOffset(() => message = Utils.randSeedItem(victoryMessages), this.scene.currentBattle.waveIndex);
const messagePages = message.split(/\$/g).map(m => m.trim());
let message: string;
this.scene.executeWithSeedOffset(() => message = Utils.randSeedItem(victoryMessages), this.scene.currentBattle.waveIndex);
for (let p = messagePages.length - 1; p >= 0; p--) {
const originalFunc = showMessageOrEnd;
showMessageOrEnd = () => this.scene.ui.showDialogue(messagePages[p], this.scene.currentBattle.trainer.getName(), null, originalFunc);
}
const showMessage = () => {
const originalFunc = showMessageOrEnd;
showMessageOrEnd = () => this.scene.ui.showDialogue(message, this.scene.currentBattle.trainer.getName(), null, originalFunc);
showMessageOrEnd();
};
let showMessageOrEnd = () => this.end();
if (victoryMessages?.length) {
if (this.scene.currentBattle.trainer.config.hasCharSprite) {
if (this.scene.currentBattle.trainer.config.hasCharSprite && !this.scene.ui.shouldSkipDialogue(message)) {
const originalFunc = showMessageOrEnd;
showMessageOrEnd = () => this.scene.charSprite.hide().then(() => this.scene.hideFieldOverlay(250).then(() => originalFunc()));
this.scene.showFieldOverlay(500).then(() => this.scene.charSprite.showCharacter(this.scene.currentBattle.trainer.getKey(), getCharVariantFromDialogue(victoryMessages[0])).then(() => showMessage()));
@ -4014,19 +4012,27 @@ export class GameOverPhase extends BattlePhase {
};
if (this.victory && this.scene.gameMode.isClassic) {
this.scene.ui.fadeIn(500).then(() => {
this.scene.charSprite.showCharacter(`rival_${this.scene.gameData.gender === PlayerGender.FEMALE ? "m" : "f"}`, getCharVariantFromDialogue(miscDialogue.ending[this.scene.gameData.gender === PlayerGender.FEMALE ? 0 : 1])).then(() => {
this.scene.ui.showDialogue(miscDialogue.ending[this.scene.gameData.gender === PlayerGender.FEMALE ? 0 : 1], this.scene.gameData.gender === PlayerGender.FEMALE ? trainerConfigs[TrainerType.RIVAL].name : trainerConfigs[TrainerType.RIVAL].nameFemale, null, () => {
this.scene.ui.fadeOut(500).then(() => {
this.scene.charSprite.hide().then(() => {
const endCardPhase = new EndCardPhase(this.scene);
this.scene.unshiftPhase(endCardPhase);
clear(endCardPhase);
const message = miscDialogue.ending[this.scene.gameData.gender === PlayerGender.FEMALE ? 0 : 1];
if (!this.scene.ui.shouldSkipDialogue(message)) {
this.scene.ui.fadeIn(500).then(() => {
this.scene.charSprite.showCharacter(`rival_${this.scene.gameData.gender === PlayerGender.FEMALE ? "m" : "f"}`, getCharVariantFromDialogue(miscDialogue.ending[this.scene.gameData.gender === PlayerGender.FEMALE ? 0 : 1])).then(() => {
this.scene.ui.showDialogue(message, this.scene.gameData.gender === PlayerGender.FEMALE ? trainerConfigs[TrainerType.RIVAL].name : trainerConfigs[TrainerType.RIVAL].nameFemale, null, () => {
this.scene.ui.fadeOut(500).then(() => {
this.scene.charSprite.hide().then(() => {
const endCardPhase = new EndCardPhase(this.scene);
this.scene.unshiftPhase(endCardPhase);
clear(endCardPhase);
});
});
});
});
});
});
} else {
const endCardPhase = new EndCardPhase(this.scene);
this.scene.unshiftPhase(endCardPhase);
clear(endCardPhase);
}
} else {
clear();
}

View File

@ -40,7 +40,8 @@ export enum GameDataType {
SYSTEM,
SESSION,
SETTINGS,
TUTORIALS
TUTORIALS,
SEEN_DIALOGUES
}
export enum PlayerGender {
@ -68,6 +69,8 @@ export function getDataTypeKey(dataType: GameDataType, slotId: integer = 0): str
return "settings";
case GameDataType.TUTORIALS:
return "tutorials";
case GameDataType.SEEN_DIALOGUES:
return "seenDialogues";
}
}
@ -201,6 +204,10 @@ export interface TutorialFlags {
[key: string]: boolean
}
export interface SeenDialogues {
[key: string]: boolean;
}
const systemShortKeys = {
seenAttr: "$sa",
caughtAttr: "$ca",
@ -716,9 +723,10 @@ export class GameData {
}
public saveTutorialFlag(tutorial: Tutorial, flag: boolean): boolean {
const key = getDataTypeKey(GameDataType.TUTORIALS);
let tutorials: object = {};
if (localStorage.hasOwnProperty("tutorials")) {
tutorials = JSON.parse(localStorage.getItem("tutorials"));
if (localStorage.hasOwnProperty(key)) {
tutorials = JSON.parse(localStorage.getItem(key));
}
Object.keys(Tutorial).map(t => t as Tutorial).forEach(t => {
@ -730,20 +738,21 @@ export class GameData {
}
});
localStorage.setItem("tutorials", JSON.stringify(tutorials));
localStorage.setItem(key, JSON.stringify(tutorials));
return true;
}
public getTutorialFlags(): TutorialFlags {
const key = getDataTypeKey(GameDataType.TUTORIALS);
const ret: TutorialFlags = {};
Object.values(Tutorial).map(tutorial => tutorial as Tutorial).forEach(tutorial => ret[Tutorial[tutorial]] = false);
if (!localStorage.hasOwnProperty("tutorials")) {
if (!localStorage.hasOwnProperty(key)) {
return ret;
}
const tutorials = JSON.parse(localStorage.getItem("tutorials"));
const tutorials = JSON.parse(localStorage.getItem(key));
for (const tutorial of Object.keys(tutorials)) {
ret[tutorial] = tutorials[tutorial];
@ -752,6 +761,34 @@ export class GameData {
return ret;
}
public saveSeenDialogue(dialogue: string): boolean {
const key = getDataTypeKey(GameDataType.SEEN_DIALOGUES);
const dialogues: object = this.getSeenDialogues();
dialogues[dialogue] = true;
localStorage.setItem(key, JSON.stringify(dialogues));
console.log("Dialogue saved as seen:", dialogue);
return true;
}
public getSeenDialogues(): SeenDialogues {
const key = getDataTypeKey(GameDataType.SEEN_DIALOGUES);
const ret: SeenDialogues = {};
if (!localStorage.hasOwnProperty(key)) {
return ret;
}
const dialogues = JSON.parse(localStorage.getItem(key));
for (const dialogue of Object.keys(dialogues)) {
ret[dialogue] = dialogues[dialogue];
}
return ret;
}
private getSessionSaveData(scene: BattleScene): SessionSaveData {
return {
seed: scene.seed,

View File

@ -19,6 +19,7 @@ export enum Setting {
Window_Type = "WINDOW_TYPE",
Tutorials = "TUTORIALS",
Enable_Retries = "ENABLE_RETRIES",
Skip_Seen_Dialogues = "SKIP_SEEN_DIALOGUES",
Candy_Upgrade_Notification = "CANDY_UPGRADE_NOTIFICATION",
Candy_Upgrade_Display = "CANDY_UPGRADE_DISPLAY",
Money_Format = "MONEY_FORMAT",
@ -54,6 +55,7 @@ export const settingOptions: SettingOptions = {
[Setting.Window_Type]: new Array(5).fill(null).map((_, i) => (i + 1).toString()),
[Setting.Tutorials]: ["Off", "On"],
[Setting.Enable_Retries]: ["Off", "On"],
[Setting.Skip_Seen_Dialogues]: ["Off", "On"],
[Setting.Candy_Upgrade_Notification]: ["Off", "Passives Only", "On"],
[Setting.Candy_Upgrade_Display]: ["Icon", "Animation"],
[Setting.Money_Format]: ["Normal", "Abbreviated"],
@ -81,6 +83,7 @@ export const settingDefaults: SettingDefaults = {
[Setting.Window_Type]: 0,
[Setting.Tutorials]: 1,
[Setting.Enable_Retries]: 0,
[Setting.Skip_Seen_Dialogues]: 0,
[Setting.Candy_Upgrade_Notification]: 0,
[Setting.Candy_Upgrade_Display]: 0,
[Setting.Money_Format]: 0,
@ -198,6 +201,9 @@ export function setSetting(scene: BattleScene, setting: Setting, value: integer)
case Setting.Vibration:
scene.enableVibration = settingOptions[setting][value] !== "Disabled" && hasTouchscreen();
break;
case Setting.Skip_Seen_Dialogues:
scene.skipSeenDialogues = settingOptions[setting][value] === "On";
break;
case Setting.Language:
if (value) {
if (scene.ui) {

View File

@ -259,15 +259,26 @@ export default class UI extends Phaser.GameObjects.Container {
}
// Add the prefix to the text
const localizationKey = playerGenderPrefix + text;
// Get localized dialogue (if available)
let hasi18n = false;
if (i18next.exists(localizationKey as ParseKeys) ) {
text = i18next.t(localizationKey as ParseKeys);
hasi18n = true;
// Skip dialogue if the player has enabled the option and the dialogue has been already seen
if ((this.scene as BattleScene).skipSeenDialogues && (this.scene as BattleScene).gameData.getSeenDialogues()[localizationKey] === true) {
console.log(`Dialogue ${localizationKey} skipped`);
callback();
return;
}
}
let showMessageAndCallback = () => {
hasi18n && (this.scene as BattleScene).gameData.saveSeenDialogue(localizationKey);
callback();
};
if (text.indexOf("$") > -1) {
const messagePages = text.split(/\$/g).map(m => m.trim());
let showMessageAndCallback = () => callback();
for (let p = messagePages.length - 1; p >= 0; p--) {
const originalFunc = showMessageAndCallback;
showMessageAndCallback = () => this.showDialogue(messagePages[p], name, null, originalFunc);
@ -276,13 +287,29 @@ export default class UI extends Phaser.GameObjects.Container {
} else {
const handler = this.getHandler();
if (handler instanceof MessageUiHandler) {
(handler as MessageUiHandler).showDialogue(text, name, delay, callback, callbackDelay, true, promptDelay);
(handler as MessageUiHandler).showDialogue(text, name, delay, showMessageAndCallback, callbackDelay, true, promptDelay);
} else {
this.getMessageHandler().showDialogue(text, name, delay, callback, callbackDelay, true, promptDelay);
this.getMessageHandler().showDialogue(text, name, delay, showMessageAndCallback, callbackDelay, true, promptDelay);
}
}
}
shouldSkipDialogue(text): boolean {
let playerGenderPrefix = "PGM";
if ((this.scene as BattleScene).gameData.gender === PlayerGender.FEMALE) {
playerGenderPrefix = "PGF";
}
const key = playerGenderPrefix + text;
if (i18next.exists(key as ParseKeys) ) {
if ((this.scene as BattleScene).skipSeenDialogues && (this.scene as BattleScene).gameData.getSeenDialogues()[key] === true) {
return true;
}
}
return false;
}
showTooltip(title: string, content: string, overlap?: boolean): void {
this.tooltipContainer.setVisible(true);
this.tooltipTitle.setText(title || "");