namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
///
/// Magma Armor is an ability that prevents the Pokémon from being frozen.
///
/// Bulbapedia - Magma Armor
///
[Script(ScriptCategory.Ability, "magma_armor")]
public class MagmaArmor : Script, IScriptOnSwitchIn, IScriptPreventStatusChange
{
///
public void PreventStatusChange(IPokemon pokemon, StringKey status, bool selfInflicted, ref bool preventStatus)
{
if (status == ScriptUtils.ResolveName())
{
pokemon.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon));
preventStatus = true;
}
}
///
public void OnSwitchIn(IPokemon pokemon, byte position)
{
if (pokemon.HasStatus(ScriptUtils.ResolveName()))
{
pokemon.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon));
pokemon.ClearStatus();
}
}
}