namespace PkmnLib.Plugin.Gen7.Scripts.Abilities; /// /// Volt Absorb is an ability that heals the Pokémon when hit by an Electric-type move. /// /// Bulbapedia - Volt Absorb /// [Script(ScriptCategory.Ability, "volt_absorb")] public class VoltAbsorb : Script, IScriptIsInvulnerableToMove { /// public void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable) { if (move.GetHitData(target, 0).Type?.Name != "electric") return; invulnerable = true; target.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(target)); target.Heal(target.MaxHealth / 4); } }