using PkmnLib.Dynamic.ScriptHandling; using PkmnLib.Static.Utils; namespace PkmnLib.Dynamic.Models.Choices; /// /// A choice that is made at the beginning of a turn. This can be a switch, flee, item, or pass choice. /// public interface ITurnChoice : IScriptSource, IDeepCloneable { /// /// The user of the turn choice /// IPokemon User { get; } /// /// The speed of the user at the beginning of the turn. /// uint Speed { get; set; } /// /// 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. /// uint RandomValue { get; set; } /// /// Whether the choice has failed. A failed choice will stop running, and execute special /// fail handling during turn execution. /// bool HasFailed { get; } /// /// Fails the choice. This will prevent it from executing and run a specific fail handling during /// execution. Note that this can not be undone. /// public void Fail(); } /// /// A basic implementation of a . /// public abstract class TurnChoice : ScriptSource, ITurnChoice { /// protected TurnChoice(IPokemon user) { User = user; } /// /// The Pokemon for which the choice is made. /// public IPokemon User { get; } /// /// The speed of the user at the beginning of the turn. /// /// /// As a developer you do not need to set this value. It is set at the beginning of a turn automatically. /// public uint Speed { get; set; } /// /// A random value that is set at the beginning of the turn. This is used for tie breaking of the turn order. /// /// /// As a developer you do not need to set this value. It is set at the beginning of a turn automatically. /// public uint RandomValue { get; set; } /// /// Whether the choice has failed. A failed choice will stop running, and execute special fail handling /// during turn execution. /// public bool HasFailed { get; private set; } /// /// Fail the choice. This will prevent it from executing and run a specific fail handling during execution. /// public void Fail() { HasFailed = true; } }