This commit is contained in:
25
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/SandStream.cs
Normal file
25
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/SandStream.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Sand Stream is an ability that creates a sandstorm when the Pokémon enters battle.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Sand_Stream_(Ability)">Bulbapedia - Sand Stream</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "sand_stream")]
|
||||
public class SandStream : 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.Sandstorm>())
|
||||
return;
|
||||
|
||||
EventBatchId batchId = new();
|
||||
battleData.Battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon));
|
||||
battleData.Battle.SetWeather(ScriptUtils.ResolveName<Weather.Sandstorm>(), 5, batchId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user