PkmnLib.NET/Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Defog.cs

32 lines
808 B
C#
Raw Normal View History

2025-02-01 14:00:22 +00:00
using System.Collections.Generic;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "defog")]
public class Defog : Script
{
public static HashSet<StringKey> DefoggedEffects = new()
{
"mist",
"light_screen",
"reflect",
"safe_guard",
"spikes",
"toxic_spikes",
"stealth_rock",
};
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
if (target.BattleData == null)
return;
var targetSide = target.BattleData.Battle.Sides[target.BattleData.SideIndex];
foreach (var effect in DefoggedEffects)
{
targetSide.VolatileScripts.Remove(effect);
}
}
}