Files
zfxaction25/RobotAndDonkey.Game/Intents/DestroyCard.cs
2026-04-19 00:43:27 +02:00

30 lines
1.1 KiB
C#

using RobotAndDonkey.Game.Cards;
using RobotAndDonkey.Game.Execution.Results;
using RobotAndDonkey.Game.GameState;
namespace RobotAndDonkey.Game.Intents;
public class DestroyCard(Card card) : CardIntent(card)
{
public override void Run(Guid requestId, CoreLoop coreLoop, List<Intent> newIntents, List<Result> results)
{
coreLoop.RemoveProgramCard(Card);
var handCards = coreLoop.GetHandCards();
coreLoop.PatchDeck.AddRange(handCards);
foreach (var handCard in handCards)
{
coreLoop.RemoveProgramCard(handCard);
}
coreLoop.ClearTapeSelection();
results.Add(new ProgramRowResult(requestId, coreLoop.ProgramRow.ToArray(), coreLoop.TapeCardIds));
results.Add(new DeckResult(requestId, coreLoop.PatchDeck.ToArray()));
results.Add(new HandResult(requestId, coreLoop.Hand.ToArray()));
base.Run(requestId, coreLoop, newIntents, results);
}
public override bool Immune => true;
public override string ToString() => $"Destroy {Card.Name}, " + base.ToString();
}