Ejemplo n.º 1
0
        //具体策略
        public ProfileParameters GetParameters(Board board)
        {
            Card z       = board.Hand.Find(x => x.Template.Id > 0);
            Card y       = board.Hand.FindLast(x => x.Template.Id > 0);
            int  流放牌数    = board.Hand.Count(x => x.CurrentCost > 0 && BoardHelper.IsOutCastCard(x, board) == true);
            int  古尔丹流放牌数 = board.Hand.Count(x => x.CurrentCost > 0 && BoardHelper.IsGuldanOutCastCard(x, board) == true);

            Bot.Log("流放牌数 = " + (int)(流放牌数 + 古尔丹流放牌数));
            //Bot.Log("右:是否流放: " + BoardHelper.IsOutCastCard(y, board));


            #region 自定义变量
            int twoHpMinionsCount   = board.MinionEnemy.Count(minion => minion.CurrentHealth <= 2);                                                            //对面小于等于2血的随从数量
            int threeHpMinionsCount = board.MinionEnemy.Count(minion => minion.CurrentHealth <= 3) - board.MinionFriend.FindAll(x => x.CurrentAtk >= 3).Count; //对面小于等于3血的随从数量
            int fiveHpMinionsCount  = board.MinionEnemy.Count(minion => minion.CurrentHealth <= 5) - board.MinionFriend.FindAll(x => x.CurrentAtk >= 5).Count; //对面小于等于5血的随从数量
            #endregion

            #region 攻击模式


            var p = new ProfileParameters(BaseProfile.Rush)
            {
                DiscoverSimulationValueThresholdPercent = -10
            };


            int myAttack    = 0;
            int enemyAttack = 0;

            if (board.MinionFriend != null)
            {
                for (int x = 0; x < board.MinionFriend.Count; x++)
                {
                    myAttack += board.MinionFriend[x].CurrentAtk;
                }
            }

            if (board.MinionEnemy != null)
            {
                for (int x = 0; x < board.MinionEnemy.Count; x++)
                {
                    enemyAttack += board.MinionEnemy[x].CurrentAtk;
                }
            }

            if (board.WeaponEnemy != null)
            {
                enemyAttack += board.WeaponEnemy.CurrentAtk;
            }

            if ((int)board.EnemyClass == 2 || (int)board.EnemyClass == 7 || (int)board.EnemyClass == 8)
            {
                enemyAttack += 1;
            }
            else if ((int)board.EnemyClass == 6)
            {
                enemyAttack += 2;
            }
            if ((board.EnemyAbility.Template.Id == Card.Cards.AT_132_PALADIN ||
                 board.EnemyClass == Card.CClass.MAGE ||
                 board.EnemyClass == Card.CClass.DRUID) &&
                board.HeroEnemy.CurrentHealth >= 16)
            {
                p = new ProfileParameters(BaseProfile.Default)
                {
                    DiscoverSimulationValueThresholdPercent = -10
                };
            }
            if ((board.EnemyAbility.Template.Id == Card.Cards.AT_132_PALADIN ||
                 board.EnemyClass == Card.CClass.MAGE ||
                 board.EnemyClass == Card.CClass.DRUID) &&
                board.HeroEnemy.CurrentHealth < 16)
            {
                p = new ProfileParameters(BaseProfile.Rush)
                {
                    DiscoverSimulationValueThresholdPercent = -10
                };
            }
            #endregion

            #region 权重初始化
            //技能卡
            p.CastSpellsModifiers.AddOrUpdate(Card.Cards.BT_490, new Modifier(40));                          //吞噬魔法
            p.CastSpellsModifiers.AddOrUpdate(Card.Cards.BT_753, new Modifier(120));                         //法力燃烧
            p.CastSpellsModifiers.AddOrUpdate(Card.Cards.BT_491, new Modifier(50));                          //幽灵视觉
            p.CastSpellsModifiers.AddOrUpdate(Card.Cards.BT_035, new Modifier(30));                          //混乱打击
            p.CastSpellsModifiers.AddOrUpdate(Card.Cards.BT_601, new Modifier(30));                          //古尔丹的脑袋
            p.CastSpellsModifiers.AddOrUpdate(Card.Cards.BT_187, new Modifier(200, board.HeroEnemy.Id));     //日怒
            p.CastSpellsModifiers.AddOrUpdate(Card.Cards.HERO_10p_UP, new Modifier(50, board.HeroEnemy.Id)); //恶魔之咬-奇数瞎
            //随从卡
            p.CastMinionsModifiers.AddOrUpdate(Card.Cards.BT_323, new Modifier(120));                        //盲眼监视者
            //武器卡
            p.CastWeaponsModifiers.AddOrUpdate(Card.Cards.BT_922, new Modifier(50));                         //棕红之翼
            p.CastWeaponsModifiers.AddOrUpdate(Card.Cards.BT_921, new Modifier(120));                        //奥达奇

            //硬币
            p.CastSpellsModifiers.AddOrUpdate(Card.Cards.TB_011, new Modifier(50));
            #endregion

            #region 随从权重

            if (board.ManaAvailable >= 4 &&
                (board.HasCardInHand(Card.Cards.BT_187)) &&
                board.FriendDeckCount >= 2 ||
                board.EnemyClass == Card.CClass.DEMONHUNTER)//DH内战,日怒直接下
            {
                p.CastMinionsModifiers.AddOrUpdate(Card.Cards.BT_187, new Modifier(100));
            }
            else
            {
                p.CastMinionsModifiers.AddOrUpdate(Card.Cards.BT_187, new Modifier(180));
            }//日怒权重

            if (board.ManaAvailable <= 3 &&
                (board.Hand.Exists(x => x.Template.Id == Card.Cards.BT_351) ||
                 board.Hand.Exists(x => x.Template.Id == Card.Cards.BT_323) ||
                 board.Hand.Exists(x => x.Template.Id == Card.Cards.BT_922) ||
                 board.Hand.Exists(x => x.Template.Id == Card.Cards.EX1_066) ||
                 board.Hand.Exists(x => x.Template.Id == Card.Cards.BT_352)) &&
                board.Hand.Exists(x => x.Template.Id == Card.Cards.BT_035))
            {
                p.CastSpellsModifiers.AddOrUpdate(Card.Cards.BT_035, new Modifier(400));
            }//2费卡牌权重

            if (board.ManaAvailable == 1 &&
                board.Hand.Exists(x => x.Template.Id == Card.Cards.GAME_005) &&
                board.Hand.Count(x => x.Template.Id == Card.Cards.BT_490) == 1 &&
                (board.Hand.Exists(x => x.Template.Id == Card.Cards.BT_351) || board.Hand.Exists(x => x.Template.Id == Card.Cards.BT_480)) &&
                !board.Hand.Exists(x => x.Template.Id == Card.Cards.BT_753))
            {
                p.CastMinionsModifiers.AddOrUpdate(Card.Cards.BT_490, new Modifier(400));
            }//1费卡牌权重

            if (board.ManaAvailable <= 2 &&
                board.Hand.Exists(x => x.Template.Id == Card.Cards.BT_323) &&
                board.Hand.Count(card => card.Template.Id == Card.Cards.BT_601) == 0)
            {
                p.CastMinionsModifiers.AddOrUpdate(Card.Cards.BT_323, new Modifier(40));
            }//2费之前没古尔丹脑袋,下盲眼监视者

            if (board.Hand.Exists(x => x.Template.Id == Card.Cards.BT_323) &&
                BoardHelper.GetPlayableSpellSequence(board).Count == 0 &&
                board.EnemyClass == Card.CClass.WARLOCK)
            {
                p.CastMinionsModifiers.AddOrUpdate(Card.Cards.BT_323, new Modifier(40));
            }//没可以打的法术,下盲眼监视者

            if (board.ManaAvailable == 1 &&
                board.Hand.Exists(x => x.Template.Id == Card.Cards.BT_351) &&
                board.MinionEnemy.Count == 0)
            {
                p.CastMinionsModifiers.AddOrUpdate(Card.Cards.FP1_004, new Modifier(40));
            }//1费对面没有随从,下战斗邪犬
            else if (board.ManaAvailable == 1 &&
                     board.Hand.Exists(x => x.Template.Id == Card.Cards.GAME_005) &&
                     board.Hand.Count(x => x.Template.Id == Card.Cards.BT_323) == 1 &&
                     board.Hand.Exists(x => x.Template.Id == Card.Cards.BT_922))
            {
                p.CastMinionsModifiers.AddOrUpdate(Card.Cards.BT_323, new Modifier(2000));
            }//1费手里有棕红和盲眼监视者,不跳费下盲眼监视者

            else if (board.ManaAvailable >= 4 &&
                     !board.Hand.Exists(x => x.Template.Race == Card.CRace.DEMON))
            {
                p.CastMinionsModifiers.AddOrUpdate(Card.Cards.BT_416, new Modifier(250));
            }//手牌没恶魔,降低暴怒权重

            if (board.Hand.Exists(x => x.Template.Id == Card.Cards.BT_937) &&
                board.Hand.Count < 2)
            {
                p.CastMinionsModifiers.AddOrUpdate(Card.Cards.EX1_612, new Modifier(300));
            }//手里没有能打的流放牌,降低流放者权重(作者还没加卡牌是否流放判断)

            if (board.ManaAvailable == 2 &&
                board.Hand.Exists(x => x.Template.Id == Card.Cards.EX1_066) &&
                !board.Hand.Exists(x => x.Template.Id == Card.Cards.GAME_005) &&
                board.Hand.Exists(x => x.Template.Cost == 2))
            {
                p.CastMinionsModifiers.AddOrUpdate(Card.Cards.EX1_066, new Modifier(600));
            }//2费手里有其他2费随从,不打软泥怪

            if (board.Hand.Count >= 7)
            {
                p.CastSpellsModifiers.AddOrUpdate(Card.Cards.BT_601, new Modifier(300));
            }//手牌太多,降低过牌权重

            if (BoardHelper.GetPlayableMinionSequence(board).Count < 2 &&
                board.Hand.Exists(x => x.Template.Id == Card.Cards.ULD_215))
            {
                p.CastMinionsModifiers.AddOrUpdate(Card.Cards.BT_352, new Modifier(40));
            }//场上随从少于2个,铺场

            if (board.WeaponEnemy != null && board.EnemyClass == Card.CClass.DEMONHUNTER)//软泥怪解武器
            {
                if (board.WeaponEnemy.Template.Id == Card.Cards.BT_921)
                {
                    p.CastMinionsModifiers.AddOrUpdate(Card.Cards.EX1_066, new Modifier(50));
                }
                else
                {
                    p.CastMinionsModifiers.AddOrUpdate(Card.Cards.EX1_066, new Modifier(600));
                }
            }
            else
            {
                p.CastMinionsModifiers.AddOrUpdate(Card.Cards.EX1_066, new Modifier(50));
            }

            #endregion

            #region 技能权重
            if (board.Hand.Exists(x => x.Template.Id == Card.Cards.BT_514) &&
                twoHpMinionsCount <= 2 &&
                board.MinionEnemy.Sum(x => x.CurrentAtk) <= 4)
            {
                p.CastSpellsModifiers.AddOrUpdate(Card.Cards.BT_514, new Modifier(200));
            }//对面随从少,降低献祭光环权重

            if (twoHpMinionsCount >= 3)
            {
                p.CastSpellsModifiers.AddOrUpdate(Card.Cards.BT_514, new Modifier(190 - 40 * twoHpMinionsCount));
            }//对面怪多,提高献祭光环

            /*
             * if (board.MinionFriend.Exists(x => x.Template.Id==Card.Cards.BT_002)
             *  && board.Hand.Exists(x => x.Template.Id == Card.Cards.ULD_726)
             *  && board.Hand.FindAll(x => x.Template.Id == Card.Cards.CFM_760).Min(x => x.CurrentCost) <= board.ManaAvailable
             *  && board.Hand.FindAll(x => x.Template.Id == Card.Cards.CFM_760).Min(x => x.CurrentCost) > board.ManaAvailable - 2
             *  && (!board.Secret.Contains(Cards.Counterspell) || board.FriendGraveyard.Exists(card => CardTemplate.LoadFromId(card).Id == Card.Cards.EX1_287))
             *  && (!board.Secret.Contains(Cards.ExplosiveRunes)) || board.FriendGraveyard.Exists(card => CardTemplate.LoadFromId(card).Id == Card.Cards.LOOT_101))
             * {
             *  p.CastSpellsModifiers.AddOrUpdate(Card.Cards.ULD_726, new Modifier(-700));
             * }//场上有流放随从,释放流放牌(暂时未知流放如何判断)
             */
            if (board.ManaAvailable == 4 &&
                !board.Hand.Exists(x => x.Template.Id == Card.Cards.GAME_005) &&
                board.Hand.Count(x => x.Template.Id == Card.Cards.BT_514) >= 1 &&
                twoHpMinionsCount >= 3 &&
                board.MinionFriend.Count <= 1)
            {
                p.CastSpellsModifiers.AddOrUpdate(Card.Cards.BT_801, new Modifier(200));
            }//4费对面小于2血的怪多,不打眼棱


            if ((board.FriendDeckCount <= 6 && board.Hand.Exists(x => x.Template.Id == Card.Cards.BT_035)))
            {
                p.CastSpellsModifiers.AddOrUpdate(Card.Cards.BT_035, new Modifier(20));
            }//牌库卡不多,提高过牌


            if (board.MinionEnemy.Count == 1 &&
                board.MinionEnemy.Exists(x => x.Template.Id == Card.Cards.NEW1_021) &&
                board.MinionFriend.Count == 0 &&
                BoardHelper.GetPlayableSpellSequence(board).Count > 0)
            {
                foreach (var card1 in BoardHelper.GetPlayableSpellSequence(board))
                {
                    p.CastSpellsModifiers.AddOrUpdate(card1, new Modifier(30));
                }
            }//对面有末日,提高过牌

            if (board.ManaAvailable >= 6 && board.Hand.Count <= 5 && board.HasCardInHand(Card.Cards.BT_601))
            {
                p.CastWeaponsModifiers.AddOrUpdate(Card.Cards.BT_601, new Modifier(50));
            }//如果当前剩余法力水晶大于等于6,手牌数量小于等于5并且手牌中有古尔丹头颅

            if (board.EnemyClass == Card.CClass.MAGE ||
                board.EnemyClass == Card.CClass.PRIEST ||
                board.EnemyClass == Card.CClass.WARLOCK)
            {
                p.CastSpellsModifiers.AddOrUpdate(Card.Cards.BT_753, new Modifier(50));//法力燃烧
            }
            #endregion

            #region 敌方权重
            //针对一些随从优先解掉
            if (board.MinionEnemy.Any(minion => minion.Template.Id == Card.Cards.BRM_002))
            {
                p.OnBoardBoardEnemyMinionsModifiers.AddOrUpdate(Card.Cards.BRM_002, new Modifier(400));
            }//如果对面场上有火妖,提高攻击优先度

            if (board.MinionEnemy.Any(minion => minion.Template.Id == Card.Cards.ULD_276))
            {
                p.OnBoardBoardEnemyMinionsModifiers.AddOrUpdate(Card.Cards.ULD_276, new Modifier(110));
            }//如果对面场上有202,提高攻击优先度

            if (board.MinionEnemy.Any(minion => minion.Template.Id == Card.Cards.GVG_069))
            {
                p.OnBoardBoardEnemyMinionsModifiers.AddOrUpdate(Card.Cards.GVG_069, new Modifier(150));
            }//如果对面场上有533,提高攻击优先度

            if (board.MinionEnemy.Any(minion => minion.Template.Id == Card.Cards.GVG_084))
            {
                p.OnBoardBoardEnemyMinionsModifiers.AddOrUpdate(Card.Cards.GVG_084, new Modifier(300));
            }//如果对面场上有314,提高攻击优先度

            if (board.MinionEnemy.Any(minion => minion.Template.Id == Card.Cards.BOT_103))
            {
                p.OnBoardBoardEnemyMinionsModifiers.AddOrUpdate(Card.Cards.BOT_103, new Modifier(120));
            }//如果对面场上有露娜,提高攻击优先度

            if (board.MinionEnemy.Any(minion => minion.Template.Id == Card.Cards.BOT_407))
            {
                p.OnBoardBoardEnemyMinionsModifiers.AddOrUpdate(Card.Cards.BOT_407, new Modifier(120));
            }//如果对面场上有雷云元素,提高攻击优先度

            if (!BoardHelper.HasPotentialLethalNextTurn(board) &&
                board.MinionEnemy.Count(minion => minion.Template.Id == Card.Cards.GVG_045t) >= 3 &&
                board.EnemyClass == Card.CClass.WARLOCK)
            {
                p.OnBoardBoardEnemyMinionsModifiers.AddOrUpdate(Card.Cards.GVG_045t, new Modifier(150));
            }//如果对面场上有1-1小鬼,提高攻击优先度
            #endregion

            #region 武器权重
            if ((board.Hand.Exists(x => x.Template.Id == Card.Cards.BT_271) ||
                 (board.WeaponFriend != null && board.WeaponFriend.Template.Id == Card.Cards.BT_271)) &&
                board.HeroEnemy.CurrentHealth <= 16)
            {
                p.WeaponsAttackModifiers.AddOrUpdate(Card.Cards.BT_271, new Modifier(-1000));
            }//如果对面血量小于等于16,提高武器攻击优先度
            #endregion


            return(p);
        }