/ GUNRPG.Application / Sessions / CombatSessionSnapshot.cs
CombatSessionSnapshot.cs
  1  using GUNRPG.Core.Combat;
  2  using GUNRPG.Core.Intents;
  3  using GUNRPG.Core.Operators;
  4  
  5  namespace GUNRPG.Application.Sessions;
  6  
  7  /// <summary>
  8  /// Serializable snapshot capturing all persisted session state for storage.
  9  /// </summary>
 10  public sealed class CombatSessionSnapshot
 11  {
 12      public Guid Id { get; init; }
 13      public Guid OperatorId { get; init; }  // ID of the operator in this session
 14      public SessionPhase Phase { get; init; }
 15      public int TurnNumber { get; init; }
 16      public CombatStateSnapshot Combat { get; init; } = default!;
 17      public OperatorSnapshot Player { get; init; } = default!;
 18      public OperatorSnapshot Enemy { get; init; } = default!;
 19      public PetStateSnapshot Pet { get; init; } = default!;
 20      public int EnemyLevel { get; init; }
 21      public int Seed { get; init; }
 22      public bool PostCombatResolved { get; init; }
 23      public DateTimeOffset CreatedAt { get; init; }
 24      public DateTimeOffset? CompletedAt { get; init; }
 25      public DateTimeOffset? LastActionTimestamp { get; init; }
 26  }
 27  
 28  public sealed class CombatStateSnapshot
 29  {
 30      public CombatPhase Phase { get; init; }
 31      public long CurrentTimeMs { get; init; }
 32      public IntentSnapshot? PlayerIntents { get; init; }
 33      public IntentSnapshot? EnemyIntents { get; init; }
 34      public RandomStateSnapshot RandomState { get; init; } = default!;
 35  }
 36  
 37  public sealed class RandomStateSnapshot
 38  {
 39      public int Seed { get; init; }
 40      public int CallCount { get; init; }
 41  }
 42  
 43  public sealed class IntentSnapshot
 44  {
 45      public Guid OperatorId { get; init; }
 46      public PrimaryAction Primary { get; init; }
 47      public MovementAction Movement { get; init; }
 48      public StanceAction Stance { get; init; }
 49      public CoverAction Cover { get; init; }
 50      public bool CancelMovement { get; init; }
 51      public long SubmittedAtMs { get; init; }
 52  }
 53  
 54  public sealed class OperatorSnapshot
 55  {
 56      public Guid Id { get; init; }
 57      public string Name { get; init; } = string.Empty;
 58      public float Health { get; init; }
 59      public float MaxHealth { get; init; }
 60      public float Stamina { get; init; }
 61      public float MaxStamina { get; init; }
 62      public float Fatigue { get; init; }
 63      public float MaxFatigue { get; init; }
 64      public MovementState MovementState { get; init; }
 65      public AimState AimState { get; init; }
 66      public WeaponState WeaponState { get; init; }
 67      public MovementState CurrentMovement { get; init; }
 68      public CoverState CurrentCover { get; init; }
 69      public MovementDirection CurrentDirection { get; init; }
 70      public long? MovementEndTimeMs { get; init; }
 71      public string? EquippedWeaponName { get; init; }
 72      public int CurrentAmmo { get; init; }
 73      public float DistanceToOpponent { get; init; }
 74      public long? LastDamageTimeMs { get; init; }
 75      public float HealthRegenDelayMs { get; init; }
 76      public float HealthRegenRate { get; init; }
 77      public float StaminaRegenRate { get; init; }
 78      public float SprintStaminaDrainRate { get; init; }
 79      public float SlideStaminaCost { get; init; }
 80      public float WalkSpeed { get; init; }
 81      public float SprintSpeed { get; init; }
 82      public float SlideDistance { get; init; }
 83      public float SlideDurationMs { get; init; }
 84      public float CurrentRecoilX { get; init; }
 85      public float CurrentRecoilY { get; init; }
 86      public long? RecoilRecoveryStartMs { get; init; }
 87      public float RecoilRecoveryRate { get; init; }
 88      public float Accuracy { get; init; }
 89      public float AccuracyProficiency { get; init; }
 90      public float ResponseProficiency { get; init; }
 91      public int ShotsFiredCount { get; init; }
 92      public int BulletsFiredSinceLastReaction { get; init; }
 93      public float MetersMovedSinceLastReaction { get; init; }
 94      public long? ADSTransitionStartMs { get; init; }
 95      public float ADSTransitionDurationMs { get; init; }
 96      public bool IsActivelyFiring { get; init; }
 97      public bool IsCoverTransitioning { get; init; }
 98      public CoverState CoverTransitionFromState { get; init; }
 99      public CoverState CoverTransitionToState { get; init; }
100      public long? CoverTransitionStartMs { get; init; }
101      public long? CoverTransitionEndMs { get; init; }
102      public float SuppressionLevel { get; init; }
103      public long? SuppressionDecayStartMs { get; init; }
104      public long? LastSuppressionApplicationMs { get; init; }
105      public float FlinchSeverity { get; init; }
106      public int FlinchShotsRemaining { get; init; }
107      public int FlinchDurationShots { get; init; }
108      public long? RecognitionDelayEndMs { get; init; }
109      public Guid? RecognitionTargetId { get; init; }
110      public long? LastTargetVisibleMs { get; init; }
111      public long? RecognitionStartMs { get; init; }
112      public bool WasTargetVisible { get; init; }
113  }
114  
115  public sealed class PetStateSnapshot
116  {
117      public Guid OperatorId { get; init; }
118      public float Health { get; init; }
119      public float Fatigue { get; init; }
120      public float Injury { get; init; }
121      public float Stress { get; init; }
122      public float Morale { get; init; }
123      public float Hunger { get; init; }
124      public float Hydration { get; init; }
125      public DateTimeOffset LastUpdated { get; init; }
126  }