예제 #1
0
        public void FightRound(bool RollDice = true)
        {
            Round  round = new Round();
            Random die   = new Random();

            round.PlayerRoll   = 0;
            round.OpponentRoll = 0;

            if (RollDice)
            {
                round.PlayerRoll   = die.Next(1, 7);
                round.OpponentRoll = die.Next(1, 7);
            }

            int playerTotal   = round.PlayerRoll + Player.Strength;
            int opponentTotal = round.OpponentRoll + Opponent.Strength;

            Console.WriteLine($"\nYou rolled: {round.PlayerRoll}\nOpponet Rolled: {round.OpponentRoll}\nYour total vs opponent total: {playerTotal} versus {opponentTotal}");

            if (playerTotal > opponentTotal) //Player wins
            {
                round.Winner = Player;
                round.Loser  = Opponent;

                Console.WriteLine($"\n{Player.Name} strike {Opponent.Name}, you win the round");
            }
            else if (opponentTotal > playerTotal) //Opponent wins
            {
                round.Winner = Opponent;
                round.Loser  = Player;

                Console.WriteLine($"\n{Opponent.Name} strike {Player.Name}, you lose the round");
            }
            else //Draw
            {
                round.IsDraw = true;

                Console.WriteLine("\nNone of you found an opportunity to strike, round is a draw");
            }

            if (!round.IsDraw)
            {
                round.Loser.Health -= round.Winner.Damage;
                round.DamageDone    = round.Winner.Damage;

                Console.WriteLine($"\n{round.Loser.Name} Current HP: {round.Loser.Health}");
                Console.WriteLine($"{round.Winner.Name} Damage Done: {round.DamageDone}");

                if (round.Loser.IsDead)
                {
                    round.IsFinal = true;
                    IsFinished    = true;
                }
            }

            BattleLog.Add(round);
        }
예제 #2
0
        private void SetColor(Tuple <int, int> point)
        {
            effect.Play();
            reversi.SetStone(point.Item1, point.Item2, Player.NowPlayer);
            Player.ChangePlayer();
            BoardUI.EnableColorPointList = reversi.Board.GetEnableColorPointList(Black);
            BoardUI.ReRendering();
            RefreshInfomatinText();
            var latestInput = new ColorData(new Tuple <int, int>(point.Item1, point.Item2), 0);

            BoardUI.BeforeInputColor = latestInput;
            BattleLog.Add(new BattleLoginTurn {
                player = Player.NowPlayer, PositionList = reversi.Board.GetPieceReversiAllDirection(point.Item1, point.Item2, Player.NowPlayer)
            });

            CPUPieceCount.Value    = reversi.Board.CountWhiteColor();
            PlayerPieceCount.Value = reversi.Board.CountBlackColor();
        }
예제 #3
0
        }         // PrepareBattle()

        public static void AddToLog(string text)
        {
            BattleLog.Add(text);
        }         // AddToLog()