Example #1
0
        public HSCard GetSecretCard(string name, int num, bool exact = true, int precision = 4)
        {
            foreach (var card in Secret)
            {
                if (card.Name.ToLower().Equals(name.ToLower()))
                {
                    return(card);
                }
            }

            if (!exact)
            {
                bool   repeated = false;
                HSCard correct  = null;
                foreach (var card in Secret)
                {
                    if (name.Length >= precision && card.Name.ToLower().Contains(name.ToLower()))
                    {
                        if (repeated)
                        {
                            return(null);
                        }
                        correct = card;
                    }
                }
                return(correct);
            }
            return(null);
        }
Example #2
0
        // List<HSCard> Secret esta hecho arriba
        //public List<HSCard> Secrets
        //{
        //    get
        //    {
        //        List<HSCard> tmp = new List<HSCard>();
        //        foreach (var card in Play)
        //        {
        //            if (card.IsSecret)
        //            {
        //                tmp.Add(card);
        //            }
        //        }
        //        return tmp;
        //    }
        //}

        public void Clear()
        {
            IO.LogDebug("Clearing Player", IO.DebugFile.Hs);
            Hand.Clear();
            Graveyard.Clear();
            Deck.Clear();
            Play.Clear();
            Setaside.Clear();
            Secret.Clear();
            Removed.Clear();
            Tags.Clear();
            Hero = null;

            PlayerId      = 0;
            EntityId      = 0;
            PlayerName    = null;
            GameAccountId = null;
        }
