ported from perforce
This commit is contained in:
29
RobotAndDonkey.Game/Intents/DestroyCard.cs
Normal file
29
RobotAndDonkey.Game/Intents/DestroyCard.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
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();
|
||||
}
|
||||
Reference in New Issue
Block a user