PkmnLib.NET/PkmnLib.Dynamic/Models/Choices/MoveChoice.cs

74 lines
1.8 KiB
C#
Raw Normal View History

2024-07-27 14:26:45 +00:00
using PkmnLib.Dynamic.ScriptHandling;
namespace PkmnLib.Dynamic.Models.Choices;
/// <summary>
/// The choice of a Pokémon to use a move.
/// </summary>
public interface IMoveChoice : ITurnChoice
{
/// <summary>
/// The move that is used.
/// </summary>
2024-08-10 09:18:10 +00:00
ILearnedMove ChosenMove { get; }
2024-07-27 14:26:45 +00:00
/// <summary>
/// The side the move is targeted at.
/// </summary>
byte TargetSide { get; }
/// <summary>
/// The position the move is targeted at.
/// </summary>
byte TargetPosition { get; }
/// <summary>
/// The priority of the move.
/// </summary>
sbyte Priority { get; set; }
/// <summary>
/// The underlying script of the move.
/// </summary>
ScriptContainer Script { get; set; }
}
/// <inheritdoc cref="IMoveChoice"/>
public class MoveChoice : TurnChoice, IMoveChoice
{
/// <inheritdoc cref="MoveChoice"/>
public MoveChoice(IPokemon user, ILearnedMove usedMove, byte targetSide, byte targetPosition) : base(user)
{
2024-08-10 09:18:10 +00:00
ChosenMove = usedMove;
2024-07-27 14:26:45 +00:00
TargetSide = targetSide;
TargetPosition = targetPosition;
}
/// <inheritdoc />
2024-08-10 09:18:10 +00:00
public ILearnedMove ChosenMove { get; }
2024-07-27 14:26:45 +00:00
/// <inheritdoc />
public byte TargetSide { get; }
/// <inheritdoc />
public byte TargetPosition { get; }
/// <inheritdoc />
public sbyte Priority { get; set; }
/// <inheritdoc />
public ScriptContainer Script { get; set; } = new();
/// <inheritdoc />
public override int ScriptCount => 1 + User.ScriptCount;
/// <inheritdoc />
public override void GetOwnScripts(List<IEnumerable<ScriptContainer>> scripts) => scripts.Add(Script);
/// <inheritdoc />
public override void CollectScripts(List<IEnumerable<ScriptContainer>> scripts)
{
GetOwnScripts(scripts);
User.CollectScripts(scripts);
}
}