using PkmnLib.Dynamic.ScriptHandling; namespace PkmnLib.Dynamic.Models.Choices; /// /// A choice to switch to a different Pokémon. /// public interface ISwitchChoice : ITurnChoice { /// /// The Pokémon to switch to. /// IPokemon SwitchTo { get; } } /// public class SwitchChoice : TurnChoice, ISwitchChoice { /// public SwitchChoice(IPokemon user, IPokemon switchTo) : base(user) { SwitchTo = switchTo; } /// public IPokemon SwitchTo { get; } /// public override int ScriptCount => User.ScriptCount; /// public override void GetOwnScripts(List> scripts) { } /// public override void CollectScripts(List> scripts) { User.CollectScripts(scripts); } /// public override string ToString() => $"SwitchChoice: {User} -> {SwitchTo}"; protected bool Equals(SwitchChoice other) => other.User == User && other.SwitchTo == SwitchTo; /// public override bool Equals(object? obj) { if (obj is null) return false; if (ReferenceEquals(this, obj)) return true; if (obj is not SwitchChoice other) return false; return Equals(other); } /// public override int GetHashCode() => User?.GetHashCode() ?? 0 ^ SwitchTo?.GetHashCode() ?? 0; }