Merge branch 'main' into 745-localizedTrainerNames_TrainerClasses_And_Titles

pull/752/head
Jannik Tappert 2024-05-12 09:21:23 +02:00
commit 2b3b9aa4a7
23 changed files with 311 additions and 9 deletions

View File

@ -6362,7 +6362,8 @@ export function initMoves() {
.attr(ConfuseAttr),
new StatusMove(Moves.LIFE_DEW, Type.WATER, -1, 10, -1, 0, 8)
.attr(HealAttr, 0.25, true, false)
.target(MoveTarget.USER_AND_ALLIES),
.target(MoveTarget.USER_AND_ALLIES)
.ignoresProtect(),
new SelfStatusMove(Moves.OBSTRUCT, Type.DARK, 100, 10, -1, 4, 8)
.attr(ProtectAttr, BattlerTagType.OBSTRUCT),
new AttackMove(Moves.FALSE_SURRENDER, Type.DARK, MoveCategory.PHYSICAL, 80, -1, 10, -1, 0, 8),

View File

@ -2,6 +2,7 @@ import { Stat, getStatName } from "./pokemon-stat";
import * as Utils from "../utils";
import { TextStyle, getBBCodeFrag } from "../ui/text";
import { UiTheme } from "#app/enums/ui-theme";
import i18next from 'i18next';
export enum Nature {
HARDY,
@ -33,6 +34,10 @@ export enum Nature {
export function getNatureName(nature: Nature, includeStatEffects: boolean = false, forStarterSelect: boolean = false, ignoreBBCode: boolean = false, uiTheme: UiTheme = UiTheme.DEFAULT): string {
let ret = Utils.toReadableString(Nature[nature]);
//Translating nature
if(i18next.exists('nature:' + ret)){
ret = i18next.t('nature:' + ret as any)
}
if (includeStatEffects) {
const stats = Utils.getEnumValues(Stat).slice(1);
let increasedStat: Stat = null;

View File

@ -796,6 +796,14 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
return !!this.getTypes(true, forDefend).find(t => t === type);
}
/**
* Gets the non-passive ability of the pokemon. This accounts for fusions and ability changing effects.
* This should rarely be called, most of the time {@link hasAbility} or {@link hasAbilityWithAttr} are better used as
* those check both the passive and non-passive abilities and account for ability suppression.
* @see {@link hasAbility} {@link hasAbilityWithAttr} Intended ways to check abilities in most cases
* @param {boolean} ignoreOverride If true, ignore ability changing effects
* @returns {Ability} The non-passive ability of the pokemon
*/
getAbility(ignoreOverride?: boolean): Ability {
if (!ignoreOverride && this.summonData?.ability)
return allAbilities[this.summonData.ability];
@ -811,6 +819,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
return allAbilities[abilityId];
}
/**
* Gets the passive ability of the pokemon. This should rarely be called, most of the time
* {@link hasAbility} or {@link hasAbilityWithAttr} are better used as those check both the passive and
* non-passive abilities and account for ability suppression.
* @see {@link hasAbility} {@link hasAbilityWithAttr} Intended ways to check abilities in most cases
* @returns {Ability} The passive ability of the pokemon
*/
getPassiveAbility(): Ability {
if (Overrides.PASSIVE_ABILITY_OVERRIDE && this.isPlayer())
return allAbilities[Overrides.PASSIVE_ABILITY_OVERRIDE];
@ -838,6 +853,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
return this.passive || this.isBoss();
}
/**
* Checks whether an ability of a pokemon can be currently applied. This should rarely be
* directly called, as {@link hasAbility} and {@link hasAbilityWithAttr} already call this.
* @see {@link hasAbility} {@link hasAbilityWithAttr} Intended ways to check abilities in most cases
* @param {boolean} passive If true, check if passive can be applied instead of non-passive
* @returns {Ability} The passive ability of the pokemon
*/
canApplyAbility(passive: boolean = false): boolean {
if (passive && !this.hasPassive())
return false;
@ -862,6 +884,15 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
return (this.hp || ability.isBypassFaint) && !ability.conditions.find(condition => !condition(this));
}
/**
* Checks whether a pokemon has the specified ability and it's in effect. Accounts for all the various
* effects which can affect whether an ability will be present or in effect, and both passive and
* non-passive. This is the primary way to check whether a pokemon has a particular ability.
* @param {Abilities} ability The ability to check for
* @param {boolean} canApply If false, it doesn't check whether the abiltiy is currently active
* @param {boolean} ignoreOverride If true, it ignores ability changing effects
* @returns {boolean} Whether the ability is present and active
*/
hasAbility(ability: Abilities, canApply: boolean = true, ignoreOverride?: boolean): boolean {
if ((!canApply || this.canApplyAbility()) && this.getAbility(ignoreOverride).id === ability)
return true;
@ -870,6 +901,16 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
return false;
}
/**
* Checks whether a pokemon has an ability with the specified attribute and it's in effect.
* Accounts for all the various effects which can affect whether an ability will be present or
* in effect, and both passive and non-passive. This is one of the two primary ways to check
* whether a pokemon has a particular ability.
* @param {AbAttr} attrType The ability attribute to check for
* @param {boolean} canApply If false, it doesn't check whether the abiltiy is currently active
* @param {boolean} ignoreOverride If true, it ignores ability changing effects
* @returns {boolean} Whether an ability with that attribute is present and active
*/
hasAbilityWithAttr(attrType: { new(...args: any[]): AbAttr }, canApply: boolean = true, ignoreOverride?: boolean): boolean {
if ((!canApply || this.canApplyAbility()) && this.getAbility(ignoreOverride).hasAttr(attrType))
return true;

View File

@ -2,9 +2,11 @@ import { ability } from "./ability";
import { battle } from "./battle";
import { commandUiHandler } from "./command-ui-handler";
import { fightUiHandler } from "./fight-ui-handler";
import { growth } from "./growth";
import { menu } from "./menu";
import { menuUiHandler } from "./menu-ui-handler";
import { move } from "./move";
import { nature } from "./nature";
import { pokeball } from "./pokeball";
import { pokemon } from "./pokemon";
import { pokemonStat } from "./pokemon-stat";
@ -29,4 +31,6 @@ export const deConfig = {
trainerClasses: trainerClasses,
trainerNames: trainerNames,
tutorial: tutorial
}
nature: nature,
growth: growth
}

10
src/locales/de/growth.ts Normal file
View File

@ -0,0 +1,10 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const growth: SimpleTranslationEntries = {
"Erratic": "Erratic",
"Fast": "Fast",
"Medium_Fast": "Medium Fast",
"Medium_Slow": "Medium Slow",
"Slow": "Slow",
"Fluctuating": "Fluctuating"
} as const;

29
src/locales/de/nature.ts Normal file
View File

@ -0,0 +1,29 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const nature: SimpleTranslationEntries = {
"Hardy": "Robust",
"Lonely": "Solo",
"Brave": "Mutig",
"Adamant": "Hart",
"Naughty": "Frech",
"Bold": "Kühn",
"Docile": "Sanft",
"Relaxed": "Locker",
"Impish": "Pfiffig",
"Lax": "Lasch",
"Timid": "Scheu",
"Hasty": "Hastig",
"Serious": "Ernst",
"Jolly": "Froh",
"Naive": "Naiv",
"Modest": "Mäßig",
"Mild": "Mild",
"Quiet": "Ruhig",
"Bashful": "Zaghaft",
"Rash": "Hitzig",
"Calm": "Still",
"Gentle": "Zart",
"Sassy": "Forsch",
"Careful": "Sacht",
"Quirky": "Kauzig"
} as const;

View File

@ -2,9 +2,11 @@ import { ability } from "./ability";
import { battle } from "./battle";
import { commandUiHandler } from "./command-ui-handler";
import { fightUiHandler } from "./fight-ui-handler";
import { growth } from "./growth";
import { menu } from "./menu";
import { menuUiHandler } from "./menu-ui-handler";
import { move } from "./move";
import { nature } from "./nature";
import { pokeball } from "./pokeball";
import { pokemon } from "./pokemon";
import { pokemonStat } from "./pokemon-stat";
@ -29,4 +31,6 @@ export const enConfig = {
trainerClasses: trainerClasses,
trainerNames: trainerNames,
tutorial: tutorial
}
nature: nature,
growth: growth
}

10
src/locales/en/growth.ts Normal file
View File

@ -0,0 +1,10 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const growth: SimpleTranslationEntries = {
"Erratic": "Erratic",
"Fast": "Fast",
"Medium_Fast": "Medium Fast",
"Medium_Slow": "Medium Slow",
"Slow": "Slow",
"Fluctuating": "Fluctuating"
} as const;

29
src/locales/en/nature.ts Normal file
View File

@ -0,0 +1,29 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const nature: SimpleTranslationEntries = {
"Hardy": "Hardy",
"Lonely": "Lonely",
"Brave": "Brave",
"Adamant": "Adamant",
"Naughty": "Naughty",
"Bold": "Bold",
"Docile": "Docile",
"Relaxed": "Relaxed",
"Impish": "Impish",
"Lax": "Lax",
"Timid": "Timid",
"Hasty": "Hasty",
"Serious": "Serious",
"Jolly": "Jolly",
"Naive": "Naive",
"Modest": "Modest",
"Mild": "Mild",
"Quiet": "Quiet",
"Bashful": "Bashful",
"Rash": "Rash",
"Calm": "Calm",
"Gentle": "Gentle",
"Sassy": "Sassy",
"Careful": "Careful",
"Quirky": "Quirky"
} as const;

View File

@ -2,9 +2,11 @@ import { ability } from "./ability";
import { battle } from "./battle";
import { commandUiHandler } from "./command-ui-handler";
import { fightUiHandler } from "./fight-ui-handler";
import { growth } from "./growth";
import { menu } from "./menu";
import { menuUiHandler } from "./menu-ui-handler";
import { move } from "./move";
import { nature } from "./nature";
import { pokeball } from "./pokeball";
import { pokemon } from "./pokemon";
import { pokemonStat } from "./pokemon-stat";
@ -29,4 +31,6 @@ export const esConfig = {
trainerClasses: trainerClasses,
trainerNames: trainerNames,
tutorial: tutorial
}
nature: nature,
growth: growth
}

10
src/locales/es/growth.ts Normal file
View File

@ -0,0 +1,10 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const growth: SimpleTranslationEntries = {
"Erratic": "Errático",
"Fast": "Rápido",
"Medium_Fast": "Medio Rápido",
"Medium_Slow": "Medio Lento",
"Slow": "Lento",
"Fluctuating": "Fluctuante"
} as const;

29
src/locales/es/nature.ts Normal file
View File

@ -0,0 +1,29 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const nature: SimpleTranslationEntries = {
"Hardy": "Fuerte",
"Lonely": "Huraña",
"Brave": "Audaz",
"Adamant": "Firme",
"Naughty": "Pícara",
"Bold": "Osada",
"Docile": "Dócil",
"Relaxed": "Plácida",
"Impish": "Agitada",
"Lax": "Floja",
"Timid": "Miedosa",
"Hasty": "Activa",
"Serious": "Seria",
"Jolly": "Alegre",
"Naive": "Ingenua",
"Modest": "Modesta",
"Mild": "Afable",
"Quiet": "Mansa",
"Bashful": "Tímida",
"Rash": "Alocada",
"Calm": "Serena",
"Gentle": "Amable",
"Sassy": "Grosera",
"Careful": "Cauta",
"Quirky": "Rara"
} as const;

View File

@ -2,9 +2,11 @@ import { ability } from "./ability";
import { battle } from "./battle";
import { commandUiHandler } from "./command-ui-handler";
import { fightUiHandler } from "./fight-ui-handler";
import { growth } from "./growth";
import { menu } from "./menu";
import { menuUiHandler } from "./menu-ui-handler";
import { move } from "./move";
import { nature } from "./nature";
import { pokeball } from "./pokeball";
import { pokemon } from "./pokemon";
import { pokemonStat } from "./pokemon-stat";
@ -29,4 +31,6 @@ export const frConfig = {
trainerClasses: trainerClasses,
trainerNames: trainerNames,
tutorial: tutorial
}
nature: nature,
growth: growth
}

10
src/locales/fr/growth.ts Normal file
View File

@ -0,0 +1,10 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const growth: SimpleTranslationEntries = {
"Erratic": "Erratic",
"Fast": "Fast",
"Medium_Fast": "Medium Fast",
"Medium_Slow": "Medium Slow",
"Slow": "Slow",
"Fluctuating": "Fluctuating"
} as const;

29
src/locales/fr/nature.ts Normal file
View File

@ -0,0 +1,29 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const nature: SimpleTranslationEntries = {
"Hardy": "Hardi",
"Lonely": "Solo",
"Brave": "Brave",
"Adamant": "Rigide",
"Naughty": "Mauvais",
"Bold": "Assuré",
"Docile": "Docile",
"Relaxed": "Relax",
"Impish": "Malin",
"Lax": "Lâche",
"Timid": "Timide",
"Hasty": "Pressé",
"Serious": "Sérieux",
"Jolly": "Jovial",
"Naive": "Naïf",
"Modest": "Modeste",
"Mild": "Doux",
"Quiet": "Discret",
"Bashful": "Pudique",
"Rash": "Foufou",
"Calm": "Calme",
"Gentle": "Gentil",
"Sassy": "Malpoli",
"Careful": "Prudent",
"Quirky": "Bizarre"
} as const;

View File

@ -2,9 +2,11 @@ import { ability } from "./ability";
import { battle } from "./battle";
import { commandUiHandler } from "./command-ui-handler";
import { fightUiHandler } from "./fight-ui-handler";
import { growth } from "./growth";
import { menu } from "./menu";
import { menuUiHandler } from "./menu-ui-handler";
import { move } from "./move";
import { nature } from "./nature";
import { pokeball } from "./pokeball";
import { pokemon } from "./pokemon";
import { pokemonStat } from "./pokemon-stat";
@ -29,4 +31,6 @@ export const itConfig = {
trainerClasses: trainerClasses,
trainerNames: trainerNames,
tutorial: tutorial
}
nature: nature,
growth: growth
}

