Adds unit test for gen 7 damage library

This commit is contained in:
2024-07-28 10:41:12 +02:00
parent 9186d0efcc
commit 864dda6644
9 changed files with 153 additions and 19 deletions

View File

@@ -4,44 +4,71 @@ using PkmnLib.Static.Moves;
namespace PkmnLib.Dynamic.Models;
/// <summary>
/// A hit data is the data for a single hit, on a single target.
/// </summary>
public record HitData
public interface IHitData
{
/// <summary>
/// Whether the hit is critical.
/// </summary>
public bool IsCritical { get; internal set; }
bool IsCritical { get; }
/// <summary>
/// The base power of the hit.
/// </summary>
public byte BasePower { get; internal set; }
byte BasePower { get; }
/// <summary>
/// The effectiveness of the hit.
/// </summary>
public float Effectiveness { get; internal set; }
float Effectiveness { get; }
/// <summary>
/// The damage done by the hit.
/// </summary>
public uint Damage { get; internal set; }
uint Damage { get; }
/// <summary>
/// The type of the hit.
/// </summary>
public TypeIdentifier Type { get; internal set; }
TypeIdentifier Type { get; }
/// <summary>
/// Whether the hit has failed.
/// </summary>
public bool HasFailed { get; private set; }
bool HasFailed { get; }
/// <summary>
/// Fails the hit.
/// </summary>
void Fail();
bool Equals(HitData? other);
bool Equals(object? other);
int GetHashCode();
string ToString();
}
/// <inheritdoc />
public record HitData : IHitData
{
/// <inheritdoc />
public bool IsCritical { get; internal set; }
/// <inheritdoc />
public byte BasePower { get; internal set; }
/// <inheritdoc />
public float Effectiveness { get; internal set; }
/// <inheritdoc />
public uint Damage { get; internal set; }
/// <inheritdoc />
public TypeIdentifier Type { get; internal set; }
/// <inheritdoc />
public bool HasFailed { get; private set; }
/// <inheritdoc />
public void Fail() => HasFailed = true;
}