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