diff --git a/src/data/move.ts b/src/data/move.ts index f3b1c4dcc..36254320f 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -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), diff --git a/src/data/nature.ts b/src/data/nature.ts index b18ce5abd..a8b361674 100644 --- a/src/data/nature.ts +++ b/src/data/nature.ts @@ -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; diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index e11a05032..b2ecd4de3 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -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; diff --git a/src/locales/de/config.ts b/src/locales/de/config.ts index 216066cf4..f6481ab12 100644 --- a/src/locales/de/config.ts +++ b/src/locales/de/config.ts @@ -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 -} \ No newline at end of file + nature: nature, + growth: growth +} diff --git a/src/locales/de/growth.ts b/src/locales/de/growth.ts new file mode 100644 index 000000000..a0d1cb5ee --- /dev/null +++ b/src/locales/de/growth.ts @@ -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; \ No newline at end of file diff --git a/src/locales/de/nature.ts b/src/locales/de/nature.ts new file mode 100644 index 000000000..b6e3d05b8 --- /dev/null +++ b/src/locales/de/nature.ts @@ -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; \ No newline at end of file diff --git a/src/locales/en/config.ts b/src/locales/en/config.ts index 041533fa6..54b5d6599 100644 --- a/src/locales/en/config.ts +++ b/src/locales/en/config.ts @@ -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 -} \ No newline at end of file + nature: nature, + growth: growth +} diff --git a/src/locales/en/growth.ts b/src/locales/en/growth.ts new file mode 100644 index 000000000..a0d1cb5ee --- /dev/null +++ b/src/locales/en/growth.ts @@ -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; \ No newline at end of file diff --git a/src/locales/en/nature.ts b/src/locales/en/nature.ts new file mode 100644 index 000000000..f29917ff6 --- /dev/null +++ b/src/locales/en/nature.ts @@ -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; \ No newline at end of file diff --git a/src/locales/es/config.ts b/src/locales/es/config.ts index 93f6cc4f2..612704132 100644 --- a/src/locales/es/config.ts +++ b/src/locales/es/config.ts @@ -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 -} \ No newline at end of file + nature: nature, + growth: growth +} diff --git a/src/locales/es/growth.ts b/src/locales/es/growth.ts new file mode 100644 index 000000000..d89f5c16b --- /dev/null +++ b/src/locales/es/growth.ts @@ -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; \ No newline at end of file diff --git a/src/locales/es/nature.ts b/src/locales/es/nature.ts new file mode 100644 index 000000000..74f9c017a --- /dev/null +++ b/src/locales/es/nature.ts @@ -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; \ No newline at end of file diff --git a/src/locales/fr/config.ts b/src/locales/fr/config.ts index 5378fb0a3..fba5b10d4 100644 --- a/src/locales/fr/config.ts +++ b/src/locales/fr/config.ts @@ -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 -} \ No newline at end of file + nature: nature, + growth: growth +} diff --git a/src/locales/fr/growth.ts b/src/locales/fr/growth.ts new file mode 100644 index 000000000..a0d1cb5ee --- /dev/null +++ b/src/locales/fr/growth.ts @@ -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; \ No newline at end of file diff --git a/src/locales/fr/nature.ts b/src/locales/fr/nature.ts new file mode 100644 index 000000000..0c838138b --- /dev/null +++ b/src/locales/fr/nature.ts @@ -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; diff --git a/src/locales/it/config.ts b/src/locales/it/config.ts index a2ee2a899..6bb2ea037 100644 --- a/src/locales/it/config.ts +++ b/src/locales/it/config.ts @@ -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 -} \ No newline at end of file + nature: nature, + growth: growth +} diff --git a/src/locales/it/growth.ts b/src/locales/it/growth.ts new file mode 100644 index 000000000..a0d1cb5ee --- /dev/null +++ b/src/locales/it/growth.ts @@ -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; \ No newline at end of file diff --git a/src/locales/it/nature.ts b/src/locales/it/nature.ts new file mode 100644 index 000000000..f29917ff6 --- /dev/null +++ b/src/locales/it/nature.ts @@ -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; \ No newline at end of file diff --git a/src/locales/zh_CN/config.ts b/src/locales/zh_CN/config.ts index 989e7aee0..c0d824a24 100644 --- a/src/locales/zh_CN/config.ts +++ b/src/locales/zh_CN/config.ts @@ -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 -} \ No newline at end of file +} diff --git a/src/locales/zh_CN/nature.ts b/src/locales/zh_CN/nature.ts new file mode 100644 index 000000000..f29917ff6 --- /dev/null +++ b/src/locales/zh_CN/nature.ts @@ -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; \ No newline at end of file diff --git a/src/plugins/i18n.ts b/src/plugins/i18n.ts index 831dc3dca..87c602596 100644 --- a/src/plugins/i18n.ts +++ b/src/plugins/i18n.ts @@ -112,6 +112,8 @@ declare module 'i18next' { trainerNames: SimpleTranslationEntries; tutorial: SimpleTranslationEntries; starterSelectUiHandler: SimpleTranslationEntries; + nature: SimpleTranslationEntries; + growth: SimpleTranslationEntries; }; } } diff --git a/src/system/game-data.ts b/src/system/game-data.ts index bd1fcfae0..a213a3549 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -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]); } diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index 514bb173a..b341cf947 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -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);