25 lines
706 B
C#

namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "torment")]
public class TormentEffect(IMoveChoice? moveChoice) : Script, IScriptPreventMoveSelection
{
private IMoveChoice? _moveChoice = moveChoice;
/// <inheritdoc />
public void PreventMoveSelection(IMoveChoice choice, ref bool prevent)
{
if (_moveChoice == null)
return;
if (choice.ChosenMove.MoveData == _moveChoice.ChosenMove.MoveData)
{
prevent = true;
}
}
/// <inheritdoc />
public override void OnBeforeTurnStart(ITurnChoice choice)
{
if (choice is IMoveChoice moveChoice)
_moveChoice = moveChoice;
}
}