コード例 #1
0
        public static Match CreateMatch(string connectionId)
        {
            var match = new Match();

            //moved to board constructor
            //match.CurrentBoard.Team1 = new Team(0, "red team");
            //match.CurrentBoard.Team2 = new Team(1, "blue team");

            match.Player1 = new Player("match host", connectionId);
            //match.CurrentBoard.Team1.AddPlayer(new Player("player1", connectionId));

            // For now, only hold 1 match:
               ActiveMatches.RemoveAll(m => m != null);

            ActiveMatches.Add(match);

            return match;
        }
コード例 #2
0
 public static void StartMatch(Match match)
 {
     // TODO: make sure all of the board's team;s are set
     match.Start();
 }
コード例 #3
0
        public static void SetUpBoardFromDB(Match match, string boardId)
        {
            var gameVariant = _ds.GetGameVariant(Guid.Parse(boardId));
            match.Game = new Game(gameVariant);

            //TODO: assign current players to the pieces
        }
コード例 #4
0
        // this should handle setting up everything on the board; board, tiles, pieces.
        public static void SetUpBoard(Match match, int boardId)
        {
            if (boardId == 567)
            {
                var chess = new GameVariantModel(
                    modelId: Guid.NewGuid(),
                    modelMovesPerTurn: 1,
                    modelName: "Griddy Chess",
                    modelScoreToWin: 1,
                    modelWidth: 8,
                    modelHeight: 8,
                    modelTileGrid: new Tile[8, 8]);

                match.Game = new Game(chess);

                SetUpChessPieces(match);
            }

            if (boardId == 111)
            {
                var griddyWarfare = new GameVariantModel(
                modelId: Guid.NewGuid(),
                modelMovesPerTurn: 3,
                modelName: "Griddy Warfare",
                modelScoreToWin: 5,
                modelWidth: 20,
                modelHeight: 8,
                modelTileGrid: new Tile[20, 8]);

                match.Game = new Game(griddyWarfare);

                SetUpGriddyWarfarePieces(match);
            }

            if (boardId == 211)
            {
                var fishyGrid = new GameVariantModel(
                modelId: Guid.NewGuid(),
                modelMovesPerTurn: 2,
                modelName: "Fishy Grid",
                modelScoreToWin: 1,
                modelWidth: 20,
                modelHeight: 10,
                modelTileGrid: new Tile[20, 10]);

                match.Game = new Game(fishyGrid);

                SetupFishyGridPieces(match);
            }
        }
コード例 #5
0
 public static void SaveCurrentBoardToDocumentDB(Match match)
 {
     if (match.Game != null)
     {
         _ds.SaveGameVariant(match.Game);
     }
 }
コード例 #6
0
 public static void JoinMatch(Match match, string newPlayerConnectionId)
 {
     //this is done in the hub because access to Groups is needed
 }
コード例 #7
0
        public static Piece GenerateFish(Match match, Team team)
        {
            var fishModel = new PieceVariantModel();
            fishModel.VariantId = 21;

            var fishName = "";
            var xChange = 0;

            if (team.Id == 0)
            {
                fishName = "red fish";
                xChange = 2;
            }
            else if (team.Id == 1)
            {
                fishName = "blue fish";
                xChange = -2;
            }

            if (match.IsTeam1(team))
            {
                    fishModel.Name = fishName;
                    fishModel.MoveAbilities.Add(new MoveAbility(
                                            canCapture: false,
                                            moveOnly: false,
                                            captureOnly: false,
                                            canHop: false,
                                            firstMoveOnly: false,
                                            xChange: xChange,
                                            yChange: 0,
                                            multiplicity: 1));
            }
            else
            {
                    fishModel.Name = fishName;
                    fishModel.MoveAbilities.Add(new MoveAbility(
                                            canCapture: false,
                                            moveOnly: false,
                                            captureOnly: false,
                                            canHop: false,
                                            firstMoveOnly: false,
                                            xChange: xChange,
                                            yChange: 0,
                                            multiplicity: 1));

            }

                return new Piece(fishModel, team);
        }
