예제 #1
0
파일: Board.cs 프로젝트: roric32/inferno
        public bool BlockIsOnFire(Block block)
        {
            List<List<ISquareTypes>> BlockRows = new List<List<ISquareTypes>>();

            BlockRows.Add(block.GetRowA());
            BlockRows.Add(block.GetRowB());
            BlockRows.Add(block.GetRowC());
            BlockRows.Add(block.GetRowD());

            foreach (List<ISquareTypes> Row in BlockRows)
            {
                foreach (ISquareTypes Square in Row)
                {
                    if (this.isFlammable(Square) == true)
                    {
                        FlammableSquare thisSquare = this.CastToFlammable(Square);
                        if (thisSquare.currentTokens > 0)
                        {
                            return true;
                        }
                    }
                }

            }

            return false;
        }
예제 #2
0
파일: Board.cs 프로젝트: roric32/inferno
        public Board(string CB1, string CB2, string CB3 = null, string CB4 = null)
        {
            //Get the block string names.
            this.CB1Name = CB1;
            this.CB2Name = CB2;
            this.CB3Name = CB3;
            this.CB4Name = CB4;

            //Create new City Block objects.
            Block Block1 = new Block(CB1Name);
            this.BlocksInPlay.Add(Block1);
            Block1.BlockNumber = 1;
            this.Block1Randoms = Block1.GetRandomizerNumbers();
            Block Block2 = new Block(CB2Name);
            this.BlocksInPlay.Add(Block2);
            Block2.BlockNumber = 2;
            this.Block2Randoms = Block2.GetRandomizerNumbers();

            //If we don't have the block names, we're playing 2 or three player.
            //Initialize some blocks according to player number.

            if (CB3 == null)
            {
                this.numBoards = 2;
            }
            else if (CB4 == null && CB3 != null)
            {
                this.numBoards = 3;

                Block Block3 = new Block(CB3Name);
                this.BlocksInPlay.Add(Block3);
                Block3.BlockNumber = 3;
                this.Block3Randoms = Block3.GetRandomizerNumbers();
                this.Block3SquaresA = Block3.GetRowA();
                this.Block3SquaresB = Block3.GetRowB();
                this.Block3SquaresC = Block3.GetRowC();
                this.Block3SquaresD = Block3.GetRowD();

                this.RenameBlock(this.Block3SquaresA, 2, "G");
                this.RenameBlock(this.Block3SquaresB, 2, "H");
                this.RenameBlock(this.Block3SquaresC, 2, "I");
                this.RenameBlock(this.Block3SquaresD, 2, "J");

            }
            else
            {
                this.numBoards = 4;

                Block Block3 = new Block(CB3Name);
                this.BlocksInPlay.Add(Block3);
                Block3.BlockNumber = 3;
                this.Block3Randoms = Block3.GetRandomizerNumbers();
                this.Block3SquaresA = Block3.GetRowA();
                this.Block3SquaresB = Block3.GetRowB();
                this.Block3SquaresC = Block3.GetRowC();
                this.Block3SquaresD = Block3.GetRowD();

                this.RenameBlock(this.Block3SquaresA, 2, "G");
                this.RenameBlock(this.Block3SquaresB, 2, "H");
                this.RenameBlock(this.Block3SquaresC, 2, "I");
                this.RenameBlock(this.Block3SquaresD, 2, "J");

                Block Block4 = new Block(CB4Name);
                this.BlocksInPlay.Add(Block4);
                Block4.BlockNumber = 4;
                this.Block4Randoms = Block4.GetRandomizerNumbers();
                this.Block4SquaresA = Block4.GetRowA();
                this.Block4SquaresB = Block4.GetRowB();
                this.Block4SquaresC = Block4.GetRowC();
                this.Block4SquaresD = Block4.GetRowD();

                this.RenameBlock(this.Block4SquaresA, 7, "G");
                this.RenameBlock(this.Block4SquaresB, 7, "H");
                this.RenameBlock(this.Block4SquaresC, 7, "I");
                this.RenameBlock(this.Block4SquaresD, 7, "J");
            }

            //Get layouts from the City Blocks we're going to use.
            this.Block1SquaresA = Block1.GetRowA();
            this.Block1SquaresB = Block1.GetRowB();
            this.Block1SquaresC = Block1.GetRowC();
            this.Block1SquaresD = Block1.GetRowD();

            this.RenameBlock(this.Block1SquaresA, 2, "B");
            this.RenameBlock(this.Block1SquaresB, 2, "C");
            this.RenameBlock(this.Block1SquaresC, 2, "D");
            this.RenameBlock(this.Block1SquaresD, 2, "E");

            this.Block2SquaresA = Block2.GetRowA();
            this.Block2SquaresB = Block2.GetRowB();
            this.Block2SquaresC = Block2.GetRowC();
            this.Block2SquaresD = Block2.GetRowD();

            this.RenameBlock(this.Block2SquaresA, 7, "B");
            this.RenameBlock(this.Block2SquaresB, 7, "C");
            this.RenameBlock(this.Block2SquaresC, 7, "D");
            this.RenameBlock(this.Block2SquaresD, 7, "E");

            //Create the squares.

            //Firehouses, West, East, South, North
            Square FW = new Square("FW", Resources.FW, 2.5, 2.5, true, false, true);
            Square FE = new Square("FE", Resources.FE, 2.5, 2.5, true, false, true);
            Square FS = new Square("FS", Resources.FS, 2.5, 2.5, true, false, true);
            Square FN = new Square("FN", Resources.FN, 2.5, 2.5, true, false, true);

            switch (this.numBoards)
            {
                case 2:
                    {
                        this.FHs.InsertRange(FHs.Count, new ISquareTypes[] { FW, FE });
                        break;
                    }
                case 3:
                    {
                        this.FHs.InsertRange(FHs.Count, new ISquareTypes[] { FW, FE, FS });
                        break;
                    }
                case 4:
                    {
                        this.FHs.InsertRange(FHs.Count, new ISquareTypes[] { FW, FE, FS, FN });
                        break;
                    }
            }

            //Row A. Top row. No flammable squares.
            Square A1 = new Square("A1", Resources._0_1);
            Square A2 = new Square("A2", Resources._1_1);
            Square A3 = new Square("A3", Resources._2_1);
            Square A4 = new Square("A4", Resources._3_1);
            Square A5 = new Square("A5", Resources._4_1);
            Square A6 = new Square("A6", Resources._5_1);
            Square A7 = new Square("A7", Resources._6_1);
            Square A8 = new Square("A8", Resources._7_1);
            Square A9 = new Square("A9", Resources._8_1);
            Square A10 = new Square("A10", Resources._9_1);
            Square A11 = new Square("A11", Resources._10_1);

            this.RowA.InsertRange(RowA.Count, new ISquareTypes[] { A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11 });

            //Row B. Begin flammable squares now.
            Square B1 = new Square("B1", Resources._0_2);
            Square B6 = new Square("B6", Resources._5_2);
            Square B11 = new Square("B11", Resources._10_2);
            this.RowB.InsertRange(RowB.Count, new ISquareTypes[] { B1, this.Block1SquaresA[0], this.Block1SquaresA[1], this.Block1SquaresA[2], this.Block1SquaresA[3], B6, this.Block2SquaresA[0], this.Block2SquaresA[1], this.Block2SquaresA[2], this.Block2SquaresA[3], B11});

            //Row C.
            Square C1 = new Square("C1", Resources._0_3);
            Square C6 = new Square("C2", Resources._5_3);
            Square C11 = new Square("C3", Resources._10_3);
            this.RowC.InsertRange(RowC.Count, new ISquareTypes[] { C1, this.Block1SquaresB[0], this.Block1SquaresB[1], this.Block1SquaresB[2], this.Block1SquaresB[3], C6, this.Block2SquaresB[0], this.Block2SquaresB[1], this.Block2SquaresB[2], this.Block2SquaresB[3], C11 });

            //Row D.
            Square D1 = new Square("D1", Resources._0_4);
            Square D6 = new Square("D6", Resources._5_4);
            Square D11 = new Square("D11", Resources._10_4);
            this.RowD.InsertRange(RowD.Count, new ISquareTypes[] { D1, this.Block1SquaresC[0], this.Block1SquaresC[1], this.Block1SquaresC[2], this.Block1SquaresC[3], D6, this.Block2SquaresC[0], this.Block2SquaresC[1], this.Block2SquaresC[2], this.Block2SquaresC[3], D11 });

            //Row E.
            Square E1 = new Square("E1", Resources._0_5);
            Square E6 = new Square("E6", Resources._5_5);
            Square E11 = new Square("E11", Resources._10_5);
            this.RowE.InsertRange(RowE.Count, new ISquareTypes[] { E1, this.Block1SquaresD[0], this.Block1SquaresD[1], this.Block1SquaresD[2], this.Block1SquaresD[3], E6, this.Block2SquaresD[0], this.Block2SquaresD[1], this.Block2SquaresD[2], this.Block2SquaresD[3], E11 });

            //Row F.
            Square F1 = new Square("F1", Resources._0_6);
            Square F2 = new Square("F2", Resources._1_6);
            Square F3 = new Square("F3", Resources._2_6);
            Square F4 = new Square("F4", Resources._3_6);
            Square F5 = new Square("F5", Resources._4_6);
            Square F6 = new Square("F6", Resources._5_6);
            Square F7 = new Square("F7", Resources._6_6);
            Square F8 = new Square("F8", Resources._7_6);
            Square F9 = new Square("F9", Resources._8_6);
            Square F10 = new Square("F10", Resources._9_6);
            Square F11 = new Square("F11", Resources._10_6);
            this.RowF.InsertRange(RowF.Count, new ISquareTypes[] { F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11 });

            //Row G.
            if (this.numBoards > 2)
            {
                Square G1 = new Square("G1", Resources._0_7);
                Square G6 = new Square("G6", Resources._5_7);
                Square G11 = new Square("G11", Resources._10_7);
                this.RowG.InsertRange(RowG.Count, new ISquareTypes[] { G1, this.Block3SquaresA[0], this.Block3SquaresA[1], this.Block3SquaresA[2], this.Block3SquaresA[3], G6 });

                //4 Players
                if (this.numBoards > 3)
                {
                    this.RowG.InsertRange(RowG.Count, new ISquareTypes[] { this.Block4SquaresA[0], this.Block4SquaresA[1], this.Block4SquaresA[2], this.Block4SquaresA[3], G11 });
                }
            }

            //Row H.
            if (this.numBoards > 2)
            {
                Square H1 = new Square("H1", Resources._0_8);
                Square H6 = new Square("H6", Resources._5_8);
                Square H11 = new Square("H11", Resources._10_8);
                this.RowH.InsertRange(RowH.Count, new ISquareTypes[] { H1, this.Block3SquaresB[0], this.Block3SquaresB[1], this.Block3SquaresB[2], this.Block3SquaresB[3], H6 });

                //4 Players
                if (this.numBoards > 3)
                {
                    this.RowH.InsertRange(RowH.Count, new ISquareTypes[] { this.Block4SquaresB[0], this.Block4SquaresB[1], this.Block4SquaresB[2], this.Block4SquaresB[3], H11 });
                }
            }

            //Row I.
            if (this.numBoards > 2)
            {
                Square I1 = new Square("I1", Resources._0_9);
                Square I6 = new Square("I6", Resources._5_9);
                Square I11 = new Square("I11", Resources._10_9);
                this.RowI.InsertRange(RowI.Count, new ISquareTypes[] { I1, this.Block3SquaresC[0], this.Block3SquaresC[1], this.Block3SquaresC[2], this.Block3SquaresC[3], I6 });

                //4 Players
                if (this.numBoards > 3)
                {
                    this.RowI.InsertRange(RowI.Count, new ISquareTypes[] { this.Block4SquaresC[0], this.Block4SquaresC[1], this.Block4SquaresC[2], this.Block4SquaresC[3], I11 });
                }
            }

            //Row J.
            if (this.numBoards > 2)
            {
                Square J1 = new Square("J1", Resources._0_10);
                Square J6 = new Square("J6", Resources._5_10);
                Square J11 = new Square("J11", Resources._10_10);
                this.RowJ.InsertRange(RowJ.Count, new ISquareTypes[] { J1, this.Block3SquaresD[0], this.Block3SquaresD[1], this.Block3SquaresD[2], this.Block3SquaresD[3], J6 });

                //4 Players
                if (this.numBoards > 3)
                {
                    this.RowJ.InsertRange(RowJ.Count, new ISquareTypes[] { this.Block4SquaresD[0], this.Block4SquaresD[1], this.Block4SquaresD[2], this.Block4SquaresD[3], J11 });
                }
            }

            //Row K.
            if (this.numBoards > 2)
            {
                Square K1 = new Square("K1", Resources._0_11);
                Square K2 = new Square("K2", Resources._1_11);
                Square K3 = new Square("K3", Resources._2_11);
                Square K4 = new Square("K4", Resources._3_11);
                Square K5 = new Square("K5", Resources._4_11);
                Square K6 = new Square("K6", Resources._5_11);

                this.RowK.InsertRange(RowK.Count, new ISquareTypes[] { K1, K2, K3, K4, K5, K6 });

                //4 Players ONLY
                if (this.numBoards == 4)
                {
                    Square K7 = new Square("K7", Resources._6_11);
                    Square K8 = new Square("K8", Resources._7_11);
                    Square K9 = new Square("K9", Resources._8_11);
                    Square K10 = new Square("K10", Resources._9_11);
                    Square K11 = new Square("K11", Resources._10_11);
                    this.RowK.InsertRange(RowK.Count, new ISquareTypes[] { K7, K8, K9, K10, K11 });
                }
            }

            //Now let's add these rows to the board.
            this.NewBoard.Add(RowA);
            this.NewBoard.Add(RowB);
            this.NewBoard.Add(RowC);
            this.NewBoard.Add(RowD);
            this.NewBoard.Add(RowE);
            this.NewBoard.Add(RowF);

            if (this.numBoards > 2)
            {
                this.NewBoard.Add(RowG);
                this.NewBoard.Add(RowH);
                this.NewBoard.Add(RowI);
                this.NewBoard.Add(RowJ);
                this.NewBoard.Add(RowK);
            }

            //Tell the squares which squares are around them.
            this.FindNeighbors();

            //Assign each square its neighboring squares.
            this.AssignNeighbors();
        }
