Begin work on outlining dynamic side
This commit is contained in:
56
PkmnLib.Dynamic/Models/Choices/TurnChoice.cs
Normal file
56
PkmnLib.Dynamic/Models/Choices/TurnChoice.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
|
||||
namespace PkmnLib.Dynamic.Models.Choices;
|
||||
|
||||
public interface ITurnChoice : IScriptSource
|
||||
{
|
||||
/// <summary>
|
||||
/// The user of the turn choice
|
||||
/// </summary>
|
||||
IPokemon User { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The speed of the user at the beginning of the turn.
|
||||
/// </summary>
|
||||
uint Speed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This random value is set at the beginning of the turn. It is used for tie breaking of the
|
||||
/// turn order in a predictable way, regardless of implementation and hardware.
|
||||
/// </summary>
|
||||
uint RandomValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the choice has failed. A failed choice will stop running, and execute special
|
||||
/// fail handling during turn execution.
|
||||
/// </summary>
|
||||
bool HasFailed { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Fails the choice. This will prevent it from executing and run a specific fail handling during
|
||||
/// execution. Note that this can not be undone.
|
||||
/// </summary>
|
||||
public void Fail();
|
||||
}
|
||||
|
||||
public abstract class TurnChoice : ScriptSource, ITurnChoice
|
||||
{
|
||||
protected TurnChoice(IPokemon user)
|
||||
{
|
||||
User = user;
|
||||
}
|
||||
|
||||
public IPokemon User { get; }
|
||||
|
||||
public uint Speed { get; set; }
|
||||
|
||||
public uint RandomValue { get; set; }
|
||||
|
||||
public bool HasFailed { get; private set; }
|
||||
|
||||
public void Fail()
|
||||
{
|
||||
HasFailed = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user