コード例 #8
0
ファイル: GriddyHub.cs プロジェクト: chow-land/GriddyBackend
        // PRIVATES
        //private static bool PieceDoesNotBelongToCurrentPlayer(TileClickedInfo tileClickedInfo, Match match)
        //{
        //    return match.GetPiece(tileClickedInfo.IdOfTileClicked).Team != match.GetCurrentPlayer().Team;
        //}
        // At this point, we know that the invoking player is indeed the CurrentPlayer of the match.
        private void TriggerClickTileAction(TileClickedInfo tileClickedInfo, Match match)
        {
            var idOfTileClicked = tileClickedInfo.IdOfTileClicked;
            var pieceClicked = match.GetPiece(idOfTileClicked);

            if (match.IsAwaitingCurrentPlayer)
            {
                if (pieceClicked == null || pieceClicked.TeamId != match.CurrentTeam.Id)
                {
                    return;
                }

                var moveOptions = match.GetPieceMoveOptionsAsTileIds(idOfTileClicked);

                if (moveOptions.Count < 1)
                {
                    Clients.Caller.showMessage("cannot move that piece anywhere. Click another.");
                }
                else
                {
                    Clients.Caller.updateBoard(new BoardInfoForClient() { MoveOptions = moveOptions }).Wait();
                    Clients.Caller.showMessage("here are your move options..");
                }
            }
            else if (match.IsAwaitingCurrentPlayerMove)
            {
                var boardInfoForClient = match.StartMovePiece(idOfTileClicked);

                if (boardInfoForClient == null)
                {
                    return;
                }
                else
                {
                    Clients.Group(match.Id.ToString())
                        .updateBoard(boardInfoForClient);
                }
            }
            else if (match.IsOver || match.IsNotStarted)
            {
                return;
            }
        }
コード例 #9
0
        public static Piece GenerateRook(Match match, Team team)
        {
            var rookName = "";

            if (team.Id == 0)
            {
                rookName = "red Rook";
            }
            else if (team.Id == 1)
            {
                rookName = "blue Rook";
            }

            var rookModel = new PieceVariantModel();
            rookModel.VariantId = 2;
            rookModel.Name = rookName;

            // UP infinitely
            rookModel.MoveAbilities.Add(new MoveAbility(
                                        canCapture: true,
                                        moveOnly: false,
                                        captureOnly: false,
                                        canHop: false,
                                        firstMoveOnly: false,
                                        xChange: 0,
                                        yChange: 1,
                                        multiplicity: 7));
            // RIGHT infinitely
            rookModel.MoveAbilities.Add(new MoveAbility(
                                        canCapture: true,
                                        moveOnly: false,
                                        captureOnly: false,
                                        canHop: false,
                                        firstMoveOnly: false,
                                        xChange: 1,
                                        yChange: 0,
                                        multiplicity: 7));

            // DOWN infinitely
            rookModel.MoveAbilities.Add(new MoveAbility(
                                        canCapture: true,
                                        moveOnly: false,
                                        captureOnly: false,
                                        canHop: false,
                                        firstMoveOnly: false,
                                        xChange: 0,
                                        yChange: -1,
                                        multiplicity: 7));

            // LEFT infinitely
            rookModel.MoveAbilities.Add(new MoveAbility(
                                        canCapture: true,
                                        moveOnly: false,
                                        captureOnly: false,
                                        canHop: false,
                                        firstMoveOnly: false,
                                        xChange: -1,
                                        yChange: 0,
                                        multiplicity: 7));

            return new Piece(rookModel, team);
        }
