25 lines
848 B
C#
25 lines
848 B
C#
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|
|
|
/// <summary>
|
|
/// Grassy Surge is an ability that creates Grassy Terrain when the Pokémon enters battle.
|
|
///
|
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Grassy_Surge_(Ability)">Bulbapedia - Grassy Surge</see>
|
|
/// </summary>
|
|
[Script(ScriptCategory.Ability, "grassy_surge")]
|
|
public class GrassySurge : 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.SetTerrain(ScriptUtils.ResolveName<Terrain.GrassyTerrain>(), batchId);
|
|
}
|
|
} |