Files
PkmnLib.NET/PkmnLib.Dynamic/Models/Choices/FleeChoice.cs
Deukhoofd cc091d5327
Some checks failed
Build / Build (push) Failing after 35s
Update TUnit, warning cleanup
2026-07-05 13:46:57 +02:00

52 lines
1.3 KiB
C#

using PkmnLib.Dynamic.ScriptHandling;
namespace PkmnLib.Dynamic.Models.Choices;
/// <summary>
/// A choice to flee from a battle.
/// </summary>
public interface IFleeChoice : ITurnChoice
{
}
/// <inheritdoc cref="IFleeChoice"/>
public class FleeTurnChoice : TurnChoice, IFleeChoice
{
/// <inheritdoc />
public FleeTurnChoice(IPokemon user) : base(user)
{
}
/// <inheritdoc />
public override int ScriptCount => User.ScriptCount;
/// <inheritdoc />
public override void GetOwnScripts(List<IEnumerable<ScriptContainer>> scripts)
{
}
/// <inheritdoc />
public override void CollectScripts(List<IEnumerable<ScriptContainer>> scripts) => User.CollectScripts(scripts);
/// <inheritdoc />
public override string ToString() => $"FleeChoice: {User}";
protected bool Equals(FleeTurnChoice other) => other.User == User;
/// <inheritdoc />
public override bool Equals(object? obj)
{
if (obj is null)
return false;
if (ReferenceEquals(this, obj))
return true;
if (obj is not FleeTurnChoice other)
return false;
return Equals(other);
}
/// <inheritdoc />
public override int GetHashCode() =>
// ReSharper disable once ConditionalAccessQualifierIsNonNullableAccordingToAPIContract
User?.GetHashCode() ?? 0;
}