mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 17:12:44 +02:00
Move checks to canApply
This commit is contained in:
parent
151c308d63
commit
458faf90eb
@ -1176,23 +1176,37 @@ export class ReverseDrainAbAttr extends PostDefendAbAttr {
|
|||||||
override canApplyPostDefend(
|
override canApplyPostDefend(
|
||||||
_pokemon: Pokemon,
|
_pokemon: Pokemon,
|
||||||
_passive: boolean,
|
_passive: boolean,
|
||||||
_simulated: boolean,
|
simulated: boolean,
|
||||||
_attacker: Pokemon,
|
attacker: Pokemon,
|
||||||
move: Move,
|
move: Move,
|
||||||
_hitResult: HitResult | null,
|
_hitResult: HitResult | null,
|
||||||
_args: any[],
|
_args: any[],
|
||||||
): boolean {
|
): boolean {
|
||||||
return move.hasAttr("HitHealAttr");
|
const cancelled = new BooleanHolder(false);
|
||||||
|
applyAbAttrs("BlockNonDirectDamageAbAttr", attacker, cancelled, simulated);
|
||||||
|
this.attacker = attacker;
|
||||||
|
return !cancelled.value && move.hasAttr("HitHealAttr");
|
||||||
}
|
}
|
||||||
|
|
||||||
override applyPostDefend(pokemon: Pokemon, _passive: boolean, _simulated: boolean, attacker: Pokemon, move: Move, _hitResult: HitResult | null, _args: any[]): void {
|
override applyPostDefend(
|
||||||
const cancelled = new BooleanHolder(false);
|
pokemon: Pokemon,
|
||||||
applyAbAttrs("BlockNonDirectDamageAbAttr", attacker, cancelled);
|
_passive: boolean,
|
||||||
if (!cancelled.value) {
|
_simulated: boolean,
|
||||||
|
attacker: Pokemon,
|
||||||
|
move: Move,
|
||||||
|
_hitResult: HitResult | null,
|
||||||
|
_args: any[],
|
||||||
|
): void {
|
||||||
const damageAmount = move.getAttrs<"HitHealAttr">("HitHealAttr")[0].getHealAmount(attacker, pokemon);
|
const damageAmount = move.getAttrs<"HitHealAttr">("HitHealAttr")[0].getHealAmount(attacker, pokemon);
|
||||||
pokemon.turnData.damageTaken += damageAmount;
|
pokemon.turnData.damageTaken += damageAmount;
|
||||||
globalScene.phaseManager.unshiftNew("PokemonHealPhase", attacker.getBattlerIndex(), -damageAmount, null, false, true);
|
globalScene.phaseManager.unshiftNew(
|
||||||
}
|
"PokemonHealPhase",
|
||||||
|
attacker.getBattlerIndex(),
|
||||||
|
-damageAmount,
|
||||||
|
null,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override getTriggerMessage(_pokemon: Pokemon, _abilityName: string, ..._args: any[]): string | null {
|
public override getTriggerMessage(_pokemon: Pokemon, _abilityName: string, ..._args: any[]): string | null {
|
||||||
|
Loading…
Reference in New Issue
Block a user