Deukhoofd 1b9d137bb0
All checks were successful
Build / Build (push) Successful in 50s
Surprisingly, more abilities
2025-06-14 13:37:58 +02:00

25 lines
878 B
C#

namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Snow Warning is an ability that creates hail when the Pokémon enters battle.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Snow_Warning_(Ability)">Bulbapedia - Snow Warning</see>
/// </summary>
[Script(ScriptCategory.Ability, "snow_warning")]
public class SnowWarning : Script
{
/// <inheritdoc />
public override void OnSwitchIn(IPokemon pokemon, byte position)
{
var battleData = pokemon.BattleData;
if (battleData == null)
return;
if (battleData.Battle.WeatherName == ScriptUtils.ResolveName<Weather.Hail>())
return;
EventBatchId batchId = new();
battleData.Battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon));
battleData.Battle.SetWeather(ScriptUtils.ResolveName<Weather.Hail>(), 5, batchId);
}
}