Exemplo n.º 1
0
        public void Reset(bool resetStats = true)
        {
            Logger.WriteLine(">>>>>>>>>>> Reset <<<<<<<<<<<", "Game");

            ReplayMaker.Reset();
            PlayerDrawn.Clear();
            PlayerDrawnIdsTotal.Clear();
            Entities.Clear();
            PlayerId            = -1;
            OpponentId          = -1;
            SavedReplay         = false;
            PlayerHandCount     = 0;
            PlayerFatigueCount  = 0;
            OpponentSecretCount = 0;
            OpponentCards.Clear();
            OpponentHandCount              = 0;
            OpponentFatigueCount           = 0;
            OpponentDeckCount              = 30;
            PlayerDeckSize                 = 30;
            SecondToLastUsedId             = null;
            OpponentHandAge                = new int[MaxHandSize];
            OpponentHandMarks              = new CardMark[MaxHandSize];
            OpponentStolenCardsInformation = new Card[MaxHandSize];
            OpponentSecrets.ClearSecrets();
            NoMatchingDeck = false;
            _playingAs     = null;

            for (var i = 0; i < MaxHandSize; i++)
            {
                OpponentHandAge[i]   = -1;
                OpponentHandMarks[i] = CardMark.None;
            }

            // Assuming opponent has coin, corrected if we draw it
            OpponentHandMarks[DefaultCoinPosition] = CardMark.Coin;
            OpponentHandAge[DefaultCoinPosition]   = 0;
            OpponentHasCoin = true;

            SetAsideCards.Clear();
            OpponentReturnedToDeck.Clear();

            //if(CurrentGameMode == GameMode.Ranked) //otherwise switching from playing ranked to casual causes problems
            //	CurrentGameMode = GameMode.Casual;


            if (!IsInMenu && resetStats)
            {
                if (CurrentGameMode != GameMode.Spectator)
                {
                    CurrentGameMode = GameMode.None;
                }
                CurrentGameStats = new GameStats(GameResult.None, PlayingAgainst, PlayingAs)
                {
                    PlayerName   = PlayerName,
                    OpponentName = OpponentName,
                    Region       = CurrentRegion
                };
            }
            hsLogLines = new List <string>();
        }