From 1b2e39d0d265233ed406dc7ab3ab73e5fcb5e90b Mon Sep 17 00:00:00 2001 From: Sbug98 Date: Mon, 13 May 2024 10:10:50 +0200 Subject: [PATCH] Implemented changes suggested by @bennybroseph and @TempsRay --- src/data/ability.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index 4c98467c1..bea660b93 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -2110,13 +2110,18 @@ export class PostTurnHurtIfSleepingAbAttr extends PostTurnAbAttr { applyPostTurn(pokemon: Pokemon, passive: boolean, args: any[]): boolean | Promise { let hadEffect: boolean = false; - for(let oppo of pokemon.getOpponents()) { - if(oppo.status !== undefined && oppo.status.effect == StatusEffect.SLEEP) { - oppo.damageAndUpdate(Math.ceil(oppo.getMaxHp() * (1 / 8)), HitResult.OTHER); - pokemon.scene.queueMessage(getPokemonMessage(oppo, ' is tormented!')); + //cycle on each opponent + for(let opp of pokemon.getOpponents()) { + //check if anyone of them is sleeping + if(opp.status !== undefined && opp.status.effect === StatusEffect.SLEEP) { + //if so, deal a min of 1 damage and queue a message + opp.damageAndUpdate(Math.floor(Math.max(1, opp.getMaxHp() / 8)), HitResult.OTHER); + pokemon.scene.queueMessage(getPokemonMessage(opp, ' is tormented!')); hadEffect = true; } + } + //returns true only if one of the opponents were sleeping return hadEffect; }