10
src/locales/it/growth.ts Normal file
View File

@ -0,0 +1,10 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const growth: SimpleTranslationEntries = {
"Erratic": "Erratic",
"Fast": "Fast",
"Medium_Fast": "Medium Fast",
"Medium_Slow": "Medium Slow",
"Slow": "Slow",
"Fluctuating": "Fluctuating"
} as const;

29
src/locales/it/nature.ts Normal file
View File

@ -0,0 +1,29 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const nature: SimpleTranslationEntries = {
"Hardy": "Hardy",
"Lonely": "Lonely",
"Brave": "Brave",
"Adamant": "Adamant",
"Naughty": "Naughty",
"Bold": "Bold",
"Docile": "Docile",
"Relaxed": "Relaxed",
"Impish": "Impish",
"Lax": "Lax",
"Timid": "Timid",
"Hasty": "Hasty",
"Serious": "Serious",
"Jolly": "Jolly",
"Naive": "Naive",
"Modest": "Modest",
"Mild": "Mild",
"Quiet": "Quiet",
"Bashful": "Bashful",
"Rash": "Rash",
"Calm": "Calm",
"Gentle": "Gentle",
"Sassy": "Sassy",
"Careful": "Careful",
"Quirky": "Quirky"
} as const;

View File

@ -11,6 +11,7 @@ import { pokemonStat } from "./pokemon-stat";
import { starterSelectUiHandler } from "./starter-select-ui-handler";
import { tutorial } from "./tutorial";
import { titles,trainerClasses,trainerNames } from "./trainers";
import { nature } from "./nature";
export const zhCnConfig = {
@ -25,8 +26,9 @@ export const zhCnConfig = {
pokemonStat: pokemonStat,
pokemon: pokemon,
starterSelectUiHandler: starterSelectUiHandler,
nature: nature
titles: titles,
trainerClasses: trainerClasses,
trainerNames: trainerNames,
tutorial: tutorial
}
}

