[Bug] Magic Guard-Ability Interactions (#3227)
* Liquid Ooze * Added checks for the last of the abilities * Updated some abilities * Reverted old message --------- Co-authored-by: Frutescens <info@laptop>
This commit is contained in:
parent
4b448d371f
commit
22cfa48103
|
@ -2862,6 +2862,9 @@ export class PostWeatherLapseDamageAbAttr extends PostWeatherLapseAbAttr {
|
|||
|
||||
applyPostWeatherLapse(pokemon: Pokemon, passive: boolean, weather: Weather, args: any[]): boolean {
|
||||
const scene = pokemon.scene;
|
||||
if (pokemon.hasAbilityWithAttr(BlockNonDirectDamageAbAttr)) {
|
||||
return false;
|
||||
}
|
||||
const abilityName = (!passive ? pokemon.getAbility() : pokemon.getPassiveAbility()).name;
|
||||
scene.queueMessage(i18next.t("abilityTriggers:postWeatherLapseDamage", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName }));
|
||||
pokemon.damageAndUpdate(Math.ceil(pokemon.getMaxHp() / (16 / this.damageFactor)), HitResult.OTHER);
|
||||
|
@ -3139,7 +3142,7 @@ export class PostTurnHurtIfSleepingAbAttr extends PostTurnAbAttr {
|
|||
applyPostTurn(pokemon: Pokemon, passive: boolean, args: any[]): boolean | Promise<boolean> {
|
||||
let hadEffect: boolean = false;
|
||||
for (const opp of pokemon.getOpponents()) {
|
||||
if (opp.status?.effect === StatusEffect.SLEEP || opp.hasAbility(Abilities.COMATOSE)) {
|
||||
if ((opp.status?.effect === StatusEffect.SLEEP || opp.hasAbility(Abilities.COMATOSE)) && !opp.hasAbilityWithAttr(BlockNonDirectDamageAbAttr)) {
|
||||
opp.damageAndUpdate(Math.floor(Math.max(1, opp.getMaxHp() / 8)), HitResult.OTHER);
|
||||
pokemon.scene.queueMessage(i18next.t("abilityTriggers:badDreams", {pokemonName: getPokemonNameWithAffix(opp)}));
|
||||
hadEffect = true;
|
||||
|
@ -3528,7 +3531,7 @@ export class PostFaintContactDamageAbAttr extends PostFaintAbAttr {
|
|||
if (move.checkFlag(MoveFlags.MAKES_CONTACT, attacker, pokemon)) {
|
||||
const cancelled = new Utils.BooleanHolder(false);
|
||||
pokemon.scene.getField(true).map(p=>applyAbAttrs(FieldPreventExplosiveMovesAbAttr, p, cancelled));
|
||||
if (cancelled.value) {
|
||||
if (cancelled.value || attacker.hasAbilityWithAttr(BlockNonDirectDamageAbAttr)) {
|
||||
return false;
|
||||
}
|
||||
attacker.damageAndUpdate(Math.ceil(attacker.getMaxHp() * (1 / this.damageRatio)), HitResult.OTHER);
|
||||
|
|
|
@ -1638,9 +1638,14 @@ export class HitHealAttr extends MoveEffectAttr {
|
|||
message = i18next.t("battle:regainHealth", {pokemonName: getPokemonNameWithAffix(user)});
|
||||
}
|
||||
if (reverseDrain) {
|
||||
user.turnData.damageTaken += healAmount;
|
||||
healAmount = healAmount * -1;
|
||||
message = null;
|
||||
if (user.hasAbilityWithAttr(BlockNonDirectDamageAbAttr)) {
|
||||
healAmount = 0;
|
||||
message = null;
|
||||
} else {
|
||||
user.turnData.damageTaken += healAmount;
|
||||
healAmount = healAmount * -1;
|
||||
message = null;
|
||||
}
|
||||
}
|
||||
user.scene.unshiftPhase(new PokemonHealPhase(user.scene, user.getBattlerIndex(), healAmount, message, false, true));
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue