当前位置: 首页>>代码示例>>C#>>正文


C# Playfield.getBestPlace方法代码示例

本文整理汇总了C#中HRSim.Playfield.getBestPlace方法的典型用法代码示例。如果您正苦于以下问题:C# Playfield.getBestPlace方法的具体用法?C# Playfield.getBestPlace怎么用?C# Playfield.getBestPlace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HRSim.Playfield的用法示例。


在下文中一共展示了Playfield.getBestPlace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: getMoveList

        public List<Action> getMoveList(Playfield p, bool isLethalCheck, bool usePenalityManager, bool useCutingTargets)
        {
            bool own = p.isOwnTurn;
            Player mPlayer, ePlayer;
            if (own)
            {
                mPlayer = p.playerFirst;
                ePlayer = p.playerSecond;
            }
            else {
                mPlayer = p.playerSecond;
                ePlayer = p.playerFirst;
            }

            //generates only own moves
            List<Action> ret = new List<Action>();
            List<Minion> trgts = new List<Minion>();

            if (p.complete || mPlayer.ownHero.Hp <= 0)
            {
                return ret;
            }

          //play cards:
            List<CardDB.cardName> playedcards = new List<CardDB.cardName>();

            foreach (Handmanager.Handcard hc in mPlayer.owncards)
            {
                CardDB.Card c = hc.card;
                //implementation
                if (c.name == CardDB.cardName.armorplating)
                {
                    p.moveTrigger.hasOwnTargetMove = true;
                }   
                //end of implementation
                if (playedcards.Contains(c.name) || !hc.canplayCard(p, own)) continue; // dont play the same card in one loop
                //playedcards.Add(c.name);

                int isChoice = (c.choice) ? 1 : 0;
                for (int i = 0 + 1 * isChoice; i < 1 + 2 * isChoice; i++)
                {
                    if (isChoice == 1) c = getChooseCard(hc.card, i); // do all choice

                    int manaCost = hc.getManaCost(p, own);
                    if (mPlayer.mana >= manaCost) // if enough manna
                    {
                        int cardplayPenality = 0;
                        int bestplace = p.getBestPlace(c, isLethalCheck, own);
                        //if (c.cardIDenum == CardDB.cardIDEnum.NEW1_005) {
                        //    int toBreak = 1;
                        //}
                        trgts = c.getTargetsForCard(p, isLethalCheck, own);
                        float bestReward = Single.MinValue;

                        List<Tuple<Action, float>> tempRet = new List<Tuple<Action, float>>();
                        foreach (Minion trgt in trgts)                        
                        {
                            if (usePenalityManager) cardplayPenality = pen.getPlayCardPenality(hc.card, trgt, p, i, isLethalCheck);
                            if (cardplayPenality <= 499)
                            {
                                Action a = new Action(actionEnum.playcard, hc, null, bestplace, trgt, cardplayPenality, i, manaCost); //i is the choice

                                ret.Add(a);
                                if (trgt != null && trgt.own == p.isOwnTurn) 
                                {
                                    p.moveTrigger.hasOwnTargetMove = true;
                                }
                                //if (trgt != null)
                                //{
                                //    if (trgt.isHero && trgt.Hp <= 12)
                                //    {
                                //        ret.Add(a);
                                //        continue;
                                //    }
                                //    float reward = pen.getOffenseReward(a, p);
                                //    tempRet.Add(new Tuple<Action, float>(a, reward));
                                //}
                                //else 
                                //{
                                //    ret.Add(a);
                                //}
                            }
                        }

                        //tempRet.Sort((x, y) => y.Item2.CompareTo(x.Item2));
                        //if (tempRet.Count > 0)
                        //{
                        //    ret.Add(tempRet[0].Item1);
                        //    if (tempRet[0].Item1.target.own == p.isOwnTurn) 
                        //    {
                        //        p.moveTrigger.hasOwnTargetMove = true;
                        //    }
                        //}
                        //if (tempRet.Count > 1)
                        //{
                        //    ret.Add(tempRet[1].Item1);
                        //    if (tempRet[1].Item1.target.own == p.isOwnTurn)
                        //    {
                        //        p.moveTrigger.hasOwnTargetMove = true;
                        //    }
//.........这里部分代码省略.........
开发者ID:shuyi3,项目名称:AIPJ,代码行数:101,代码来源:Movegenerator.cs


注:本文中的HRSim.Playfield.getBestPlace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。