26 lines
709 B
C#

namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "spider_web_effect")]
public class SpiderWebEffect : Script, IScriptPreventOpponentRunAway, IScriptPreventOpponentSwitch
{
private HashSet<IPokemon> _targets = new();
/// <inheritdoc />
public void PreventOpponentRunAway(IFleeChoice choice, ref bool prevent)
{
if (_targets.Contains(choice.User))
prevent = true;
}
/// <inheritdoc />
public void PreventOpponentSwitch(ISwitchChoice choice, ref bool prevent)
{
if (_targets.Contains(choice.User))
prevent = true;
}
public void AddTarget(IPokemon target)
{
_targets.Add(target);
}
}