mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-26 00:36:25 +00:00
Implements bad dreams (#633)
* test commit * de modified readme * first implementation, needs testing with healer * fixed beahviour if 2+ opponents are on field, also added message * further fixed * reset of overrides.ts before merge to main * fixed grammar Co-authored-by: Jonas Pinson <jonas.pinson@gmail.com> * Implemented changes suggested by @bennybroseph and @TempsRay * Added more docs to the class * removed old comments * fixed ability name in comments * added translation and made message localized * fixed ability name * added missing bracket --------- Co-authored-by: Jonas Pinson <jonas.pinson@gmail.com>
This commit is contained in:
parent
6016ecfb46
commit
42e2be22bc
@ -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<boolean> {
|
||||
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)
|
||||
|
@ -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;
|
||||
|
@ -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;
|
@ -2,4 +2,5 @@ import { SimpleTranslationEntries } from "#app/plugins/i18n";
|
||||
|
||||
export const abilityTriggers: SimpleTranslationEntries = {
|
||||
'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`,
|
||||
} as const;
|
||||
'badDreams': `{{pokemonName}} Está atormentado!`
|
||||
} as const;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
@ -2,4 +2,5 @@ import { SimpleTranslationEntries } from "#app/plugins/i18n";
|
||||
|
||||
export const abilityTriggers: SimpleTranslationEntries = {
|
||||
'blockRecoilDamage' : `{{pokemonName}} 的 {{abilityName}}\n抵消了反作用力!`,
|
||||
'badDreams': `{{pokemonName}} 被折磨着!`
|
||||
} as const;
|
Loading…
Reference in New Issue
Block a user