20 lines
749 B
C#
20 lines
749 B
C#
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|
|
|
/// <summary>
|
|
/// Volt Absorb is an ability that heals the Pokémon when hit by an Electric-type move.
|
|
///
|
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Volt_Absorb_(Ability)">Bulbapedia - Volt Absorb</see>
|
|
/// </summary>
|
|
[Script(ScriptCategory.Ability, "volt_absorb")]
|
|
public class VoltAbsorb : Script
|
|
{
|
|
/// <inheritdoc />
|
|
public override 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);
|
|
}
|
|
} |