More abilities
This commit is contained in:
20
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/VoltAbsorb.cs
Normal file
20
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/VoltAbsorb.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user