コード例 #10
0
        public static Piece GenerateBishop(Match match, Team team)
        {
            var bishopName = "";

            if (team.Id == 0)
            {
                bishopName = "red Bishop";
            }
            else if (team.Id == 1)
            {
                bishopName = "blue Bishop";
            }

            var bishopModel = new PieceVariantModel();
            bishopModel.VariantId = 4;
            bishopModel.Name = bishopName;

            // UPRIGHT infinitely
            bishopModel.MoveAbilities.Add(new MoveAbility(
                                        canCapture: true,
                                        moveOnly: false,
                                        captureOnly: false,
                                        canHop: false,
                                        firstMoveOnly: false,
                                        xChange: 1,
                                        yChange: 1,
                                        multiplicity: 7));
            // DOWNRIGHT infinitely
            bishopModel.MoveAbilities.Add(new MoveAbility(
                                        canCapture: true,
                                        moveOnly: false,
                                        captureOnly: false,
                                        canHop: false,
                                        firstMoveOnly: false,
                                        xChange: 1,
                                        yChange: -1,
                                        multiplicity: 7));

            // DOWNLEFT infinitely
            bishopModel.MoveAbilities.Add(new MoveAbility(
                                        canCapture: true,
                                        moveOnly: false,
                                        captureOnly: false,
                                        canHop: false,
                                        firstMoveOnly: false,
                                        xChange: -1,
                                        yChange: -1,
                                        multiplicity: 7));

            // UPLEFT infinitely
            bishopModel.MoveAbilities.Add(new MoveAbility(
                                        canCapture: true,
                                        moveOnly: false,
                                        captureOnly: false,
                                        canHop: false,
                                        firstMoveOnly: false,
                                        xChange: -1,
                                        yChange: 1,
                                        multiplicity: 7));

            return new Piece(bishopModel, team);
        }
コード例 #11
0
        public static Piece GenerateQueen(Match match, Team team)
        {
            var queenName = "";

            if (team.Id == 0)
            {
                queenName = "red Queen";
            }
            else if (team.Id == 1)
            {
                queenName = "blue Queen";
            }

            var queenModel = new PieceVariantModel();
            queenModel.VariantId = 6;
            queenModel.Name = queenName;

            // UP infinitely
            queenModel.MoveAbilities.Add(new MoveAbility(
                            canCapture: true,
                            moveOnly: false,
                            captureOnly: false,
                            canHop: false,
                            firstMoveOnly: false,
                            xChange: 0,
                            yChange: 1,
                            multiplicity: 8));

            // UPRIGHT infinitely
            queenModel.MoveAbilities.Add(new MoveAbility(
                                        canCapture: true,
                                        moveOnly: false,
                                        captureOnly: false,
                                        canHop: false,
                                        firstMoveOnly: false,
                                        xChange: 1,
                                        yChange: 1,
                                        multiplicity: 8));

            // RIGHT infinitely
            queenModel.MoveAbilities.Add(new MoveAbility(
                            canCapture: true,
                            moveOnly: false,
                            captureOnly: false,
                            canHop: false,
                            firstMoveOnly: false,
                            xChange: 1,
                            yChange: 0,
                            multiplicity: 8));

            // DOWNRIGHT infinitely
            queenModel.MoveAbilities.Add(new MoveAbility(
                                        canCapture: true,
                                        moveOnly: false,
                                        captureOnly: false,
                                        canHop: false,
                                        firstMoveOnly: false,
                                        xChange: 1,
                                        yChange: -1,
                                        multiplicity: 8));
            // DOWN infinitely
            queenModel.MoveAbilities.Add(new MoveAbility(
                            canCapture: true,
                            moveOnly: false,
                            captureOnly: false,
                            canHop: false,
                            firstMoveOnly: false,
                            xChange: 0,
                            yChange: -1,
                            multiplicity: 8));

            // DOWNLEFT infinitely
            queenModel.MoveAbilities.Add(new MoveAbility(
                                        canCapture: true,
                                        moveOnly: false,
                                        captureOnly: false,
                                        canHop: false,
                                        firstMoveOnly: false,
                                        xChange: -1,
                                        yChange: -1,
                                        multiplicity: 8));

            // LEFT infinitely
            queenModel.MoveAbilities.Add(new MoveAbility(
                            canCapture: true,
                            moveOnly: false,
                            captureOnly: false,
                            canHop: false,
                            firstMoveOnly: false,
                            xChange: -1,
                            yChange: 0,
                            multiplicity: 8));

            // UPLEFT infinitely
            queenModel.MoveAbilities.Add(new MoveAbility(
                                        canCapture: true,
                                        moveOnly: false,
                                        captureOnly: false,
                                        canHop: false,
                                        firstMoveOnly: false,
                                        xChange: -1,
                                        yChange: 1,
                                        multiplicity: 8));

            return new Piece(queenModel, team);
        }
