public void FourLeafTokensAreTakenInOrder() { int[] expectedResults = { 22, 21, 20 }; foreach (int t in expectedResults) { bool result = ScoreTokens.Take(Game, Hex, out Scoring.Token? token); Assert.IsTrue(result); Assert.AreEqual(t, token.Points); } }
protected override ActionContext DoAction(ActionContext context) { if (context.Game == null) { throw new InvalidOperationException("Action context missing required property (Game)"); } if (context.Board == null) { throw new InvalidOperationException("Action context missing required property (Board)"); } if (context.Origin == null) { throw new InvalidOperationException("Action context missing required property (Origin)"); } if (context.Target == null) { throw new InvalidOperationException("Action context missing required property (Target)"); } GameActionData actionData = MakeActionData(context); string playerId = context.PlayerId; Game game = context.Game; Board board = context.Board; Hex origin = (Hex)context.Origin; PlayerBoard playerBoard = PlayerBoard.Get(game, playerId); Scoring.Token[] playerScore = game.Scores[playerId]; playerBoard.SpendLight(4); board[origin] = Tile.Empty; playerBoard.Pieces(PieceType.LargeTree).IncreaseOnPlayerBoard(); if (ScoreTokens.Take(game, origin, out Scoring.Token? token)) { if (token != null) { game.Scores[playerId] = playerScore !.Append(token).ToArray(); } } PlayerBoard.Set(game, playerId, playerBoard); board.Tiles = Shadow.UpdateAllShadows(board, game.SunPosition); game.TilesActiveThisTurn = game.TilesActiveThisTurn.Where(h => h != origin.HexCode).Append(origin.HexCode).ToArray(); game.AddGameAction(actionData); return(context); }