Deukhoofd 6c13d20bf7
All checks were successful
Build / Build (push) Successful in 52s
Even more abilities
2025-06-14 11:30:56 +02:00

25 lines
977 B
C#

namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Primordial Sea is an ability that creates heavy rain when the Pokémon enters battle and prevents Fire-type moves from being used.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Primordial_Sea_(Ability)">Bulbapedia - Primordial Sea</see>
/// </summary>
[Script(ScriptCategory.Ability, "primordial_sea")]
public class PrimordialSeaAbility : Script
{
/// <inheritdoc />
public override void OnSwitchIn(IPokemon pokemon, byte position)
{
var battle = pokemon.BattleData?.Battle;
if (battle == null)
return;
battle.SetWeather(ScriptUtils.ResolveName<Weather.PrimordialSea>(), -1);
if (battle.WeatherName == ScriptUtils.ResolveName<Weather.PrimordialSea>())
{
((Weather.PrimordialSea)battle.WeatherScript.Script!).MarkAsPlaced(pokemon);
battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon));
}
}
}