ported from perforce
This commit is contained in:
32
RobotAndDonkey.Game/Intents/EnterPreview.cs
Normal file
32
RobotAndDonkey.Game/Intents/EnterPreview.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using RobotAndDonkey.Game.Execution.Results;
|
||||
using RobotAndDonkey.Game.Utils;
|
||||
using RobotAndDonkey.Game.GameState;
|
||||
|
||||
namespace RobotAndDonkey.Game.Intents;
|
||||
|
||||
public class EnterPreview : Intent
|
||||
{
|
||||
public override void Run(Guid requestId, CoreLoop coreLoop, List<Intent> newIntents, List<Result> results)
|
||||
{
|
||||
coreLoop.ShuffleDeck();
|
||||
coreLoop.DrawHand();
|
||||
coreLoop.ProgramCount = coreLoop.Robot.ProgramCount;
|
||||
coreLoop.ClearTapeSelection();
|
||||
|
||||
var sortedHand = CardExtensions.SortForHand(coreLoop.GetHandCards());
|
||||
coreLoop.SetProgramRow(sortedHand, Array.Empty<Guid>());
|
||||
|
||||
results.Add(new ProgramRowResult(requestId, coreLoop.ProgramRow.ToArray(), coreLoop.TapeCardIds));
|
||||
results.Add(new HandResult(requestId, coreLoop.Hand.ToArray()));
|
||||
results.Add(new TapeResult(requestId, coreLoop.Tape.ToArray()));
|
||||
results.Add(new DeckResult(requestId, coreLoop.PatchDeck.ToArray()));
|
||||
|
||||
base.Run(requestId, coreLoop, newIntents, results);
|
||||
}
|
||||
|
||||
public override bool Immune => true;
|
||||
|
||||
public override string ToString() => "Enter preview, " + base.ToString();
|
||||
}
|
||||
Reference in New Issue
Block a user