コード例 #12
0
        // TODO:  to account for cases like the pawn's 2y move, both the 1y and the 2y have to be one distinct moveability.
        // Somehow need to track different bools for each multiplicity.
        public static Piece GeneratePawn(Match match, Team team)
        {
            var pawnName = "";
            var yChange = 0;

            if (team.Id == 0)
            {
                pawnName = "red Pawn";
                yChange = -1;
            }
            else if (team.Id == 1)
            {
                pawnName = "blue Pawn";
                yChange = 1;
            }

            var pawnModel = new PieceVariantModel();
            pawnModel.VariantId = 1;
            pawnModel.Name = pawnName;

            // DOWN 1 or DOWN 2
            pawnModel.MoveAbilities.Add(new MoveAbility(
                                        canCapture: false,
                                        moveOnly: true,
                                        captureOnly: false,
                                        canHop: false,
                                        firstMoveOnly: true,
                                        xChange: 0,
                                        yChange: yChange*2,
                                        multiplicity: 1));
            // DOWN 1
            pawnModel.MoveAbilities.Add(new MoveAbility(
                                        canCapture: false,
                                        moveOnly: true,
                                        captureOnly: false,
                                        canHop: false,
                                        firstMoveOnly: false,
                                        xChange: 0,
                                        yChange: yChange,
                                        multiplicity: 1));
            // DOWN 1, LEFT 1
            pawnModel.MoveAbilities.Add(new MoveAbility(multiplicity: 1,
                                    canCapture: true,
                                    moveOnly: false,
                                    captureOnly: true,
                                    canHop: false,
                                    firstMoveOnly: false,
                                    xChange: -1,
                                    yChange: yChange));

            // DOWN 1, RIGHT 1
            pawnModel.MoveAbilities.Add(new MoveAbility(multiplicity: 1,
                                    canCapture: true,
                                    moveOnly: false,
                                    captureOnly: true,
                                    canHop: false,
                                    firstMoveOnly: false,
                                    xChange: 1,
                                    yChange: yChange));
            return new Piece(pawnModel, team);
        }
コード例 #13
0
        public static Piece GenerateKnight(Match match, Team team)
        {
            var knightName = "";

            if (team.Id == 0)
            {
                knightName = "red Knight";
            }
            else if (team.Id == 1)
            {
                knightName = "blue Knight";
            }

            var rookModel = new PieceVariantModel();
            rookModel.VariantId = 3;
            rookModel.Name = knightName;

            // UP, UP, RIGHT
            rookModel.MoveAbilities.Add(new MoveAbility(
                                        canCapture: true,
                                        moveOnly: false,
                                        captureOnly: false,
                                        canHop: true,
                                        firstMoveOnly: false,
                                        xChange: 1,
                                        yChange: 2,
                                        multiplicity: 1));
            // RIGHT, RIGHT, UP
            rookModel.MoveAbilities.Add(new MoveAbility(
                                        canCapture: true,
                                        moveOnly: false,
                                        captureOnly: false,
                                        canHop: true,
                                        firstMoveOnly: false,
                                        xChange: 2,
                                        yChange: 1,
                                        multiplicity: 1));

            // RIGHT RIGHT DOWN
            rookModel.MoveAbilities.Add(new MoveAbility(
                                        canCapture: true,
                                        moveOnly: false,
                                        captureOnly: false,
                                        canHop: true,
                                        firstMoveOnly: false,
                                        xChange: 2,
                                        yChange: -1,
                                        multiplicity: 1));

            // DOWN DOWN RIGHT
            rookModel.MoveAbilities.Add(new MoveAbility(
                                        canCapture: true,
                                        moveOnly: false,
                                        captureOnly: false,
                                        canHop: true,
                                        firstMoveOnly: false,
                                        xChange: 1,
                                        yChange: -2,
                                        multiplicity: 1));

            // DOWN DOWN LEFT
            rookModel.MoveAbilities.Add(new MoveAbility(
                                        canCapture: true,
                                        moveOnly: false,
                                        captureOnly: false,
                                        canHop: true,
                                        firstMoveOnly: false,
                                        xChange: -1,
                                        yChange: -2,
                                        multiplicity: 1));

            // LEFT LEFT DOWN
            rookModel.MoveAbilities.Add(new MoveAbility(
                                        canCapture: true,
                                        moveOnly: false,
                                        captureOnly: false,
                                        canHop: true,
                                        firstMoveOnly: false,
                                        xChange: -2,
                                        yChange: -1,
                                        multiplicity: 1));

            // LEFT LEFT UP
            rookModel.MoveAbilities.Add(new MoveAbility(
                                        canCapture: true,
                                        moveOnly: false,
                                        captureOnly: false,
                                        canHop: true,
                                        firstMoveOnly: false,
                                        xChange: -2,
                                        yChange: 1,
                                        multiplicity: 1));

            // UP UP LEFT
            rookModel.MoveAbilities.Add(new MoveAbility(
                                        canCapture: true,
                                        moveOnly: false,
                                        captureOnly: false,
                                        canHop: true,
                                        firstMoveOnly: false,
                                        xChange: -1,
                                        yChange: 2,
                                        multiplicity: 1));

            return new Piece(rookModel, team);
        }
