38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
|
|
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
|
|
|
public abstract class OutrageLikeEffect : Script, IScriptForceTurnSelection
|
|
{
|
|
private readonly IPokemon _owner;
|
|
private int _turns;
|
|
private readonly byte _targetSide;
|
|
private readonly byte _targetPosition;
|
|
private readonly StringKey _move;
|
|
|
|
public OutrageLikeEffect(IPokemon owner, int turns, byte targetSide, byte targetPosition, StringKey move)
|
|
{
|
|
_owner = owner;
|
|
_turns = turns;
|
|
_targetSide = targetSide;
|
|
_targetPosition = targetPosition;
|
|
_move = move;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
|
{
|
|
choice = TurnChoiceHelper.CreateMoveChoice(_owner, _move, _targetSide, _targetPosition);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public override void OnAfterHits(IExecutingMove move, IPokemon target)
|
|
{
|
|
_turns--;
|
|
if (_turns <= 0)
|
|
{
|
|
RemoveSelf();
|
|
_owner.Volatile.Add(new Confusion(), true);
|
|
}
|
|
}
|
|
} |