ported from perforce

This commit is contained in:
2026-04-19 00:43:27 +02:00
commit 6c0c33f5d4
700 changed files with 19735 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
using RobotAndDonkey.Game.Cards;
using RobotAndDonkey.Game.Execution.Results;
using RobotAndDonkey.Game.GameState;
namespace RobotAndDonkey.Game.Intents;
public class BuyPatch(Card card, bool free) : CardIntent(card, free ? 0 : card.ShopCost)
{
public override void Run(Guid requestId, CoreLoop coreLoop, List<Intent> newIntents, List<Result> results)
{
coreLoop.Shop.Remove(Card);
coreLoop.PatchDeck.Add(Card);
results.Add(new ShopResult(requestId, coreLoop.Shop.ToArray()));
results.Add(new DeckResult(requestId, coreLoop.PatchDeck.ToArray()));
base.Run(requestId, coreLoop, newIntents, results);
}
public override bool IsValid(CoreLoop coreLoop)
{
if (!Free && !coreLoop.Shop.Contains(Card))
return false;
if (Free && !coreLoop.BoosterPack.Contains(Card))
return false;
return base.IsValid(coreLoop);
}
public bool Free { get; } = free;
public override bool Immune => true;
public override string ToString() => $"Buy {Card.Name}, " + base.ToString();
}