namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
///
/// Regenerator is an ability that restores a little HP when the Pokémon switches out.
///
/// Bulbapedia - Regenerator
///
[Script(ScriptCategory.Ability, "regenerator")]
public class Regenerator : Script
{
///
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);
}
}