Implemented changes suggested by @bennybroseph and @TempsRay
parent
036755ca1b
commit
1b2e39d0d2
|
@ -2110,13 +2110,18 @@ export class PostTurnHurtIfSleepingAbAttr extends PostTurnAbAttr {
|
||||||
|
|
||||||
applyPostTurn(pokemon: Pokemon, passive: boolean, args: any[]): boolean | Promise<boolean> {
|
applyPostTurn(pokemon: Pokemon, passive: boolean, args: any[]): boolean | Promise<boolean> {
|
||||||
let hadEffect: boolean = false;
|
let hadEffect: boolean = false;
|
||||||
for(let oppo of pokemon.getOpponents()) {
|
//cycle on each opponent
|
||||||
if(oppo.status !== undefined && oppo.status.effect == StatusEffect.SLEEP) {
|
for(let opp of pokemon.getOpponents()) {
|
||||||
oppo.damageAndUpdate(Math.ceil(oppo.getMaxHp() * (1 / 8)), HitResult.OTHER);
|
//check if anyone of them is sleeping
|
||||||
pokemon.scene.queueMessage(getPokemonMessage(oppo, ' is tormented!'));
|
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;
|
hadEffect = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//returns true only if one of the opponents were sleeping
|
||||||
return hadEffect;
|
return hadEffect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue