其他分享
首页 > 其他分享> > HearthBuddy炉石兄弟 格雷迈恩

HearthBuddy炉石兄弟 格雷迈恩

作者:互联网

 

 private void getDecks()
        {
            Dictionary<string, int> tmpDeck = new Dictionary<string, int>(startDeck);
            List<GraveYardItem> graveYard = new List<GraveYardItem>();
            Dictionary<CardDB.cardIDEnum, int> og = new Dictionary<CardDB.cardIDEnum, int>();
            Dictionary<CardDB.cardIDEnum, int> eg = new Dictionary<CardDB.cardIDEnum, int>();
            int owncontroler = TritonHs.OurHero.GetTag(GAME_TAG.CONTROLLER);
            int enemycontroler = TritonHs.EnemyHero.GetTag(GAME_TAG.CONTROLLER);
            turnDeck.Clear();
            noDuplicates = false;

            List<HSCard> allcards = TritonHs.GetAllCards();

            int allcardscount = allcards.Count;
            for (int i = 0; i < allcardscount; i++)
            {
                HSCard entity = allcards[i];
                if (entity.Id == null || entity.Id == "") continue;

                if (CardDB.Instance.cardIdstringToEnum(entity.Id) == CardDB.cardIDEnum.UNG_116t) ownMinionsCost0 = true;

                if (entity.GetZone() == Triton.Game.Mapping.TAG_ZONE.GRAVEYARD)
                {
                    CardDB.cardIDEnum cide = CardDB.Instance.cardIdstringToEnum(entity.Id);
                    GraveYardItem gyi = new GraveYardItem(cide, entity.EntityId, entity.GetTag(GAME_TAG.CONTROLLER) == owncontroler);
                    graveYard.Add(gyi);

                    if (entity.GetTag(GAME_TAG.CONTROLLER) == owncontroler)
                    {
                        if (og.ContainsKey(cide)) og[cide]++;
                        else og.Add(cide, 1);
                    }
                    else if (entity.GetTag(GAME_TAG.CONTROLLER) == enemycontroler)
                    {
                        if (eg.ContainsKey(cide)) eg[cide]++;
                        else eg.Add(cide, 1);
                    }
                    if (cide == CardDB.cardIDEnum.UNG_067t1) ownCrystalCore = 5;
                }

                string entityId = entity.Id;
                Triton.Game.Mapping.TAG_ZONE entZone =  entity.GetZone();
                if (i < 30)
                {
                    if (entityId != "")
                    {
                        if (entZone == Triton.Game.Mapping.TAG_ZONE.DECK) continue;
                        if (tmpDeck.ContainsKey(entityId)) tmpDeck[entityId]--;
                    }
                }
                else if (i >= 60 && entity.ControllerId == owncontroler)
                {
                    if (extraDeck.ContainsKey(i))
                    {
                        if (entityId != "" && entityId != extraDeck[i].id) extraDeck[i].setId(entityId);
                        if ((entZone == Triton.Game.Mapping.TAG_ZONE.DECK) != extraDeck[i].isindeck) extraDeck[i].setisindeck(entZone == Triton.Game.Mapping.TAG_ZONE.DECK);
                    }
                    else if (entZone == Triton.Game.Mapping.TAG_ZONE.DECK)
                    {
                        extraDeck.Add(i, new extraCard(entityId, true));
                    }
                }
            }

            Action a = Ai.Instance.bestmove;
            foreach (var c in extraDeck)
            {
                if (c.Value.isindeck == false) continue;
                CardDB.cardIDEnum ce;
                string entityId = c.Value.id;
                if (entityId == "")
                {
                    if (a != null)
                    {
                        switch (a.actionType)
                        {
                            case actionEnum.playcard:
                                switch (a.card.card.cardIDenum)
                                {
                                    case CardDB.cardIDEnum.LOE_104: goto case CardDB.cardIDEnum.BRM_007; 
                                    case CardDB.cardIDEnum.BRM_007: 
                                        if (a.target != null) entityId = a.target.handcard.card.cardIDenum.ToString();
                                        break;
                                    case CardDB.cardIDEnum.LOE_002: entityId = "LOE_002t"; break; 
                                    case CardDB.cardIDEnum.LOE_079: entityId = "LOE_019t"; break; 
                                    case CardDB.cardIDEnum.LOE_019t: entityId = "LOE_019t2"; break;
                                    case CardDB.cardIDEnum.LOE_110: entityId = "LOE_110t"; break; 
                                }
                                break;
                        }
                    }
                    if (entityId == "")
                    {
                        var oldCardsOut = Probabilitymaker.Instance.enemyCardsOut;
                        foreach (var tmp in eg)
                        {
                            if (oldCardsOut.ContainsKey(tmp.Key) && tmp.Value == oldCardsOut[tmp.Key]) continue;
                            switch (tmp.Key)
                            {
                                case CardDB.cardIDEnum.AT_035: entityId = "AT_035t"; break; 
                                case CardDB.cardIDEnum.GVG_031: entityId = "aiextra1"; break; 
                                case CardDB.cardIDEnum.LOE_111: entityId = "LOE_111"; break; 
                            }
                        }
                        if (entityId == "" && lastpf != null)
                        {
                            int num = 0;
                            foreach (Minion m in this.enemyMinions)
                            {
                                if (m.handcard.card.cardIDenum == CardDB.cardIDEnum.GVG_056) num++; 
                            }
                            if (num > 0)
                            {
                                foreach (Minion m in lastpf.enemyMinions)
                                {
                                    if (m.handcard.card.cardIDenum == CardDB.cardIDEnum.GVG_056) num--;
                                }
                            }
                            if (num > 0) entityId = "GVG_056t";
                            else
                            {
                                num = 0;
                                foreach (Minion m in lastpf.ownMinions)
                                {
                                    if (m.handcard.card.cardIDenum == CardDB.cardIDEnum.GVG_035) num++; 
                                }
                                if (num > 0)
                                {
                                    foreach (Minion m in this.ownMinions)
                                    {
                                        if (m.handcard.card.cardIDenum == CardDB.cardIDEnum.GVG_035) num--;
                                    }
                                }
                                if (num > 0) entityId = "GVG_035";
                            }
                        }
                    }
                    if (entityId == "") entityId = "aiextra1";
                }
                c.Value.setId(entityId);
                ce = CardDB.Instance.cardIdstringToEnum(entityId);
                if (turnDeck.ContainsKey(ce)) turnDeck[ce]++;
                else turnDeck.Add(ce, 1);
            }
            foreach (var c in tmpDeck)
            {
                if (c.Value < 1) continue;
                CardDB.cardIDEnum ce = CardDB.Instance.cardIdstringToEnum(c.Key);
                if (ce == CardDB.cardIDEnum.None) continue;
                if (turnDeck.ContainsKey(ce)) turnDeck[ce] += c.Value;
                else turnDeck.Add(ce, c.Value);
            }

            Probabilitymaker.Instance.setOwnCardsOut(og);
            Probabilitymaker.Instance.setEnemyCardsOut(eg);
            bool isTurnStart = false;
            if (Ai.Instance.nextMoveGuess.mana == -100)
            {
                isTurnStart = true;
                Ai.Instance.updateTwoTurnSim();
            }
            Probabilitymaker.Instance.setGraveYard(graveYard, isTurnStart);

            if (startDeck.Count == 0) return;
            noDuplicates = true;
            foreach (int i in turnDeck.Values)
            {
                if (i > 1)
                {
                    noDuplicates = false;
                    break;
                }
            }
        }

 

标签:TAG,炉石,entity,Instance,迈恩,cardIDEnum,CardDB,entityId,HearthBuddy
来源: https://www.cnblogs.com/chucklu/p/11372990.html