More abilities, refactor custom triggers to be typed.
All checks were successful
Build / Build (push) Successful in 48s
All checks were successful
Build / Build (push) Successful in 48s
This commit is contained in:
31
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/MagmaArmor.cs
Normal file
31
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/MagmaArmor.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Magma Armor is an ability that prevents the Pokémon from being frozen.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Magma_Armor_(Ability)">Bulbapedia - Magma Armor</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "magma_armor")]
|
||||
public class MagmaArmor : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void PreventStatusChange(IPokemon pokemon, StringKey status, bool selfInflicted,
|
||||
ref bool preventStatus)
|
||||
{
|
||||
if (status == ScriptUtils.ResolveName<Status.Frozen>())
|
||||
{
|
||||
pokemon.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon));
|
||||
preventStatus = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
{
|
||||
if (pokemon.HasStatus(ScriptUtils.ResolveName<Status.Frozen>()))
|
||||
{
|
||||
pokemon.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon));
|
||||
pokemon.ClearStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user