Example #1
0
        public int GetIndexOffset(HeroClass heroClass)
        {
            switch (heroClass)
            {
            case HeroClass.Hunter:
                return(0);

            case HeroClass.Mage:
                if (DisplayedClasses.Contains(HeroClass.Hunter))
                {
                    return(SecretHelper.GetMaxSecretCount(HeroClass.Hunter));
                }
                return(0);

            case HeroClass.Paladin:
                if (DisplayedClasses.Contains(HeroClass.Hunter) && DisplayedClasses.Contains(HeroClass.Mage))
                {
                    return(SecretHelper.GetMaxSecretCount(HeroClass.Hunter) + SecretHelper.GetMaxSecretCount(HeroClass.Mage));
                }
                if (DisplayedClasses.Contains(HeroClass.Hunter))
                {
                    return(SecretHelper.GetMaxSecretCount(HeroClass.Hunter));
                }
                if (DisplayedClasses.Contains(HeroClass.Mage))
                {
                    return(SecretHelper.GetMaxSecretCount(HeroClass.Mage));
                }
                return(0);
            }
            return(0);
        }
Example #2
0
        public void SetZero(string cardId)
        {
            var index = SecretHelper.GetSecretIndex(HeroClass, cardId);

            if (index != -1)
            {
                SetZero(index);
            }
        }
		public void NewSecretPlayed(HeroClass heroClass, int id, int turn, string knownCardId = null)
		{
			var helper = new SecretHelper(heroClass, id, turn);
			if(knownCardId != null)
			{
				foreach(var cardId in SecretHelper.GetSecretIds(heroClass))
					helper.TrySetSecret(cardId, cardId == knownCardId);
			}
			Secrets.Add(helper);
			Log.Info("Added secret with id:" + id);
		}
Example #4
0
        public Secret[] GetDefaultSecrets(HeroClass heroClass)
        {
            var count      = SecretHelper.GetMaxSecretCount(heroClass);
            var returnThis = new Secret[count];

            for (int i = 0; i < count; i++)
            {
                returnThis[i] = new Secret(SecretHelper.GetSecretIds(heroClass)[i], 1);
            }
            return(returnThis);
        }
		public void NewSecretPlayed(HeroClass heroClass, int id, int turn, string knownCardId = null)
		{
			var helper = new SecretHelper(heroClass, id, turn);
			if(knownCardId != null)
			{
				foreach(var cardId in SecretHelper.GetSecretIds(heroClass))
					helper.PossibleSecrets[cardId] = cardId == knownCardId;
			}
			Secrets.Add(helper);
			Logger.WriteLine("Added secret with id:" + id, "OpponentSecrets");
		}
Example #6
0
        public List <Secret> GetDefaultSecrets(HeroClass heroClass)
        {
            var count      = SecretHelper.GetMaxSecretCount(heroClass);
            var returnThis = new List <Secret>();

            foreach (var cardId in SecretHelper.GetSecretIds(heroClass))
            {
                returnThis.Add(new Secret(cardId, 1));
            }

            return(returnThis);
        }
Example #7
0
        public void NewSecretPlayed(HeroClass heroClass, int id, int turn, string knownCardId = null)
        {
            var helper = new SecretHelper(heroClass, id, turn);

            if (knownCardId != null)
            {
                foreach (var cardId in SecretHelper.GetSecretIds(heroClass))
                {
                    helper.PossibleSecrets[cardId] = cardId == knownCardId;
                }
            }
            Secrets.Add(helper);
            Logger.WriteLine("Added secret with id:" + id, "OpponentSecrets");
        }
        public void NewSecretPlayed(HeroClass heroClass, int id, int turn, string knownCardId = null)
        {
            var helper = new SecretHelper(heroClass, id, turn);

            if (knownCardId != null)
            {
                foreach (var cardId in SecretHelper.GetSecretIds(heroClass))
                {
                    helper.TrySetSecret(cardId, cardId == knownCardId);
                }
            }
            Secrets.Add(helper);
            Log.Info("Added secret with id:" + id);
        }
Example #9
0
        public void Trigger(string cardId)
        {
            var index = SecretHelper.GetSecretIndex(HeroClass, cardId);

            if (index == -1)
            {
                return;
            }
            if (Secrets.Any(s => s.PossibleSecrets[index]))
            {
                SetZero(index);
            }
            else
            {
                SetMax(index);
            }
        }
Example #10
0
        public void SetZero(string cardId, HeroClass?heroClass)
        {
            if (heroClass == null)
            {
                heroClass = GetHeroClass(cardId);
                if (!heroClass.HasValue)
                {
                    return;
                }
            }
            var index = SecretHelper.GetSecretIndex(heroClass.Value, cardId);

            if (index != -1)
            {
                SetZero(index, heroClass.Value);
            }
        }
Example #11
0
        public Secret[] GetSecrets()
        {
            var count      = SecretHelper.GetMaxSecretCount(HeroClass);
            var returnThis = new Secret[count];

            for (int i = 0; i < count; i++)
            {
                returnThis[i] = new Secret(SecretHelper.GetSecretIds(HeroClass)[i], 0);
            }
            foreach (var secret in Secrets)
            {
                for (int i = 0; i < count; i++)
                {
                    if (secret.PossibleSecrets[i])
                    {
                        returnThis[i].Count++;
                    }
                }
            }
            return(returnThis);
        }
Example #12
0
        public void Trigger(string cardId)
        {
            var index = SecretHelper.GetSecretIndex(HeroClass, cardId);

            if (index == -1)
            {
                return;
            }
            if (Secrets.Any(s => s.PossibleSecrets[index]))
            {
                foreach (var secret in Secrets)
                {
                    secret.PossibleSecrets[index] = false;
                }
            }
            else
            {
                foreach (var secret in Secrets)
                {
                    secret.PossibleSecrets[index] = true;
                }
            }
        }
Example #13
0
        public void Trigger(string cardId)
        {
            var heroClass = GetHeroClass(cardId);

            if (!heroClass.HasValue)
            {
                return;
            }
            var index = SecretHelper.GetSecretIndex(heroClass.Value, cardId);

            if (index == -1)
            {
                return;
            }
            //index += GetIndexOffset(heroClass.Value);
            if (Secrets.Where(s => s.HeroClass == heroClass).Any(s => s.PossibleSecrets[index]))
            {
                SetZero(index, heroClass.Value);
            }
            else
            {
                SetMax(index, heroClass.Value);
            }
        }
Example #14
0
 public List <Secret> GetDefaultSecrets(HeroClass heroClass)
 {
     return(SecretHelper.GetSecretIds(heroClass).Select(cardId => new Secret(cardId, 1)).ToList());
 }