コード例 #14
0
        public static Piece GenerateKing(Match match, Team team)
        {
            var kingName = "";

            if (team.Id == 0)
            {
                kingName = "red King";
            }
            else if (team.Id == 1)
            {
                kingName = "blue King";
            }

            var kingModel = new PieceVariantModel();
            kingModel.VariantId = 5;
            kingModel.Name = kingName;

            kingModel.CaptureDoesGivePoint = true;
            kingModel.CapturePointValue = 1;

            // UP 1
            kingModel.MoveAbilities.Add(new MoveAbility(
                            canCapture: true,
                            moveOnly: false,
                            captureOnly: false,
                            canHop: false,
                            firstMoveOnly: false,
                            xChange: 0,
                            yChange: 1,
                            multiplicity: 1));

            // UPRIGHT 1
            kingModel.MoveAbilities.Add(new MoveAbility(
                                        canCapture: true,
                                        moveOnly: false,
                                        captureOnly: false,
                                        canHop: false,
                                        firstMoveOnly: false,
                                        xChange: 1,
                                        yChange: 1,
                                        multiplicity: 1));

            // RIGHT 1
            kingModel.MoveAbilities.Add(new MoveAbility(
                            canCapture: true,
                            moveOnly: false,
                            captureOnly: false,
                            canHop: false,
                            firstMoveOnly: false,
                            xChange: 1,
                            yChange: 0,
                            multiplicity: 1));

            // DOWNRIGHT 1
            kingModel.MoveAbilities.Add(new MoveAbility(
                                        canCapture: true,
                                        moveOnly: false,
                                        captureOnly: false,
                                        canHop: false,
                                        firstMoveOnly: false,
                                        xChange: 1,
                                        yChange: -1,
                                        multiplicity: 1));
            // DOWN 1
            kingModel.MoveAbilities.Add(new MoveAbility(
                            canCapture: true,
                            moveOnly: false,
                            captureOnly: false,
                            canHop: false,
                            firstMoveOnly: false,
                            xChange: 0,
                            yChange: -1,
                            multiplicity: 1));

            // DOWNLEFT 1
            kingModel.MoveAbilities.Add(new MoveAbility(
                                        canCapture: true,
                                        moveOnly: false,
                                        captureOnly: false,
                                        canHop: false,
                                        firstMoveOnly: false,
                                        xChange: -1,
                                        yChange: -1,
                                        multiplicity: 1));

            // LEFT 1
            kingModel.MoveAbilities.Add(new MoveAbility(
                            canCapture: true,
                            moveOnly: false,
                            captureOnly: false,
                            canHop: false,
                            firstMoveOnly: false,
                            xChange: -1,
                            yChange: 0,
                            multiplicity: 1));

            // UPLEFT 1
            kingModel.MoveAbilities.Add(new MoveAbility(
                                        canCapture: true,
                                        moveOnly: false,
                                        captureOnly: false,
                                        canHop: false,
                                        firstMoveOnly: false,
                                        xChange: -1,
                                        yChange: 1,
                                        multiplicity: 1));

            return new Piece(kingModel, team);
        }
