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
+63
View File
@@ -70,6 +70,69 @@ namespace KernelPanic.Combat
return drawn;
}
/// <summary>
/// Moves the top card into the hand if its RAM cost fits. A blocked card remains on top,
/// so callers should stop drawing on failure instead of skipping to cheaper cards.
/// Reshuffles only when the draw pile is empty and the hand has room for a card.
/// </summary>
public bool TryDrawToHand(HandController hand, out CardInstance card)
{
card = null;
if (hand == null || !TryPeekFittingTop(hand.RemainingRam, out CardInstance top) || !hand.Add(top))
{
return false;
}
_drawPile.RemoveAt(_drawPile.Count - 1);
card = top;
return true;
}
/// <summary>
/// Reserves a RAM-fitting batch in draw order before presentation yields. Stops at the first
/// blocked top card; cards discarded after this call cannot join the reserved batch.
/// </summary>
public IReadOnlyList<CardInstance> DrawFittingCards(int count, int availableRam)
{
List<CardInstance> drawn = new();
while (drawn.Count < count && TryPeekFittingTop(availableRam, out CardInstance card))
{
_drawPile.RemoveAt(_drawPile.Count - 1);
drawn.Add(card);
availableRam -= HandController.GetRamCost(card);
}
return drawn;
}
private bool TryPeekFittingTop(int availableRam, out CardInstance card)
{
card = null;
if (availableRam <= 0)
{
return false;
}
if (_drawPile.Count == 0)
{
ReshuffleDiscardIntoDraw();
}
if (_drawPile.Count == 0)
{
return false;
}
CardInstance top = _drawPile[_drawPile.Count - 1];
if (HandController.GetRamCost(top) > availableRam)
{
return false;
}
card = top;
return true;
}
public bool TryDrawCheapestFromTop(int lookCount, out CardInstance card, out IReadOnlyList<PeekedCardInfo> peeked, out bool wasTie)
{
card = null;