using Theriapolis.Core.Rules.Stats;

namespace Theriapolis.Core.Rules.Combat;

/// <summary>
/// One attack a combatant can attempt — a weapon, a natural attack, or an
/// NPC stat-block entry. Built once at combat-start; the resolver rolls
/// against it. Distinct from <see cref="AttackProfile"/>, which is the
/// per-attempt struct that bakes in attacker/defender/situation.
/// </summary>
public sealed record AttackOption
{
    public string     Name             { get; init; } = "";
    /// <summary>Total +N to add to the d20 attack roll.</summary>
    public int        ToHitBonus       { get; init; }
    public DamageRoll Damage           { get; init; } = new(0, 0, 0, DamageType.Bludgeoning);
    /// <summary>Reach in tactical tiles. 1 = 5 ft. melee; 2 = 10 ft. polearm or Large reach.</summary>
    public int        ReachTiles       { get; init; } = 1;
    /// <summary>Short-range tiles for ranged attacks (0 = melee-only).</summary>
    public int        RangeShortTiles  { get; init; } = 0;
    /// <summary>Long-range tiles (disadvantage past short, can't fire past long).</summary>
    public int        RangeLongTiles   { get; init; } = 0;
    /// <summary>Crit-range threshold (default 20; razored weapons crit on 19+).</summary>
    public int        CritOnNatural    { get; init; } = 20;

    public bool IsRanged => RangeShortTiles > 0;
}