コード例 #15
0
        // nmo, make this part of board constructor
        //public static void SetUpPieces(Match match, List<PieceVariantModel> pieceVariants)
        //{
        //    if (match.CurrentBoard == null)
        //    {
        //        return;
        //    }
        //    var player1 = match.Team1.GetPlayer();
        //    var player2 = match.Team2.GetPlayer();
        //}
        // TEMP
        private static void SetUpChessPieces(Match match)
        {
            if (match.Game == null)
            {
                return;
            }

            // TODO: currently, we require that a 2nd player has joined. Need to split up this work somehow.

            Team team1 = match.Team1;
            Team team2 = match.Team2;

            //  _ds.SavePiece(GenerateNewPiece());

            // get pieces from some DB...
            // TODO:  instead of callin9g tilegrid directly,  do match.CurrentBoard.AddPiece(tileId/tile, piece)
            match.Game.AddPiece(
                GenerateRook(match, team1),
                xPos: 0, yPos: 7);

            match.Game.AddPiece(GenerateKnight(match, team1), 1, 7);
            match.Game.AddPiece(GenerateBishop(match, team1), 2, 7);
            match.Game.AddPiece(GenerateKing(match, team1), 3, 7);
            match.Game.AddPiece(GenerateQueen(match, team1), 4, 7);
            match.Game.AddPiece(GenerateBishop(match, team1), 5, 7);
            match.Game.AddPiece(GenerateKnight(match, team1), 6, 7);
            match.Game.AddPiece(GenerateRook(match, team1), 7, 7);

            // red Pawns
            match.Game.AddPiece(
                GeneratePawn(match, team1),
                xPos: 0, yPos: 6);

            match.Game.AddPiece(GeneratePawn(match, team1), 1, 6);
            match.Game.AddPiece(GeneratePawn(match, team1), 2, 6);
            match.Game.AddPiece(GeneratePawn(match, team1), 3, 6);
            match.Game.AddPiece(GeneratePawn(match, team1), 4, 6);
            match.Game.AddPiece(GeneratePawn(match, team1), 5, 6);
            match.Game.AddPiece(GeneratePawn(match, team1), 6, 6);
            match.Game.AddPiece(GeneratePawn(match, team1), 7, 6);

            // blue Pawns
            match.Game.AddPiece(GeneratePawn(match, team2), 0, 1);
            match.Game.AddPiece(GeneratePawn(match, team2), 1, 1);
            match.Game.AddPiece(GeneratePawn(match, team2), 2, 1);
            match.Game.AddPiece(GeneratePawn(match, team2), 3, 1);
            match.Game.AddPiece(GeneratePawn(match, team2), 4, 1);
            match.Game.AddPiece(GeneratePawn(match, team2), 5, 1);
            match.Game.AddPiece(GeneratePawn(match, team2), 6, 1);
            match.Game.AddPiece(GeneratePawn(match, team2), 7, 1);

            match.Game.AddPiece(GenerateRook(match, team2), 0, 0);
            match.Game.AddPiece(GenerateKnight(match, team2), 1, 0);
            match.Game.AddPiece(GenerateBishop(match, team2), 2, 0);
            match.Game.AddPiece(GenerateKing(match, team2), 3, 0);
            match.Game.AddPiece(GenerateQueen(match, team2), 4, 0);
            match.Game.AddPiece(GenerateBishop(match, team2), 5, 0);
            match.Game.AddPiece(GenerateKnight(match, team2), 6, 0);
            match.Game.AddPiece(GenerateRook(match, team2), 7, 0);
        }
