28 lines
968 B
C#
28 lines
968 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, IScriptOnSwitchIn
|
|
{
|
|
/// <inheritdoc />
|
|
public 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);
|
|
}
|
|
} |