More abilities
This commit is contained in:
24
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Regenerator.cs
Normal file
24
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Regenerator.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Regenerator is an ability that restores a little HP when the Pokémon switches out.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Regenerator_(Ability)">Bulbapedia - Regenerator</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "regenerator")]
|
||||
public class Regenerator : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchOut(IPokemon oldPokemon, byte position)
|
||||
{
|
||||
if (!oldPokemon.IsUsable)
|
||||
return;
|
||||
|
||||
EventBatchId batchId = new();
|
||||
oldPokemon.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(oldPokemon)
|
||||
{
|
||||
BatchId = batchId,
|
||||
});
|
||||
oldPokemon.Heal(oldPokemon.MaxHealth / 3, batchId: batchId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user