27 lines
941 B
C#

namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Drizzle is an ability that creates rain when the Pokémon enters battle.
/// This rain boosts Water-type moves and weakens Fire-type moves.
/// This ability is commonly associated with Kyogre and Politoed.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Drizzle_(Ability)">Bulbapedia - Drizzle</see>
/// </summary>
[Script(ScriptCategory.Ability, "drizzle")]
public class Drizzle : Script, IScriptOnSwitchIn
{
/// <inheritdoc />
public void OnSwitchIn(IPokemon pokemon, byte position)
{
var battleData = pokemon.BattleData;
if (battleData == null)
return;
EventBatchId batchId = new();
battleData.Battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon)
{
BatchId = batchId,
});
battleData.Battle.SetWeather(ScriptUtils.ResolveName<Weather.Rain>(), 5, batchId);
}
}