コード例 #16
0
        public static Piece GenerateSherman(Match match, Team team)
        {
            var shermanModel = new PieceVariantModel();
            shermanModel.VariantId = 11;
            shermanModel.Name = "Sherman Tank";

            shermanModel.CaptureDoesGivePoint = true;
            shermanModel.CapturePointValue = 1;

            if (match.IsTeam1(team))
            {
                // UPRIGHT 3
                shermanModel.MoveAbilities.Add(new MoveAbility(
                                            canCapture: true,
                                            moveOnly: false,
                                            captureOnly: false,
                                            canHop: false,
                                            firstMoveOnly: false,
                                            xChange: 1,
                                            yChange: -1,
                                            multiplicity: 2));

                // DOWN 3
                shermanModel.MoveAbilities.Add(new MoveAbility(
                                canCapture: true,
                                moveOnly: false,
                                captureOnly: false,
                                canHop: false,
                                firstMoveOnly: false,
                                xChange: -1,
                                yChange: 0,
                                multiplicity: 3));

                // UPLEFT 3
                shermanModel.MoveAbilities.Add(new MoveAbility(
                                            canCapture: true,
                                            moveOnly: false,
                                            captureOnly: false,
                                            canHop: false,
                                            firstMoveOnly: false,
                                            xChange: 1,
                                            yChange: 1,
                                            multiplicity: 2));
            }
            else
            {
                // DOWNRIGHT 3
                shermanModel.MoveAbilities.Add(new MoveAbility(
                                            canCapture: true,
                                            moveOnly: false,
                                            captureOnly: false,
                                            canHop: false,
                                            firstMoveOnly: false,
                                            xChange: -1,
                                            yChange: -1,
                                            multiplicity: 2));

                // UP 3
                shermanModel.MoveAbilities.Add(new MoveAbility(
                                canCapture: true,
                                moveOnly: false,
                                captureOnly: false,
                                canHop: false,
                                firstMoveOnly: false,
                                xChange: 1,
                                yChange: 0,
                                multiplicity: 3));

                // DOWNLEFT 2
                shermanModel.MoveAbilities.Add(new MoveAbility(
                                            canCapture: true,
                                            moveOnly: false,
                                            captureOnly: false,
                                            canHop: false,
                                            firstMoveOnly: false,
                                            xChange: -1,
                                            yChange: 1,
                                            multiplicity: 2));
            }

            return new Piece(shermanModel, team);
        }
コード例 #17
0
        private static void SetupFishyGridPieces(Match match)
        {
            if (match.Game == null)
            {
                return;
            }

            Team team1 = match.Team1;
            Team team2 = match.Team2;

            match.Game.AddPiece(
                GenerateFish(match, team1),
                xPos: 0, yPos: 0);

            match.Game.AddPiece(
                GenerateFish(match, team1),
                xPos: 1, yPos: 1);

            match.Game.AddPiece(
                GenerateFish(match, team1),
                xPos: 2, yPos: 2);

            match.Game.AddPiece(
                GenerateFish(match, team1),
                xPos: 3, yPos: 3);

                    match.Game.AddPiece(
            GenerateFish(match, team1),
            xPos: 4, yPos: 4);

            match.Game.AddPiece(
                 GenerateWhale(match, team1),
                 xPos: 0, yPos: 5);

            match.Game.AddPiece(
            GenerateFish(match, team1),
            xPos: 4, yPos: 5);

                    match.Game.AddPiece(
            GenerateFish(match, team1),
            xPos: 3, yPos: 6);

                    match.Game.AddPiece(
            GenerateFish(match, team1),
            xPos: 2, yPos: 7);

                    match.Game.AddPiece(
            GenerateFish(match, team1),
            xPos: 1, yPos: 8);

                    match.Game.AddPiece(
            GenerateFish(match, team1),
            xPos: 0, yPos: 9);

            match.Game.AddPiece(
                 GenerateWhale(match, team2),
                 xPos: 19, yPos: 4);

            match.Game.AddPiece(
                GenerateFish(match, team2),
                xPos: 19, yPos: 9);

            match.Game.AddPiece(
                GenerateFish(match, team2),
                xPos: 18, yPos: 8);

            match.Game.AddPiece(
                GenerateFish(match, team2),
                xPos: 17, yPos: 7);

            match.Game.AddPiece(
                GenerateFish(match, team2),
                xPos: 16, yPos: 6);

            match.Game.AddPiece(
                GenerateFish(match, team2),
                xPos: 15, yPos: 5);

            match.Game.AddPiece(
                GenerateFish(match, team2),
                xPos: 15, yPos: 4);

            match.Game.AddPiece(
                GenerateFish(match, team2),
                xPos: 16, yPos: 3);

            match.Game.AddPiece(
                GenerateFish(match, team2),
                xPos: 17, yPos: 2);

                    match.Game.AddPiece(
            GenerateFish(match, team2),
            xPos: 18, yPos: 1);

                    match.Game.AddPiece(
            GenerateFish(match, team2),
            xPos: 19, yPos: 0);
        }
