Add tutorial and QoL improvements

This commit is contained in:
2026-10-24 00:52:14 +02:00
parent ac48c24a03
commit ec3e784683
53 changed files with 3526 additions and 939 deletions
+54 -1
View File
@@ -10,6 +10,8 @@ namespace KernelPanic.Combat
public sealed class CardInstance
{
private readonly List<CombatantState> _targetSnapshot = new();
private bool _isBroken;
private int _corruptionLastRecoveryRound;
public CardInstance(CardDefinition definition)
{
@@ -17,6 +19,7 @@ namespace KernelPanic.Combat
}
public CardDefinition Definition { get; }
public string InstanceId { get; private set; } = System.Guid.NewGuid().ToString("N");
public IReadOnlyList<CombatantState> TargetSnapshot => _targetSnapshot;
public int TemporaryCostDelta { get; set; }
public int PermanentCostDelta { get; private set; }
@@ -26,12 +29,49 @@ namespace KernelPanic.Combat
public int QueuePlayCount { get; private set; }
public bool WasFirstCardThisTurn { get; private set; }
public bool HadFedoraNonCrashBonus { get; private set; }
public bool IsBroken { get; set; }
public bool IsBroken
{
get => _isBroken;
set
{
_isBroken = value;
if (!value)
{
CorruptionRoundsRemaining = 0;
_corruptionLastRecoveryRound = 0;
}
}
}
// Zero on a broken card means untimed corruption from another source.
public int CorruptionRoundsRemaining { get; private set; }
public bool IsLocked { get; set; }
public bool CanUpgrade => UpgradeLevel == 0;
public bool CanReceiveRepositoryUpgrade => UpgradeLevel < 3;
public bool IsUpgraded => UpgradeLevel > 0;
public void CorruptForRounds(int rounds, int currentRound)
{
IsBroken = true;
CorruptionRoundsRemaining = System.Math.Max(1, rounds);
_corruptionLastRecoveryRound = System.Math.Max(0, currentRound);
}
public bool AdvanceCorruptionRecovery(int round)
{
if (!IsBroken || CorruptionRoundsRemaining <= 0 || round <= _corruptionLastRecoveryRound) return false;
int elapsed = round - _corruptionLastRecoveryRound;
_corruptionLastRecoveryRound = round;
CorruptionRoundsRemaining = System.Math.Max(0, CorruptionRoundsRemaining - elapsed);
return CorruptionRoundsRemaining == 0 && RepairCorruption();
}
public bool RepairCorruption()
{
if (!IsBroken) return false;
IsBroken = false;
return true;
}
public bool Upgrade()
{
if (!CanUpgrade)
@@ -125,6 +165,8 @@ namespace KernelPanic.Combat
copy.QueuePlayCount = QueuePlayCount;
copy.WasFirstCardThisTurn = WasFirstCardThisTurn;
copy.HadFedoraNonCrashBonus = HadFedoraNonCrashBonus;
copy.CorruptionRoundsRemaining = CorruptionRoundsRemaining;
copy._corruptionLastRecoveryRound = _corruptionLastRecoveryRound;
copy.SetTargetSnapshot(TargetSnapshot);
return copy;
}
@@ -155,5 +197,16 @@ namespace KernelPanic.Combat
IsLocked = false;
ClearTargetSnapshot();
}
// Only durable per-card values cross a repository checkpoint. Temporary combat state
// is reset by the normal next-wave path, just as it is without suspending.
internal void RestoreRunState(string instanceId, int costDelta, int magnitude, int drawRider, int level)
{
InstanceId = instanceId;
PermanentCostDelta = costDelta;
MagnitudeBonus = magnitude;
DrawRider = drawRider;
UpgradeLevel = level;
}
}
}