Example #3
0
        //Methods that do something to the game
        //DEPRECATED
        public void SendLogs()
        {
            if (OldHand == null)
            {
                OldHand = new List <HSCard>();
                foreach (var card in GetUserHand())
                {
                    OldHand.Add(card);
                }
            }
            if (OldBoard == null)
            {
                OldBoard = new List <HSCard>();
                foreach (var card in GetUserMinions())
                {
                    OldBoard.Add(card);
                }
            }
            if (OldEnemyHand == null)
            {
                OldEnemyHand = new List <HSCard>();
                foreach (var card in GetOpponentHand())
                {
                    OldEnemyHand.Add(card);
                }
            }
            if (OldEnemyBoard == null)
            {
                OldEnemyBoard = new List <HSCard>();
                foreach (var card in GetOpponentMinions())
                {
                    OldEnemyBoard.Add(card);
                }
            }
            List <HSCard> Hand        = GetUserHand();
            List <HSCard> Board       = GetUserMinions();
            List <HSCard> EnemyHand   = GetOpponentHand();
            List <HSCard> EnemyBoard  = GetOpponentMinions();
            HSCard        Hero        = User.Hero;
            HSCard        EnemyHero   = Opponent.Hero;
            HSCard        Power       = User.HeroPower;
            HSCard        EnemyPower  = Opponent.HeroPower;
            HSCard        Weapon      = User.Weapon;
            HSCard        EnemyWeapon = Opponent.Weapon;

            HSCard[] tmp = new HSCard[10];

            if (OldWeapon == null || Weapon.TrueHealth != OldWeapon.TrueHealth || Weapon.Attack != OldWeapon.Attack)
            {
                irc.SendChatMessage("Weapon" + "_" + Weapon.Name + "_" + Weapon.TrueHealth + "_" + Weapon.Attack);
                OldWeapon = OldHero = Utils.Misc.DeepClone(Weapon);
            }

            if (OldEnemyWeapon == null || EnemyWeapon.TrueHealth != OldEnemyWeapon.TrueHealth || EnemyWeapon.Attack != OldEnemyWeapon.Attack)
            {
                irc.SendChatMessage("EnemyWeapon" + "_" + EnemyWeapon.Name + "_" + EnemyWeapon.TrueHealth + "_" + EnemyWeapon.Attack);
                OldEnemyWeapon = OldHero = Utils.Misc.DeepClone(EnemyWeapon);
            }

            if (OldHero == null || Hero.TrueHealth != OldHero.TrueHealth || Hero.Attack != OldHero.Attack || User.Mana != OldMana)
            {
                OldHero = Utils.Misc.DeepClone(Hero);
                irc.SendChatMessage("Hero_" + Hero.Name + "_" + Hero.TrueHealth + "_" + Hero.Armor + "_" + Hero.Attack + "_" + User.Mana + "_" + User.MaxMana + "_" + (User.IsPlaying ? 1 : 0));
                OldMana = User.Mana;
            }
            if (OldEnemyHero == null || EnemyHero.TrueHealth != OldEnemyHero.TrueHealth || EnemyHero.Attack != OldEnemyHero.Attack || Opponent.Mana != OldEnemyMana)
            {
                OldEnemyHero = Utils.Misc.DeepClone(EnemyHero);
                irc.SendChatMessage("EnemyHero_" + EnemyHero.Name + "_" + EnemyHero.TrueHealth + "_" + EnemyHero.Armor + "_" + EnemyHero.Attack + "_" + Opponent.Mana + "_" + Opponent.MaxMana + "_" + (Opponent.IsPlaying ? 1 : 0));
                OldEnemyMana = Opponent.Mana;
            }



            if (Hand.Count != OldHand.Count)
            {
                string send;
                send = "Hand " + Hand.Count;
                foreach (var c in Hand)
                {
                    send = send + "_[";
                    send = send + c.Name + ",";
                    send = send + c.Attack + ",";
                    send = send + c.TrueHealth + ",";
                    send = send + c.ManaCost + ",";
                    send = send + (c.DivineShield ? 1 : 0) + ",";
                    send = send + (c.Taunt ? 1 : 0) + ",";
                    send = send + (c.Lifesteal ? 1 : 0) + ",";
                    send = send + (c.Charge ? 1 : 0) + ",";
                    send = send + (c.Windfury ? 1 : 0) + ",";
                    send = send + (c.Exhausted ? 1 : 0) + ",";
                    send = send + (c.Stealth ? 1 : 0) + "]";
                }
                irc.SendChatMessage(send);
                OldHand = Utils.Misc.DeepClone(Hand);
            }
            else
            {
                foreach (var card in Hand)
                {
                    if (!card.Name.Equals(OldHand[card.ZonePos - 1].Name) || !card.TrueHealth.Equals(OldHand[card.ZonePos - 1].TrueHealth) ||
                        !card.Attack.Equals(OldHand[card.ZonePos - 1].Attack) || !card.DivineShield.Equals(OldHand[card.ZonePos - 1].DivineShield) ||
                        !card.Taunt.Equals(OldHand[card.ZonePos - 1].Taunt) || !card.Lifesteal.Equals(OldHand[card.ZonePos - 1].Lifesteal) ||
                        !card.Charge.Equals(OldHand[card.ZonePos - 1].Charge) || !card.Windfury.Equals(OldHand[card.ZonePos - 1].Windfury) ||
                        !card.Exhausted.Equals(OldHand[card.ZonePos - 1].Exhausted) || !card.Stealth.Equals(OldHand[card.ZonePos - 1].Stealth))
                    {
                        string send;
                        send = "Hand " + Hand.Count;
                        foreach (var c in Hand)
                        {
                            send = send + "_[";
                            send = send + c.Name + ",";
                            send = send + c.Attack + ",";
                            send = send + c.TrueHealth + ",";
                            send = send + c.ManaCost + ",";
                            send = send + (c.DivineShield ? 1 : 0) + ",";
                            send = send + (c.Taunt ? 1 : 0) + ",";
                            send = send + (c.Lifesteal ? 1 : 0) + ",";
                            send = send + (c.Charge ? 1 : 0) + ",";
                            send = send + (c.Windfury ? 1 : 0) + ",";
                            send = send + (c.Exhausted ? 1 : 0) + ",";
                            send = send + (c.Stealth ? 1 : 0) + "]";
                        }
                        irc.SendChatMessage(send);
                        OldHand = Utils.Misc.DeepClone(Hand);
                        break;
                    }
                }
            }

            if (Board.Count != OldBoard.Count)
            {
                string send;
                send = "Board " + Board.Count;
                foreach (var c in Board)
                {
                    send = send + "_[";
                    send = send + c.Name + ",";
                    send = send + c.Attack + ",";
                    send = send + c.TrueHealth + ",";
                    send = send + c.ManaCost + ",";
                    send = send + (c.DivineShield ? 1 : 0) + ",";
                    send = send + (c.Taunt ? 1 : 0) + ",";
                    send = send + (c.Lifesteal ? 1 : 0) + ",";
                    send = send + (c.Charge ? 1 : 0) + ",";
                    send = send + (c.Windfury ? 1 : 0) + ",";
                    send = send + (c.Exhausted ? 1 : 0) + ",";
                    send = send + (c.Stealth ? 1 : 0) + "]";
                }
                irc.SendChatMessage(send);
                OldBoard = Utils.Misc.DeepClone(Board);;
            }
            else
            {
                foreach (var card in Board)
                {
                    if (card.ZonePos == -1)
                    {
                        continue;
                    }
                    if (!card.Name.Equals(OldBoard[(card.ZonePos == 0) ? 0 : (card.ZonePos - 1)].Name) ||
                        !card.TrueHealth.Equals(OldBoard[(card.ZonePos == 0) ? 0 : (card.ZonePos - 1)].TrueHealth) ||
                        !card.Attack.Equals(OldBoard[(card.ZonePos == 0) ? 0 : (card.ZonePos - 1)].Attack) ||
                        !card.DivineShield.Equals(OldBoard[(card.ZonePos == 0) ? 0 : (card.ZonePos - 1)].DivineShield) ||
                        !card.Taunt.Equals(OldBoard[(card.ZonePos == 0) ? 0 : (card.ZonePos - 1)].Taunt) ||
                        !card.Lifesteal.Equals(OldBoard[(card.ZonePos == 0) ? 0 : (card.ZonePos - 1)].Lifesteal) ||
                        !card.Charge.Equals(OldBoard[(card.ZonePos == 0) ? 0 : (card.ZonePos - 1)].Charge) ||
                        !card.Windfury.Equals(OldBoard[(card.ZonePos == 0) ? 0 : (card.ZonePos - 1)].Windfury) ||
                        !card.Exhausted.Equals(OldBoard[(card.ZonePos == 0) ? 0 : (card.ZonePos - 1)].Exhausted) ||
                        !card.Stealth.Equals(OldBoard[(card.ZonePos == 0) ? 0 : (card.ZonePos - 1)].Stealth))
                    {
                        string send;
                        send = "Board " + Board.Count;
                        foreach (var c in Board)
                        {
                            send = send + "_[";
                            send = send + c.Name + ",";
                            send = send + c.Attack + ",";
                            send = send + c.TrueHealth + ",";
                            send = send + c.ManaCost + ",";
                            send = send + (c.DivineShield ? 1 : 0) + ",";
                            send = send + (c.Taunt ? 1 : 0) + ",";
                            send = send + (c.Lifesteal ? 1 : 0) + ",";
                            send = send + (c.Charge ? 1 : 0) + ",";
                            send = send + (c.Windfury ? 1 : 0) + ",";
                            send = send + (c.Exhausted ? 1 : 0) + ",";
                            send = send + (c.Stealth ? 1 : 0) + "]";
                        }
                        irc.SendChatMessage(send);
                        OldBoard = Utils.Misc.DeepClone(Board);
                        break;
                    }
                }
            }

            if (EnemyHand.Count != OldEnemyHand.Count)
            {
                string send;
                send         = "EnemyHand " + EnemyHand.Count;
                OldEnemyHand = Utils.Misc.DeepClone(EnemyHand);
            }
            else
            {
                foreach (var card in EnemyHand)
                {
                    if (!card.Name.Equals(OldEnemyHand[card.ZonePos - 1].Name) || !card.TrueHealth.Equals(OldEnemyHand[card.ZonePos - 1].TrueHealth) || !card.Attack.Equals(OldEnemyHand[card.ZonePos - 1].Attack) || !card.DivineShield.Equals(OldEnemyHand[card.ZonePos - 1].DivineShield) || !card.Taunt.Equals(OldEnemyHand[card.ZonePos - 1].Taunt) || !card.Lifesteal.Equals(OldEnemyHand[card.ZonePos - 1].Lifesteal) || !card.Charge.Equals(OldEnemyHand[card.ZonePos - 1].Charge) || !card.Windfury.Equals(OldEnemyHand[card.ZonePos - 1].Windfury) || !card.Exhausted.Equals(OldEnemyHand[card.ZonePos - 1].Exhausted) || !card.Stealth.Equals(OldEnemyHand[card.ZonePos - 1].Stealth))
                    {
                        string send;
                        send = "EnemyHand " + EnemyHand.Count;
                        foreach (var c in EnemyHand)
                        {
                            send = send + "_[";
                            send = send + c.Name + ",";
                            send = send + c.Attack + ",";
                            send = send + c.TrueHealth + ",";
                            send = send + c.ManaCost + ",";
                            send = send + (c.DivineShield ? 1 : 0) + ",";
                            send = send + (c.Taunt ? 1 : 0) + ",";
                            send = send + (c.Lifesteal ? 1 : 0) + ",";
                            send = send + (c.Charge ? 1 : 0) + ",";
                            send = send + (c.Windfury ? 1 : 0) + ",";
                            send = send + (c.Exhausted ? 1 : 0) + ",";
                            send = send + (c.Stealth ? 1 : 0) + "]";
                        }
                        irc.SendChatMessage(send);
                        OldEnemyHand = Utils.Misc.DeepClone(EnemyHand);
                        break;
                    }
                }
            }
            if (EnemyBoard.Count != OldEnemyBoard.Count)
            {
                string send;
                send = "EnemyBoard " + EnemyBoard.Count;
                foreach (var c in EnemyBoard)
                {
                    send = send + "_[";
                    send = send + c.Name + ",";
                    send = send + c.Attack + ",";
                    send = send + c.TrueHealth + ",";
                    send = send + c.ManaCost + ",";
                    send = send + (c.DivineShield ? 1 : 0) + ",";
                    send = send + (c.Taunt ? 1 : 0) + ",";
                    send = send + (c.Lifesteal ? 1 : 0) + ",";
                    send = send + (c.Charge ? 1 : 0) + ",";
                    send = send + (c.Windfury ? 1 : 0) + ",";
                    send = send + (c.Exhausted ? 1 : 0) + ",";
                    send = send + (c.Stealth ? 1 : 0) + "]";
                }
                irc.SendChatMessage(send);
                OldEnemyBoard = Utils.Misc.DeepClone(EnemyBoard);
            }
            else
            {
                foreach (var card in EnemyBoard)
                {
                    if (card.ZonePos == -1)
                    {
                        continue;
                    }
                    if (!card.Name.Equals(OldEnemyBoard[(card.ZonePos == 0) ? 0 : (card.ZonePos - 1)].Name) ||
                        !card.TrueHealth.Equals(OldEnemyBoard[(card.ZonePos == 0) ? 0 : (card.ZonePos - 1)].TrueHealth) ||
                        !card.Attack.Equals(OldEnemyBoard[(card.ZonePos == 0) ? 0 : (card.ZonePos - 1)].Attack) ||
                        !card.DivineShield.Equals(OldEnemyBoard[(card.ZonePos == 0) ? 0 : (card.ZonePos - 1)].DivineShield) ||
                        !card.Taunt.Equals(OldEnemyBoard[(card.ZonePos == 0) ? 0 : (card.ZonePos - 1)].Taunt) ||
                        !card.Lifesteal.Equals(OldEnemyBoard[(card.ZonePos == 0) ? 0 : (card.ZonePos - 1)].Lifesteal) ||
                        !card.Charge.Equals(OldEnemyBoard[(card.ZonePos == 0) ? 0 : (card.ZonePos - 1)].Charge) ||
                        !card.Windfury.Equals(OldEnemyBoard[(card.ZonePos == 0) ? 0 : (card.ZonePos - 1)].Windfury) ||
                        !card.Exhausted.Equals(OldEnemyBoard[(card.ZonePos == 0) ? 0 : (card.ZonePos - 1)].Exhausted) ||
                        !card.Stealth.Equals(OldEnemyBoard[(card.ZonePos == 0) ? 0 : (card.ZonePos - 1)].Stealth))
                    {
                        string send;
                        send = "EnemyBoard " + EnemyBoard.Count;
                        foreach (var c in EnemyBoard)
                        {
                            send = send + "_[";
                            send = send + c.Name + ",";
                            send = send + c.Attack + ",";
                            send = send + c.TrueHealth + ",";
                            send = send + c.ManaCost + ",";
                            send = send + (c.DivineShield ? 1 : 0) + ",";
                            send = send + (c.Taunt ? 1 : 0) + ",";
                            send = send + (c.Lifesteal ? 1 : 0) + ",";
                            send = send + (c.Charge ? 1 : 0) + ",";
                            send = send + (c.Windfury ? 1 : 0) + ",";
                            send = send + (c.Exhausted ? 1 : 0) + ",";
                            send = send + (c.Stealth ? 1 : 0) + "]";
                        }
                        irc.SendChatMessage(send);
                        OldEnemyBoard = Utils.Misc.DeepClone(EnemyBoard);
                        break;
                    }
                }
            }
        }