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>(); }
#pragma warning restore 4014 #pragma warning disable 4014 public static void PlayerGet(string cardId, bool fromPlay, int turn) { PlayerHandCount++; if (cardId == "GAME_005" && turn == 0) { OpponentHasCoin = false; OpponentHandMarks[DefaultCoinPosition] = CardMark.None; OpponentHandAge[DefaultCoinPosition] = -1; OpponentStolenCardsInformation[DefaultCoinPosition] = null; Logger.WriteLine("Player got the coin", "Hearthstone"); } var fromSetAside = SetAsideCards.Any(id => cardId == id); if (fromSetAside) { Logger.WriteLine("Got card from setaside: " + cardId, "Game"); foreach (var c in SetAsideCards) { PlayerDeckDiscard(c); } SetAsideCards.Clear(); } var card = PlayerDeck.FirstOrDefault(c => c.Id == cardId && (!c.IsStolen || fromSetAside)); if (card != null) { card.InHandCount++; card.JustDrawn(); } else if (Config.Instance.ShowPlayerGet && !fromPlay) { var drawnCard = PlayerDrawn.FirstOrDefault(c => c.Id == cardId && c.IsStolen); if (drawnCard != null) { drawnCard.Count++; } else { drawnCard = GetCardFromId(cardId); drawnCard.IsStolen = true; PlayerDrawn.Add(drawnCard); } drawnCard.InHandCount++; drawnCard.JustDrawn(); var deckCard = PlayerDeck.FirstOrDefault(c => c.Id == cardId && c.IsStolen); if (deckCard != null) { deckCard.Count++; deckCard.InHandCount++; LogDeckChange(false, deckCard, false); } else { deckCard = GetCardFromId(cardId); deckCard.InHandCount++; deckCard.IsStolen = true; PlayerDeck.Add(deckCard); deckCard.JustDrawn(); } } }