public void Reset(bool resetStats = true) { Log.Info("-------- Reset ---------"); Player.Reset(); Opponent.Reset(); if (!_matchInfoCacheInvalid && MatchInfo?.LocalPlayer != null && MatchInfo.OpposingPlayer != null) { UpdatePlayers(); } ProposedAttacker = 0; ProposedDefender = 0; Entities.Clear(); SavedReplay = false; SecretsManager.Reset(); _spectator = null; _currentGameMode = GameMode.None; _currentGameType = GameType.GT_UNKNOWN; _currentFormat = FormatType.FT_UNKNOWN; if (!IsInMenu && resetStats) { CurrentGameStats = new GameStats(GameResult.None, "", "") { PlayerName = "", OpponentName = "", Region = CurrentRegion } } ; PowerLog.Clear(); if (Core.Game != null && Core.Overlay != null) { Core.UpdatePlayerCards(true); Core.UpdateOpponentCards(true); } }
public void Reset() { var game = new MockGame { CurrentGameType = GameType.GT_RANKED, CurrentFormat = Format.Wild }; var secretsManager = new SecretsManager(game, new MockArenaSettings()); var entity = new Entity(0); entity.SetTag(GameTag.SECRET, 1); entity.SetTag(GameTag.CLASS, (int)CardClass.PALADIN); secretsManager.NewSecret(entity); Assert.AreEqual(1, secretsManager.Secrets.Count); secretsManager.Reset(); Assert.AreEqual(0, secretsManager.Secrets.Count); }
public void OnSecretsChangedEvent() { var game = new MockGame { CurrentGameType = GameType.GT_RANKED, CurrentFormat = Format.Wild }; var callbackCount = 0; var secretsManager = new SecretsManager(game, new MockArenaSettings()); secretsManager.OnSecretsChanged += secrets => callbackCount += 1; var entity = new Entity(0); entity.SetTag(GameTag.SECRET, 1); entity.SetTag(GameTag.CLASS, (int)CardClass.PALADIN); secretsManager.NewSecret(entity); Assert.AreEqual(1, callbackCount); secretsManager.Toggle(Paladin.Avenge); Assert.AreEqual(2, callbackCount); secretsManager.Exclude(new List <MultiIdCard> { Paladin.CompetitiveSpirit, Paladin.GetawayKodo }); Assert.AreEqual(3, callbackCount); secretsManager.Toggle(Paladin.Avenge); Assert.AreEqual(4, callbackCount); secretsManager.RemoveSecret(entity); Assert.AreEqual(5, callbackCount); secretsManager.Reset(); Assert.AreEqual(6, callbackCount); }