예제 #1
0
 private void triggerGameEnd(Player.PlayerSide winningPlayerSide, bool winByNotEnoughGuilt, int finalScore)
 {
     doNotifyGameEnd                     = true;
     gameResultArg                       = new GameResultArgs();
     gameResultArg.winningPlayer         = winningPlayerSide;
     gameResultArg.notEnoughGuiltVictory = winByNotEnoughGuilt;
     gameResultArg.finalScore            = finalScore;
 }
예제 #2
0
 public void InitInfo(Player.PlayerSide winningPlayer, bool notEnoughGuiltVictory, int finalScore)
 {
     if (notEnoughGuiltVictory)
     {
         text.text = "Defense player has won by not enough guilt";
     }
     else
     {
         text.text = winningPlayer + " has won with " + finalScore + " points";
     }
 }
예제 #3
0
        public CardTemplate(string _name, int _actionPts, Player.PlayerSide _side, bool _isAttorney = false)
        {
            Name       = _name;
            ActionPts  = _actionPts;
            side       = _side;
            isAttorney = _isAttorney;

            SelectionEvents = new List <CardEffectPair>();
            TrialEvents     = new List <CardEffectPair>();
            SummationEvents = new List <CardEffectPair>();
        }
예제 #4
0
 private void onGameEnd(Player.PlayerSide winningPlayer, bool notEnoughGuiltVictory, int finalScore)
 {
     ViewManager.Instance.DisplayView(ViewManager.PopupType.GameResult, false, winningPlayer, notEnoughGuiltVictory, finalScore);
 }
예제 #5
0
 public bool IsVisibleToPlayer(Player.PlayerSide side)
 {
     return(seenStatus[side]);
 }
예제 #6
0
 public void Peek(Player.PlayerSide side)
 {
     seenStatus[side] = true;
 }
예제 #7
0
        private void logEndOfGame(Player.PlayerSide winningPlayerSide, bool winByNotEnoughGuilt, int finalScore)
        {
            string str = winningPlayerSide + " won with " + (winByNotEnoughGuilt ? "not enough guilt" : finalScore + " points");

            FileLogger.Instance.Log(str);
        }
예제 #8
0
 public Player GetOtherPlayer(Player curPlayer)
 {
     Player.PlayerSide oppositeSide = (curPlayer.Side == Player.PlayerSide.Defense) ? Player.PlayerSide.Prosecution : Player.PlayerSide.Defense;
     return(players[oppositeSide]);
 }
예제 #9
0
 public Player GetPlayerOfSide(Player.PlayerSide side)
 {
     return(players[side]);
 }
예제 #10
0
        private void mainLogic()
        {
            if (game.NotifyStartOfTurn != null)
            {
                game.NotifyStartOfTurn();
            }

            // Reveal all jury aspects.
            foreach (Jury jury in game.Board.Juries)
            {
                jury.Aspects.ForEach(a => a.Reveal());
            }

            EvidenceTrack guiltTrack = game.Board.GetGuiltTrack();

            if (guiltTrack.Value < 2)
            {
                if (game.NotifyGameEnd != null)
                {
                    game.NotifyGameEnd(Player.PlayerSide.Defense, true, 0);
                }

                goto GameEnd;
            }

            handleGuiltTrackEffect(game);
            handleInsanityTrackEffect(game);

            game.Board.Juries.ForEach(j => j.RevealAllTraits());

            List <Jury> usedJuries = new List <Jury>();

            Dictionary <Player.PlayerSide, bool> playerSidePassed = new Dictionary <Player.PlayerSide, bool>();

            while (playerSidePassed.Count < 2)
            {
                List <Jury> lockedJuries;

                if (curPlayer.Side == Player.PlayerSide.Prosecution)
                {
                    lockedJuries = game.Board.Juries.FindAll(j => j.SwayTrack.IsLocked && j.SwayTrack.Value == j.SwayTrack.MaxValue);
                }
                else
                {
                    lockedJuries = game.Board.Juries.FindAll(j => j.SwayTrack.IsLocked && j.SwayTrack.Value == j.SwayTrack.MinValue);
                }

                lockedJuries = lockedJuries.Except(usedJuries).ToList();

                if (lockedJuries.Count > 0)
                {
                    Jury usedJury = performJuryForDeliberation(lockedJuries, curPlayer);

                    usedJuries.Add(usedJury);
                }
                else
                {
                    playerSidePassed[curPlayer.Side] = true;
                }

                if (!playerSidePassed.ContainsKey(game.GetOtherPlayer(curPlayer).Side))
                {
                    passToNextPlayer();
                }
            }

            // Calculate winning player.
            int totalScore = 0;

            foreach (Jury jury in game.Board.Juries)
            {
                int score = jury.CalculateGuiltScore();
                totalScore += score;
            }

            Player.PlayerSide winningPlayer = totalScore >= GameConstants.PROSECUTION_SCORE_THRESHOLD ? Player.PlayerSide.Prosecution : Player.PlayerSide.Defense;

            if (game.NotifyGameEnd != null)
            {
                game.NotifyGameEnd(winningPlayer, false, totalScore);
            }

GameEnd:
            {
                GotoNextState();
            }
        }