예제 #3
0
파일: Board.cs 프로젝트: roric32/inferno
        public bool BlockContainsWreckage(Block block)
        {
            List<List<ISquareTypes>> BlockRows = new List<List<ISquareTypes>>();

            BlockRows.Add(block.GetRowA());
            BlockRows.Add(block.GetRowB());
            BlockRows.Add(block.GetRowC());
            BlockRows.Add(block.GetRowD());

            foreach (List<ISquareTypes> Row in BlockRows)
            {

                foreach (ISquareTypes Square in Row)
                {
                    if (Square.IsWreckage == true)
                    {
                        return true;
                    }
                }

            }

            return false;
        }
예제 #4
0
파일: Game.cs 프로젝트: roric32/inferno
        private void CreateCityBlocks()
        {
            //Actually create the city blocks here.

            Block Claw = new Block("Claw");
            Block Claw2 = new Block("Claw");
            Block Donut = new Block("Donut");
            Block EasyBoard1 = new Block("Easy Board 1");
            Block EasyBoard2 = new Block("Easy Board 2");
            Block Funky = new Block("Funky");
            Block LShaped = new Block("L Shaped");
            Block LShaped2 = new Block("L Shaped");
            Block Monster = new Block("Monster");
            Block UpInFlames = new Block("Up In Flames");

            //Add the cityblocks to the list of all CityBlocks.

            this.CityBlocks.Add(Claw);
            this.CityBlocks.Add(Donut);
            this.CityBlocks.Add(EasyBoard1);
            this.CityBlocks.Add(EasyBoard2);
            this.CityBlocks.Add(Funky);
            this.CityBlocks.Add(LShaped);
            this.CityBlocks.Add(Monster);
            this.CityBlocks.Add(UpInFlames);

            //Here we're going to set the different possible CityBlock player/difficulty combinations.
            List<Block> TwoPlayerRegular1 = new List<Block>();
            TwoPlayerRegular1.Add(UpInFlames);
            TwoPlayerRegular1.Add(EasyBoard1);

            List<Block> TwoPlayerHard1 = new List<Block>();
            TwoPlayerHard1.Add(Monster);
            TwoPlayerHard1.Add(Donut);

            List<Block> TwoPlayerBlazing1 = new List<Block>();
            TwoPlayerBlazing1.Add(UpInFlames);
            TwoPlayerBlazing1.Add(Monster);
            List<Block> TwoPlayerBlazing2 = new List<Block>();
            TwoPlayerBlazing1.Add(LShaped);
            TwoPlayerBlazing1.Add(Claw);

            List<Block> ThreePlayerRegular1 = new List<Block>();
            ThreePlayerRegular1.Add(UpInFlames);
            ThreePlayerRegular1.Add(EasyBoard1);
            ThreePlayerRegular1.Add(LShaped);

            List<Block> ThreePlayerHard1 = new List<Block>();
            ThreePlayerHard1.Add(UpInFlames);
            ThreePlayerHard1.Add(Monster);
            ThreePlayerHard1.Add(Funky);
            List<Block> ThreePlayerHard2 = new List<Block>();
            ThreePlayerHard2.Add(LShaped);
            ThreePlayerHard2.Add(Claw);
            ThreePlayerHard2.Add(Funky);
            List<Block> ThreePlayerHard3 = new List<Block>();
            ThreePlayerHard3.Add(Monster);
            ThreePlayerHard3.Add(Donut);
            ThreePlayerHard3.Add(LShaped);

            List<Block> ThreePlayerBlazing1 = new List<Block>();
            ThreePlayerBlazing1.Add(UpInFlames);
            ThreePlayerBlazing1.Add(Monster);
            ThreePlayerBlazing1.Add(LShaped);
            List<Block> ThreePlayerBlazing2 = new List<Block>();
            ThreePlayerBlazing2.Add(LShaped);
            ThreePlayerBlazing2.Add(Claw);
            ThreePlayerBlazing2.Add(LShaped2);

            List<Block> FourPlayerRegular1 = new List<Block>();
            FourPlayerRegular1.Add(UpInFlames);
            FourPlayerRegular1.Add(Monster);
            FourPlayerRegular1.Add(LShaped);
            FourPlayerRegular1.Add(EasyBoard2);
            List<Block> FourPlayerRegular2 = new List<Block>();
            FourPlayerRegular2.Add(UpInFlames);
            FourPlayerRegular2.Add(EasyBoard1);
            FourPlayerRegular2.Add(LShaped);
            FourPlayerRegular2.Add(Claw);
            List<Block> FourPlayerRegular3 = new List<Block>();
            FourPlayerRegular3.Add(LShaped);
            FourPlayerRegular3.Add(Claw);
            FourPlayerRegular3.Add(LShaped2);
            FourPlayerRegular3.Add(EasyBoard2);

            List<Block> FourPlayerHard1 = new List<Block>();
            FourPlayerHard1.Add(LShaped);
            FourPlayerHard1.Add(Claw);
            FourPlayerHard1.Add(Funky);
            FourPlayerHard1.Add(Claw2);
            List<Block> FourPlayerHard2 = new List<Block>();
            FourPlayerHard2.Add(UpInFlames);
            FourPlayerHard2.Add(Monster);
            FourPlayerHard2.Add(Funky);
            FourPlayerHard2.Add(Claw);
            List<Block> FourPlayerHard3 = new List<Block>();
            FourPlayerHard3.Add(Donut);
            FourPlayerHard3.Add(Monster);
            FourPlayerHard3.Add(Funky);
            FourPlayerHard3.Add(Claw);

            List<Block> FourPlayerBlazing1 = new List<Block>();
            FourPlayerBlazing1.Add(UpInFlames);
            FourPlayerBlazing1.Add(Monster);
            FourPlayerBlazing1.Add(LShaped);
            FourPlayerBlazing1.Add(Claw);
            List<Block> FourPlayerBlazing2 = new List<Block>();
            FourPlayerBlazing2.Add(LShaped);
            FourPlayerBlazing2.Add(Claw);
            FourPlayerBlazing2.Add(LShaped2);
            FourPlayerBlazing2.Add(Claw2);

            //Add all our two player difficulties
            this.TwoPlayerRegularBlocks.Add(TwoPlayerRegular1);
            this.TwoPlayerHardBlocks.Add(TwoPlayerHard1);
            this.TwoPlayerBlazingBlocks.Add(TwoPlayerBlazing1);
            this.TwoPlayerBlazingBlocks.Add(TwoPlayerBlazing2);

            //Add all our three player difficulties
            this.ThreePlayerRegularBlocks.Add(ThreePlayerRegular1);
            this.ThreePlayerHardBlocks.Add(ThreePlayerHard1);
            this.ThreePlayerHardBlocks.Add(ThreePlayerHard2);
            this.ThreePlayerHardBlocks.Add(ThreePlayerHard3);
            this.ThreePlayerBlazingBlocks.Add(ThreePlayerBlazing1);
            this.ThreePlayerBlazingBlocks.Add(ThreePlayerBlazing2);

            //Add all our four player difficulties
            this.FourPlayerRegularBlocks.Add(FourPlayerRegular1);
            this.FourPlayerRegularBlocks.Add(FourPlayerRegular2);
            this.FourPlayerRegularBlocks.Add(FourPlayerRegular3);
            this.FourPlayerHardBlocks.Add(FourPlayerHard1);
            this.FourPlayerHardBlocks.Add(FourPlayerHard2);
            this.FourPlayerHardBlocks.Add(FourPlayerHard3);
            this.FourPlayerBlazingBlocks.Add(FourPlayerBlazing1);
            this.FourPlayerBlazingBlocks.Add(FourPlayerBlazing2);
        }