public void GameType_Format() { var game = new MockGame { CurrentGameType = GameType.GT_RANKED, CurrentFormat = Format.Wild }; var secretsManager = new SecretsManager(game); var paladinEntity = new Entity(0); paladinEntity.SetTag(GameTag.SECRET, 1); paladinEntity.SetTag(GameTag.CLASS, (int)CardClass.PALADIN); secretsManager.NewSecret(paladinEntity); Assert.AreEqual(1, secretsManager.Secrets.Count); var mageEntity = new Entity(1); mageEntity.SetTag(GameTag.SECRET, 1); mageEntity.SetTag(GameTag.CLASS, (int)CardClass.MAGE); secretsManager.NewSecret(mageEntity); Assert.AreEqual(2, secretsManager.Secrets.Count); var hunterEntity = new Entity(2); hunterEntity.SetTag(GameTag.SECRET, 1); hunterEntity.SetTag(GameTag.CLASS, (int)CardClass.HUNTER); secretsManager.NewSecret(hunterEntity); Assert.AreEqual(3, secretsManager.Secrets.Count); var wildSecrets = Paladin.All.Concat(Mage.All).Concat(Hunter.All).ToList(); var cards = secretsManager.GetSecretList(); Assert.AreEqual(wildSecrets.Count, cards.Count); foreach (var secret in wildSecrets) { Assert.IsNotNull(cards.SingleOrDefault(c => c.Id == secret)); } game.CurrentFormat = Format.Standard; cards = secretsManager.GetSecretList(); var wildSets = Helper.WildOnlySets; var standardSecrets = wildSecrets.Where(x => !wildSets.Contains(Database.GetCardFromId(x).Set)).ToList(); Assert.AreEqual(standardSecrets.Count, cards.Count); foreach (var secret in standardSecrets) { Assert.IsNotNull(cards.SingleOrDefault(c => c.Id == secret)); } game.CurrentGameType = GameType.GT_ARENA; game.CurrentFormat = Format.Wild; // Arena format is Wild cards = secretsManager.GetSecretList(); var arenaSecrets = standardSecrets.Where(x => !ArenaExcludes.Contains(x)).ToList(); Assert.AreEqual(arenaSecrets.Count, cards.Count); foreach (var secret in arenaSecrets) { Assert.IsNotNull(cards.SingleOrDefault(c => c.Id == secret)); } }
public void CountAdjustment() { var game = new MockGame { CurrentGameType = GameType.GT_RANKED, CurrentFormat = Format.Wild }; Entity RevealedSecret(int id) { var entity = new Entity(id); entity.SetTag(GameTag.SECRET, 1); entity.SetTag(GameTag.CLASS, (int)CardClass.PALADIN); entity.SetTag(GameTag.CONTROLLER, game.Opponent.Id); entity.CardId = Paladin.Repentance; return(entity); } game.Entities.Add(0, RevealedSecret(0)); var createdSecret = RevealedSecret(1); createdSecret.Info.Created = true; game.Entities.Add(1, createdSecret); var secretsManager = new SecretsManager(game); var paladinEntity = new Entity(2); paladinEntity.SetTag(GameTag.SECRET, 1); paladinEntity.SetTag(GameTag.CLASS, (int)CardClass.PALADIN); secretsManager.NewSecret(paladinEntity); Assert.AreEqual(1, secretsManager.Secrets.Count); var cards = secretsManager.GetSecretList(); Assert.IsNotNull(cards.SingleOrDefault(c => c.Id == Paladin.Repentance && c.Count == 1)); game.Entities.Add(3, RevealedSecret(3)); cards = secretsManager.GetSecretList(); Assert.IsNotNull(cards.SingleOrDefault(c => c.Id == Paladin.Repentance && c.Count == 0)); game.CurrentFormat = Format.Standard; cards = secretsManager.GetSecretList(); Assert.IsNotNull(cards.SingleOrDefault(c => c.Id == Paladin.Repentance && c.Count == 0)); game.CurrentGameType = GameType.GT_ARENA; cards = secretsManager.GetSecretList(); Assert.IsNotNull(cards.SingleOrDefault(c => c.Id == Paladin.Repentance && c.Count == 1)); paladinEntity.Info.Created = true; cards = secretsManager.GetSecretList(); Assert.IsNotNull(cards.SingleOrDefault(c => c.Id == Paladin.Repentance && c.Count == 1)); game.CurrentGameType = GameType.GT_RANKED; cards = secretsManager.GetSecretList(); Assert.IsNotNull(cards.SingleOrDefault(c => c.Id == Paladin.Repentance && c.Count == 1)); game.CurrentFormat = Format.Wild; cards = secretsManager.GetSecretList(); Assert.IsNotNull(cards.SingleOrDefault(c => c.Id == Paladin.Repentance && c.Count == 1)); }
public void Toggle_MultiClass() { var game = new MockGame { CurrentGameType = GameType.GT_RANKED, CurrentFormat = Format.Wild }; var secretsManager = new SecretsManager(game); var paladinEntity = new Entity(0); paladinEntity.SetTag(GameTag.SECRET, 1); paladinEntity.SetTag(GameTag.CLASS, (int)CardClass.PALADIN); secretsManager.NewSecret(paladinEntity); Assert.AreEqual(1, secretsManager.Secrets.Count); var mageEntity = new Entity(1); mageEntity.SetTag(GameTag.SECRET, 1); mageEntity.SetTag(GameTag.CLASS, (int)CardClass.MAGE); secretsManager.NewSecret(mageEntity); Assert.AreEqual(2, secretsManager.Secrets.Count); var hunterEntity = new Entity(2); hunterEntity.SetTag(GameTag.SECRET, 1); hunterEntity.SetTag(GameTag.CLASS, (int)CardClass.HUNTER); secretsManager.NewSecret(hunterEntity); Assert.AreEqual(3, secretsManager.Secrets.Count); var allSecrets = Paladin.All.Concat(Mage.All).Concat(Hunter.All).ToList(); var cards = secretsManager.GetSecretList(); foreach (var card in cards) { Assert.AreEqual(1, card.Count); } foreach (var id in allSecrets) { secretsManager.Toggle(id); } cards = secretsManager.GetSecretList(); foreach (var card in cards) { Assert.AreEqual(0, card.Count); } foreach (var id in allSecrets) { secretsManager.Toggle(id); } cards = secretsManager.GetSecretList(); foreach (var card in cards) { Assert.AreEqual(1, card.Count); } }
public void GameType_Format() { var game = new MockGame { CurrentGameType = GameType.GT_RANKED, CurrentFormat = Format.Wild }; var settings = new MockArenaSettings(); var secretsManager = new SecretsManager(game, settings); var paladinEntity = new Entity(0); paladinEntity.SetTag(GameTag.SECRET, 1); paladinEntity.SetTag(GameTag.CLASS, (int)CardClass.PALADIN); secretsManager.NewSecret(paladinEntity); Assert.AreEqual(1, secretsManager.Secrets.Count); var mageEntity = new Entity(1); mageEntity.SetTag(GameTag.SECRET, 1); mageEntity.SetTag(GameTag.CLASS, (int)CardClass.MAGE); secretsManager.NewSecret(mageEntity); Assert.AreEqual(2, secretsManager.Secrets.Count); var hunterEntity = new Entity(2); hunterEntity.SetTag(GameTag.SECRET, 1); hunterEntity.SetTag(GameTag.CLASS, (int)CardClass.HUNTER); secretsManager.NewSecret(hunterEntity); Assert.AreEqual(3, secretsManager.Secrets.Count); var allSecrets = Paladin.All.Where(x => x != Paladin.HandOfSalvation) .Concat(Mage.All).Concat(Hunter.All).ToList(); var cards = secretsManager.GetSecretList(); Assert.AreEqual(allSecrets.Count, cards.Count); foreach (var secret in allSecrets) { Assert.IsNotNull(cards.SingleOrDefault(c => secret == c.Id)); } game.CurrentFormat = Format.Standard; cards = secretsManager.GetSecretList(); var standardSecrets = allSecrets.Where(x => x.IsStandard).ToList(); Assert.AreEqual(standardSecrets.Count(), cards.Count); foreach (var secret in standardSecrets) { Assert.IsNotNull(cards.SingleOrDefault(c => secret == c.Id)); } game.CurrentGameType = GameType.GT_ARENA; game.CurrentFormat = Format.Wild; // Arena format is Wild cards = secretsManager.GetSecretList(); var bannedSecrets = settings.BannedSecrets.Select(x => new MultiIdCard(x)); var arenaSecrets = allSecrets.Concat(settings.ExclusiveSecrets.Select(x => new MultiIdCard(x))).Where(x => settings.CurrentSets.Any(x.HasSet) && !bannedSecrets.Contains(x) ).ToList(); Assert.AreEqual(arenaSecrets.Count, cards.Count); foreach (var secret in arenaSecrets) { Assert.IsNotNull(cards.SingleOrDefault(c => secret == c.Id)); } }