Merge aaa0a2bb02
into 2778eb2651
commit
4a8cda7369
|
@ -2246,6 +2246,33 @@ 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(getPokemonMessage(opp, ' is tormented!'));
|
||||
hadEffect = true;
|
||||
}
|
||||
|
||||
}
|
||||
return hadEffect;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export class PostBiomeChangeAbAttr extends AbAttr { }
|
||||
|
||||
export class PostBiomeChangeWeatherChangeAbAttr extends PostBiomeChangeAbAttr {
|
||||
|
@ -3241,7 +3268,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)
|
||||
|
|
Loading…
Reference in New Issue