This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user