Behavior控场模式的解析(下)

        /// <summary>
        /// 计算敌方随从价值
        /// </summary>
        /// <param name="m">正在计算的随从</param>
        /// <param name="p">场面</param>
        /// <returns>价值,是一个整数</returns>
        public override int getEnemyMinionValue(Minion m, Playfield p)
        {
            int retval = 5;//初始值5
            retval += m.Hp * 2;//血量2
            if (!m.frozen && !(m.cantAttack && m.name != CardDB.cardName.argentwatchman))//未被冻结,可以攻击
            {
                retval += m.Angr * 2;//攻击2
                if (m.windfury) retval += m.Angr * 2;//风怒,+2倍攻击
                if (m.Angr >= 4) retval += 10;//攻击大于等于4,+10
                if (m.Angr >= 7) retval += 50;//攻击大于等于7,+50
            }

            if (!m.handcard.card.isSpecialMinion)//不是特殊随从(penman里的字典)
            {
                if (m.Angr == 0) retval -= 7;//攻击为0,-7
                else if (m.Angr <= 2 && m.Hp <= 2 && !m.divineshild) retval -= 5;//攻击血量小于2,无圣盾,-5
            }
            else retval += m.handcard.card.rarity;//加随从稀有度
            
            if (m.taunt) retval += 5;//嘲讽,+5
            if (m.divineshild) retval += m.Angr;//圣盾,+攻击
            if (m.divineshild && m.taunt) retval += 5;//圣盾嘲讽,+5
            if (m.stealth) retval += 1;//潜行,+1

            if (m.poisonous)//剧毒
            {
                retval += 4;
                if (p.ownMinions.Count < p.enemyMinions.Count) retval += 10;
            }
            if (m.lifesteal) retval += m.Angr;//吸血,+攻击

            if (m.handcard.card.targetPriority >= 1 && !m.silenced)
            {
                retval += m.handcard.card.targetPriority;//目标优先级,也在penman字典里面
            }
            if (m.name == CardDB.cardName.nerubianegg && m.Angr <= 3 && !m.taunt) retval = 0;//烛魔之卵
            retval += m.synergy;//+职业契合度
            return retval;
        }

        /// <summary>
        /// 芬利爵士优先级
        /// </summary>
        /// <param name="discoverCards"></param>
        /// <returns>选择</returns>
        public override int getSirFinleyPriority(List<Handmanager.Handcard> discoverCards)
        {
            
            //return -1; //comment out or remove this to set manual priority
            int sirFinleyChoice = -1;
            int tmp = int.MinValue;
            for (int i = 0; i < discoverCards.Count; i++)
            {
                CardDB.cardName name = discoverCards[i].card.name;
                if (SirFinleyPriorityList.ContainsKey(name) && SirFinleyPriorityList[name] > tmp)
                {
                    tmp = SirFinleyPriorityList[name];
                    sirFinleyChoice = i;
                }
            }
            return sirFinleyChoice;
        }

        private Dictionary<CardDB.cardName, int> SirFinleyPriorityList = new Dictionary<CardDB.cardName, int>
        {
            //{HeroPowerName, Priority}, where 0-9 = manual priority
            { CardDB.cardName.lesserheal, 2 }, 
            { CardDB.cardName.shapeshift, 5 },
            { CardDB.cardName.fireblast, 4 },
            { CardDB.cardName.totemiccall, 7 },
            { CardDB.cardName.lifetap, 9 },
            { CardDB.cardName.daggermastery, 6 },
            { CardDB.cardName.reinforce, 3 },
            { CardDB.cardName.armorup, 1 },
            { CardDB.cardName.steadyshot, 8 }
        };

 

posted @ 2020-08-26 19:13  魔王的骑士  阅读(1191)  评论(1编辑  收藏  举报