diff --git a/src/data/ability.ts b/src/data/ability.ts index c44357cc3c6..c236aa85805 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -2282,6 +2282,34 @@ export class PostTurnFormChangeAbAttr extends PostTurnAbAttr { } } + +/** + * Attribute used for abilities (Bad Dreams) that damages the opponents for being asleep + */ +export class PostTurnHurtIfSleepingAbAttr extends PostTurnAbAttr { + + /** + * Deals damage to all sleeping opponents equal to 1/8 of their max hp (min 1) + * @param {Pokemon} pokemon Pokemon that has this ability + * @param {boolean} passive N/A + * @param {any[]} args N/A + * @returns {boolean} true if any opponents are sleeping + */ + applyPostTurn(pokemon: Pokemon, passive: boolean, args: any[]): boolean | Promise { + let hadEffect: boolean = false; + for(let opp of pokemon.getOpponents()) { + if(opp.status !== undefined && opp.status.effect === StatusEffect.SLEEP) { + opp.damageAndUpdate(Math.floor(Math.max(1, opp.getMaxHp() / 8)), HitResult.OTHER); + pokemon.scene.queueMessage(i18next.t('abilityTriggers:badDreams', {pokemonName: `${getPokemonPrefix(opp)}${opp.name}`})); + hadEffect = true; + } + + } + return hadEffect; + } +} + + /** * Grabs the last failed Pokeball used * @extends PostTurnAbAttr @@ -3327,7 +3355,7 @@ export function initAbilities() { .ignorable() .partial(), new Ability(Abilities.BAD_DREAMS, 4) - .unimplemented(), + .attr(PostTurnHurtIfSleepingAbAttr), new Ability(Abilities.PICKPOCKET, 5) .attr(PostDefendStealHeldItemAbAttr, (target, user, move) => move.hasFlag(MoveFlags.MAKES_CONTACT)), new Ability(Abilities.SHEER_FORCE, 5) diff --git a/src/locales/de/ability-trigger.ts b/src/locales/de/ability-trigger.ts index 27d2053b621..7ba2b7af7f5 100644 --- a/src/locales/de/ability-trigger.ts +++ b/src/locales/de/ability-trigger.ts @@ -2,4 +2,5 @@ import { SimpleTranslationEntries } from "#app/plugins/i18n"; export const abilityTriggers: SimpleTranslationEntries = { 'blockRecoilDamage' : `{{pokemonName}} wurde durch {{abilityName}}\nvor Rückstoß geschützt!`, + 'badDreams': `{{pokemonName}} wird gequält!`, } as const; diff --git a/src/locales/en/ability-trigger.ts b/src/locales/en/ability-trigger.ts index 88900741218..49505217126 100644 --- a/src/locales/en/ability-trigger.ts +++ b/src/locales/en/ability-trigger.ts @@ -2,4 +2,5 @@ import { SimpleTranslationEntries } from "#app/plugins/i18n"; export const abilityTriggers: SimpleTranslationEntries = { 'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`, + 'badDreams': `{{pokemonName}} is tormented!`, } as const; \ No newline at end of file diff --git a/src/locales/es/ability-trigger.ts b/src/locales/es/ability-trigger.ts index 88900741218..cd6def4c628 100644 --- a/src/locales/es/ability-trigger.ts +++ b/src/locales/es/ability-trigger.ts @@ -2,4 +2,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 + 'badDreams': `{{pokemonName}} Está atormentado!` +} as const; diff --git a/src/locales/fr/ability-trigger.ts b/src/locales/fr/ability-trigger.ts index f668ee5e8ab..d74acb31b4f 100644 --- a/src/locales/fr/ability-trigger.ts +++ b/src/locales/fr/ability-trigger.ts @@ -2,4 +2,5 @@ import { SimpleTranslationEntries } from "#app/plugins/i18n"; export const abilityTriggers: SimpleTranslationEntries = { 'blockRecoilDamage' : `{{abilityName}}\nde {{pokemonName}} le protège du contrecoup !`, + 'badDreams': `{{pokemonName}} est tourmenté!` } as const; diff --git a/src/locales/it/ability-trigger.ts b/src/locales/it/ability-trigger.ts index de41e087236..3f7d09c9221 100644 --- a/src/locales/it/ability-trigger.ts +++ b/src/locales/it/ability-trigger.ts @@ -2,4 +2,5 @@ import { SimpleTranslationEntries } from "#app/plugins/i18n"; export const abilityTriggers: SimpleTranslationEntries = { 'blockRecoilDamage' : `{{abilityName}} di {{pokemonName}}\nl'ha protetto dal contraccolpo!`, + 'badDreams': `{{pokemonName}} è tormentato!`, } as const; \ No newline at end of file diff --git a/src/locales/zh_CN/ability-trigger.ts b/src/locales/zh_CN/ability-trigger.ts index 85152b1bccc..d40fad7a10a 100644 --- a/src/locales/zh_CN/ability-trigger.ts +++ b/src/locales/zh_CN/ability-trigger.ts @@ -2,4 +2,5 @@ import { SimpleTranslationEntries } from "#app/plugins/i18n"; export const abilityTriggers: SimpleTranslationEntries = { 'blockRecoilDamage' : `{{pokemonName}} 的 {{abilityName}}\n抵消了反作用力!`, + 'badDreams': `{{pokemonName}} 被折磨着!` } as const; \ No newline at end of file