35 lines
952 B
C#
35 lines
952 B
C#
using System.Collections.Generic;
|
|
|
|
namespace KernelPanic.Combat
|
|
{
|
|
/// <summary>
|
|
/// Shared card eligibility rules for previews, playability checks, and effect execution.
|
|
/// </summary>
|
|
public static class CardEligibility
|
|
{
|
|
public static bool IsJunkForAutoremove(CardInstance card)
|
|
{
|
|
return card != null && (card.IsBroken || card.Definition != null && card.Definition.IsJunk);
|
|
}
|
|
|
|
public static CardInstance FindAutoremoveTarget(IReadOnlyList<CardInstance> hand, CardInstance playedCard)
|
|
{
|
|
if (hand == null)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
for (int i = 0; i < hand.Count; i++)
|
|
{
|
|
CardInstance card = hand[i];
|
|
if (card != playedCard && IsJunkForAutoremove(card))
|
|
{
|
|
return card;
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
}
|