View File

@ -0,0 +1,29 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const nature: SimpleTranslationEntries = {
"Hardy": "Hardy",
"Lonely": "Lonely",
"Brave": "Brave",
"Adamant": "Adamant",
"Naughty": "Naughty",
"Bold": "Bold",
"Docile": "Docile",
"Relaxed": "Relaxed",
"Impish": "Impish",
"Lax": "Lax",
"Timid": "Timid",
"Hasty": "Hasty",
"Serious": "Serious",
"Jolly": "Jolly",
"Naive": "Naive",
"Modest": "Modest",
"Mild": "Mild",
"Quiet": "Quiet",
"Bashful": "Bashful",
"Rash": "Rash",
"Calm": "Calm",
"Gentle": "Gentle",
"Sassy": "Sassy",
"Careful": "Careful",
"Quirky": "Quirky"
} as const;

View File

@ -112,6 +112,8 @@ declare module 'i18next' {
trainerNames: SimpleTranslationEntries;
tutorial: SimpleTranslationEntries;
starterSelectUiHandler: SimpleTranslationEntries;
nature: SimpleTranslationEntries;
growth: SimpleTranslationEntries;
};
}
}

View File

@ -754,7 +754,7 @@ export class GameData {
tryClearSession(scene: BattleScene, slotId: integer): Promise<[success: boolean, newClear: boolean]> {
return new Promise<[boolean, boolean]>(resolve => {
if (bypassLogin) {
localStorage.removeItem('sessionData');
localStorage.removeItem(`sessionData${slotId ? slotId : ''}`);
return resolve([true, true]);
}

View File

@ -1294,7 +1294,14 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.pokemonLuckText.setTint(getVariantTint(Math.min(luck - 1, 2) as Variant));
this.pokemonLuckLabelText.setVisible(this.pokemonLuckText.visible);
this.pokemonGrowthRateText.setText(Utils.toReadableString(GrowthRate[species.growthRate]));
//Growth translate
let growthReadable = Utils.toReadableString(GrowthRate[species.growthRate]);
let growthAux = growthReadable.replace(" ", "_")
if(i18next.exists("growth:" + growthAux)){
growthReadable = i18next.t("growth:"+ growthAux as any)
}
this.pokemonGrowthRateText.setText(growthReadable);
this.pokemonGrowthRateText.setColor(getGrowthRateColor(species.growthRate));
this.pokemonGrowthRateText.setShadowColor(getGrowthRateColor(species.growthRate, true));
this.pokemonGrowthRateLabelText.setVisible(true);