Esempio n. 1
0
        private List <GameInstruction> SwapHalf()
        {
            List <GameInstruction> instructions = new List <GameInstruction>();

            if (partOfRound == HalfOfRound.FirstHalf)
            {
                partOfRound    = HalfOfRound.SecondHalf;
                sectionOfRound = SectionOfRound.Settlements;
                game.CurrentPlayingTeam.Moves = 0;
                var switchI = new GameInstruction($"Switching turns", BothChannels);
                instructions.Add(switchI);
                game.SwitchTeamTurn();
                game.CurrentPlayingTeam.Moves = 6 - currentDieRoll;
                if (currentDieRoll != 6)
                {
                    if (debug)
                    {
                        var i = new GameInstruction($"{CurrentPlayerName} can take {6 - currentDieRoll} {(6 - currentDieRoll == 1 ? "resource" : "resources")}.", OutputChannel);
                        instructions.Add(i);
                    }
                    else
                    {
                        var playerI      = new GameInstruction($"It is your turn. You can take {6 - currentDieRoll} {(6 - currentDieRoll == 1 ? "resource" : "resources")}.", OutputChannel);
                        var otherPlayerI = new GameInstruction($"It is the enemy's turn. The enemy can take {6 - currentDieRoll} {(6 - currentDieRoll == 1 ? "resource" : "resources")}.", OtherChannel);
                        instructions.Add(playerI);
                        instructions.Add(otherPlayerI);
                    }
                    instructions.AddRange(OutputBeginningOfRound());
                }
                else
                {
                    if (debug)
                    {
                        var i = new GameInstruction($"{CurrentPlayerName} cannot play this turn.", OutputChannel);
                        instructions.Add(i);
                    }
                    else
                    {
                        var playerI      = new GameInstruction($"You cannot play this turn.", OutputChannel);
                        var otherPlayerI = new GameInstruction($"The enemy cannot play this turn.", OtherChannel);
                        instructions.Add(playerI);
                        instructions.Add(otherPlayerI);
                    }
                    instructions.AddRange(OutputEndOfRound());
                }
            }
            else
            {
                instructions.AddRange(OutputEndOfRound());
            }
            return(instructions);
        }
Esempio n. 2
0
        public List <GameInstruction> StartYear()
        {
            WaitingForRoundResponse   = false;
            WaitingForDieRollResponse = true;
            partOfRound    = HalfOfRound.FirstHalf;
            sectionOfRound = SectionOfRound.Settlements;
            List <GameInstruction> instructions = new List <GameInstruction>();

            if (!PlayersHaveDie)
            {
                int roll = game.RollDie();
                return(ProcessDieRoll(roll.ToString()));
            }
            else
            {
                var i = new GameInstruction($"Please roll your die and then enter the die roll", OutputChannel);
                instructions.Add(i);
            }
            return(instructions);
        }
Esempio n. 3
0
        public List <GameInstruction> OutputEndOfRound()
        {
            List <GameInstruction> instructions = new List <GameInstruction>();

            game.CurrentPlayingTeam.Moves = 0;
            game.Advance();
            var pointAnnoucment = new GameInstruction($"Red: {game.GetTeamPopulationTotalString(Constants.Teams.Red)} ({game.GetTeamPopulationDifferenceString(Constants.Teams.Red)}). Blue: {game.GetTeamPopulationTotalString(Constants.Teams.Blue)} ({game.GetTeamPopulationDifferenceString(Constants.Teams.Blue)}).", BothChannels);

            instructions.Add(pointAnnoucment);
            if (game.RedTeam.Population >= Constants.WinningScore &&
                game.BlueTeam.Population >= Constants.WinningScore)
            {
                if (game.RedTeam.Population > game.BlueTeam.Population)
                {
                    var i = new GameInstruction("The Red side has won the game.", BothChannels);
                    instructions.Add(i);
                }
                else if (game.RedTeam.Population < game.BlueTeam.Population)
                {
                    var i = new GameInstruction("The Blue side has won the game.", BothChannels);
                    instructions.Add(i);
                }
                else
                {
                    var i = new GameInstruction("The game has ended in a draw.", BothChannels);
                    instructions.Add(i);
                }
                GameIsOver = true;
                return(instructions);
            }
            else if (game.RedTeam.Population >= Constants.WinningScore)
            {
                var i = new GameInstruction("The Red side has won the game.", BothChannels);
                instructions.Add(i);
                GameIsOver = true;
                return(instructions);
            }
            else if (game.BlueTeam.Population >= Constants.WinningScore)
            {
                var i = new GameInstruction("The Blue side has won the game.", BothChannels);
                instructions.Add(i);
                GameIsOver = true;
                return(instructions);
            }
            if (game.ResolveSwap)
            {
                var swapAnnoucement = new GameInstruction("PLEASE SWITCH SIDES. YOU ARE NOW ON THE OTHER TEAM. MOVE POSITIONS. REMEMBER, G.O.D. IS ON YOUR SIDE.", BothChannels);
                instructions.Add(swapAnnoucement);
                if (!game.AlreadySwapped)
                {
                    var gameChangeAnnouncement = new GameInstruction("Points are now people. When you bomb a tile you kill all people living the affected settlements.", BothChannels);
                    instructions.Add(gameChangeAnnouncement);
                    var newScoreAnnouncement = new GameInstruction($"You are now trying to reach a population of {Constants.WinningScore}.", BothChannels);
                    instructions.Add(newScoreAnnouncement);
                    var drawI = new GameInstruction($"You can now initiate a draw by sending draw. Both sides must agree to draw on the same turn. You can propose a draw every turn.", BothChannels);
                    instructions.Add(drawI);
                }
                game.ResolveSwap    = false;
                game.AlreadySwapped = true;
                game.StartKilingPopulation();
            }
            instructions.AddRange(ResetDraw());
            partOfRound    = HalfOfRound.FirstHalf;
            sectionOfRound = SectionOfRound.Settlements;
            instructions.AddRange(StartYear());
            return(instructions);
        }