b451f83174
Captures the pre-Godot-port state of the codebase. This is the rollback anchor for the Godot port (M0 of theriapolis-rpg-implementation-plan-godot-port.md). All Phase 0 through Phase 6.5 work is included; Phase 7 is in flight. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
39 lines
1.4 KiB
C#
39 lines
1.4 KiB
C#
namespace Theriapolis.Core.Rules.Combat;
|
|
|
|
/// <summary>
|
|
/// Mutable per-turn state for the active combatant: action / bonus action /
|
|
/// reaction availability and remaining movement budget. The
|
|
/// <see cref="Encounter"/> rebuilds this when each new turn begins; the
|
|
/// <see cref="Resolver"/> consumes resources as the combatant uses them.
|
|
///
|
|
/// Phase 5 M4 tracks the booleans but doesn't enforce them inside Resolver
|
|
/// (callers can attack twice in a turn if they want — useful for tests).
|
|
/// M5 introduces per-action-cost gating in the live PlayScreen wrapper.
|
|
/// </summary>
|
|
public struct Turn
|
|
{
|
|
public int CombatantId;
|
|
public bool ActionAvailable;
|
|
public bool BonusActionAvailable;
|
|
public bool ReactionAvailable;
|
|
public int RemainingMovementFt;
|
|
|
|
public static Turn FreshFor(int combatantId, int speedFt) => new()
|
|
{
|
|
CombatantId = combatantId,
|
|
ActionAvailable = true,
|
|
BonusActionAvailable = true,
|
|
ReactionAvailable = true,
|
|
RemainingMovementFt = speedFt,
|
|
};
|
|
|
|
public void ConsumeAction() => ActionAvailable = false;
|
|
public void ConsumeBonusAction() => BonusActionAvailable = false;
|
|
public void ConsumeReaction() => ReactionAvailable = false;
|
|
public void ConsumeMovement(int feet)
|
|
{
|
|
RemainingMovementFt -= feet;
|
|
if (RemainingMovementFt < 0) RemainingMovementFt = 0;
|
|
}
|
|
}
|