32 lines
962 B
C#
32 lines
962 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<IPokemon> _placers = new();
|
|
|
|
public void PlacerActivated(IPokemon placer) => _placers.Add(placer);
|
|
|
|
public void PlacerDeactivated(IPokemon placer)
|
|
{
|
|
_placers.Remove(placer);
|
|
if (_placers.Count == 0)
|
|
RemoveSelf();
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public void FailIncomingMove(IExecutingMove move, IPokemon target, ref bool fail)
|
|
{
|
|
if (move.UseMove.HasFlag("mental") && move.UseMove.Category == MoveCategory.Status)
|
|
fail = true;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public void PreventIncomingSecondaryEffect(IExecutingMove move, IPokemon target, byte hit, ref bool prevent)
|
|
{
|
|
if (move.UseMove.HasFlag("mental"))
|
|
prevent = true;
|
|
}
|
|
} |