コード例 #18
0
        public static Piece GenerateWhale(Match match, Team team)
        {
            var whaleModel = new PieceVariantModel();
            whaleModel.VariantId = 22;
            whaleModel.CaptureDoesGivePoint = true;
            whaleModel.CapturePointValue = 1;

            var whaleName = "";
            var xChange = 0;

            if (team.Id == 0)
            {
                whaleName = "red whale";
            }
            else if (team.Id == 1)
            {
                whaleName = "blue whale";
            }

            whaleModel.Name = whaleName;

            whaleModel.MoveAbilities.Add(new MoveAbility(
                                    canCapture: true,
                                    moveOnly: false,
                                    captureOnly: false,
                                    canHop: false,
                                    firstMoveOnly: false,
                                    xChange: 1,
                                    yChange: 1,
                                    multiplicity: 10));

            whaleModel.MoveAbilities.Add(new MoveAbility(
                        canCapture: true,
                        moveOnly: false,
                        captureOnly: false,
                        canHop: false,
                        firstMoveOnly: false,
                        xChange: 1,
                        yChange: -1,
                        multiplicity: 10));

            whaleModel.MoveAbilities.Add(new MoveAbility(
                        canCapture: true,
                        moveOnly: false,
                        captureOnly: false,
                        canHop: false,
                        firstMoveOnly: false,
                        xChange: -1,
                        yChange: -1,
                        multiplicity: 10));

            whaleModel.MoveAbilities.Add(new MoveAbility(
                    canCapture: true,
                    moveOnly: false,
                    captureOnly: false,
                    canHop: false,
                    firstMoveOnly: false,
                    xChange: -1,
                    yChange: 1,
                    multiplicity: 10));

            return new Piece(whaleModel, team);
        }
コード例 #19
0
ファイル: Game.cs プロジェクト: chow-land/GriddyBackend
        public BoardDelta GetFullBoardDelta(Match match)
        {
            var boardDelta = new BoardDelta();

            foreach (var tile in TileGrid)
            {
                if (tile.CurrentPiece == null)
                {
                    boardDelta.Add(tile.Id, null, null);
                }
                else
                {
                    boardDelta.Add(tile.Id, tile.CurrentPiece.VariantId, tile.CurrentPiece.TeamId);
                }
            }

            return boardDelta;
        }
コード例 #20
0
        private static void SetUpGriddyWarfarePieces(Match match)
        {
            if (match.Game == null)
            {
                return;
            }

            Team team1 = match.Team1;
            Team team2 = match.Team2;

            match.Game.AddPiece(
                GenerateSherman(match, team1),
                xPos: 1, yPos: 0);

            match.Game.AddPiece(
                GenerateSherman(match, team1),
                xPos: 1, yPos: 2);

            match.Game.AddPiece(
                GenerateSherman(match, team1),
                xPos: 1, yPos: 4);

            match.Game.AddPiece(
                GenerateSherman(match, team1),
                xPos: 1, yPos: 6);

            match.Game.AddPiece(
                GenerateSherman(match, team1),
                xPos: 2, yPos: 1);

            match.Game.AddPiece(
                GenerateSherman(match, team1),
                xPos: 2, yPos: 3);

            match.Game.AddPiece(
                GenerateSherman(match, team1),
                xPos: 2, yPos: 5);

            match.Game.AddPiece(
                GenerateSherman(match, team1),
                xPos: 2, yPos: 7);

            match.Game.AddPiece(
                GenerateSherman(match, team2),
                xPos: 18, yPos: 1);

            match.Game.AddPiece(
                GenerateSherman(match, team2),
                xPos: 18, yPos: 3);

            match.Game.AddPiece(
                GenerateSherman(match, team2),
                xPos: 18, yPos: 5);

            match.Game.AddPiece(
                GenerateSherman(match, team2),
                xPos: 18, yPos: 7);

            match.Game.AddPiece(
                GenerateSherman(match, team2),
                xPos: 17, yPos: 0);

            match.Game.AddPiece(
                GenerateSherman(match, team2),
                xPos: 17, yPos: 2);

            match.Game.AddPiece(
                GenerateSherman(match, team2),
                xPos: 17, yPos: 4);

            match.Game.AddPiece(
                GenerateSherman(match, team2),
                xPos: 17, yPos: 6);
        }