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

28 lines
958 B
C#

namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Psychic Surge is an ability that creates Psychic Terrain when the Pokémon enters battle.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Psychic_Surge_(Ability)">Bulbapedia - Psychic Surge</see>
/// </summary>
[Script(ScriptCategory.Ability, "psychic_surge")]
public class PsychicSurge : Script
{
/// <inheritdoc />
public override void OnSwitchIn(IPokemon pokemon, byte position)
{
if (pokemon.BattleData?.Battle is null)
return;
var terrainName = ScriptUtils.ResolveName<Terrain.PsychicTerrain>();
if (pokemon.BattleData.Battle.TerrainName == terrainName)
return;
EventBatchId batchId = new();
pokemon.BattleData.Battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon)
{
BatchId = batchId,
});
pokemon.BattleData.Battle.SetTerrain(terrainName, batchId);
}
}