using System; using System.Collections.Generic; using RobotAndDonkey.Game.Board; using RobotAndDonkey.Game.Cards; using RobotAndDonkey.Game.Data; using RobotAndDonkey.Game.Execution.Results; using RobotAndDonkey.Game.GameState; using RobotAndDonkey.Game.Pois; namespace RobotAndDonkey.Game.Intents; public class DonkeyIntent(Card card, Cell donkeyCell, int energyCost) : Intent(energyCost) { public override void Run(Guid requestId, CoreLoop coreLoop, List newIntents, List results) { if (coreLoop.HasDonkey && donkeyCell.Poi == null) { coreLoop.HasDonkey = false; donkeyCell.Poi = new Donkey(); results.Add(new PoiResult(requestId, new(coreLoop.Board), donkeyCell.Poi, donkeyCell.Hex)); newIntents.Add(new ModifyCurrency(new(0, -Balancing.Instance.DonkeyMaxCarryBonus, 0, 0, 0, 0))); } else if (!coreLoop.HasDonkey && donkeyCell.Poi is Donkey donkey) { coreLoop.HasDonkey = true; donkeyCell.Poi = null; results.Add(new PoiResult(requestId, new(coreLoop.Board), donkey, donkeyCell.Hex)); newIntents.Add(new ModifyCurrency(new(0, Balancing.Instance.DonkeyMaxCarryBonus, 0, 0, 0, 0))); } else { results.Add(new InvalidInstructionResult(requestId, EInvalidReason.NoTarget, card, donkeyCell)); } } public override string ToString() => "Donkey, " + base.ToString(); }