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,37 @@
using System;
using System.Collections.Generic;
using RobotAndDonkey.Game.Board;
using RobotAndDonkey.Game.Cards.Patches;
using RobotAndDonkey.Game.Execution.Results;
using RobotAndDonkey.Game.GameState;
using RobotAndDonkey.Game.Pois;
namespace RobotAndDonkey.Game.Intents;
public class PickUp(Cell neighbourCell, Crate crate, int amount, int energyCost) : Intent(energyCost)
{
public override void Run(Guid requestId, CoreLoop coreLoop, List<Intent> newIntents, List<Result> results)
{
if (Amount == 0)
{
results.Add(new InvalidInstructionResult(requestId, EInvalidReason.NoAmount, null, neighbourCell));
}
else
{
coreLoop.Currency.Carry += Amount;
crate.Amount -= Amount;
results.Add(new PoiResult(requestId, new(coreLoop.Board), crate, neighbourCell.Hex));
results.Add(new CurrencyResult(requestId, coreLoop.Currency));
base.Run(requestId, coreLoop, newIntents, results);
}
}
public override bool IsValid(CoreLoop coreLoop)
{
return base.IsValid(coreLoop) && Amount <= coreLoop.Currency.MaxCarry - coreLoop.Currency.Carry;
}
public int Amount { get; set; } = amount;
public override string ToString() => $"Pick up {Amount}, " + base.ToString();
}