Implement Java and Rust cards alongside some smaller changes

This commit is contained in:
2026-07-08 11:30:32 +02:00
parent 50135e2e38
commit 54906bbba1
20 changed files with 531 additions and 93 deletions
+22 -1
View File
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using KernelPanic.Core;
namespace KernelPanic.Combat
{
@@ -16,10 +17,25 @@ namespace KernelPanic.Combat
public int RamCapacity { get; private set; }
public IReadOnlyList<CardInstance> Cards => _cards;
public int UsedRam
{
get
{
int used = 0;
for (int i = 0; i < _cards.Count; i++)
{
used += GetRamCost(_cards[i]);
}
return used;
}
}
public int RemainingRam => System.Math.Max(0, RamCapacity - UsedRam);
public bool CanAdd(CardInstance card)
{
return card != null && _cards.Count < RamCapacity;
return card != null && UsedRam + GetRamCost(card) <= RamCapacity;
}
public bool Add(CardInstance card)
@@ -42,5 +58,10 @@ namespace KernelPanic.Combat
{
_cards.Clear();
}
public static int GetRamCost(CardInstance card)
{
return card?.Definition != null && card.Definition.Language == Language.Java ? 2 : 1;
}
}
}