Files
PkmnLib.NET/Plugins/PkmnLib.Plugin.Gen7/Scripts/Side/AromaVeilEffect.cs

32 lines
1008 B
C#

using PkmnLib.Static.Moves;
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
[Script(ScriptCategory.Side, "aroma_veil")]
public class AromaVeilEffect : Script, IScriptFailIncomingMove, IScriptPreventIncomingSecondaryEffect
{
private HashSet<IBattlePokemon> _placers = new();
public void PlacerActivated(IBattlePokemon placer) => _placers.Add(placer);
public void PlacerDeactivated(IBattlePokemon placer)
{
_placers.Remove(placer);
if (_placers.Count == 0)
RemoveSelf();
}
/// <inheritdoc />
public void FailIncomingMove(IExecutingMove move, IBattlePokemon target, ref bool fail)
{
if (move.UseMove.HasFlag(MoveFlags.Mental) && move.UseMove.Category == MoveCategory.Status)
fail = true;
}
/// <inheritdoc />
public void PreventIncomingSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit, ref bool prevent)
{
if (move.UseMove.HasFlag(MoveFlags.Mental))
prevent = true;
}
}