v18 How do I add an Ability like Heatproof that also shows the Splash?

This thread pertains to v18 of Pokémon Essentials.

Onigiri

Rookie
Member
Joined
Mar 7, 2021
Posts
2
Age
26
I want to make an Ability like Filter or Heatproof that halves damage from two specific types (Ice and Bug).
This is what I came up with (I'm very new to scripting) by using Heatproof as a reference:

Ruby:
BattleHandlers::DamageCalcTargetAbility.add(:ALTITUDE,
  proc { |ability,user,target,move,mults,baseDmg,type|
    mults[BASE_DMG_MULT] /= 2 if isConst?(type,PBTypes,:ICE) || isConst?(type,PBTypes,:BUG)
  }
)

This gives me no error but I'm not sure if it actually works because from the battle testing I made it was kind of hard to tell.
Besides, I'd like for the Ability Splash to appear when this ability is triggered but I can't seem to understand how to accomplish that, I keep getting Syntax errors any time I try to copy-paste the SHOW_ABILITY_SPLASH commands from other scripts so I have no idea what I'm supposed to do.
I'm working on Essentials 18.1 without the Elite Battle System.
 

WolfPP

Discord Wolf#1235
Member
Joined
Aug 24, 2018
Posts
129
Age
29
Did you just try to insert the code for splash inside it? Like:
Code:
BattleHandlers::DamageCalcTargetAbility.add(:ALTITUDE,
  proc { |ability,user,target,move,mults,baseDmg,type|
    if isConst?(type,PBTypes,:ICE) || isConst?(type,PBTypes,:BUG)
      pbShowAbilitySplash(target)
      mults[BASE_DMG_MULT] /= 2
      pbHideAbilitySplash(target)
    end
  }
)

If it didn't work, so you also have to add a new code by finding the correct 'BattleHandlers' to put it, like 'TargetAbilityOnHit':
Code:
BattleHandlers::TargetAbilityOnHit.add(:ALTITUDE,,
  proc { |ability,user,target,move,battle|
    next if !(isConst?(move.type,PBTypes,:ICE) || isConst?(move.type,PBTypes,:BUG))
    battle.pbShowAbilitySplash(target,true) # delay = true
    battle.pbHideAbilitySplash(target)
  }
)

Good luck!
 
Top