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


C# Playfield.getBestPlace方法代码示例

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


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

示例1: doAllChoices


//.........这里部分代码省略.........
                    if (i == 1)
                    {
                        c = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.EX1_154a);
                    }
                    if (i == 2)
                    {
                        c = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.EX1_154b);
                    }
                }
                if (c.name == CardDB.cardName.livingroots)
                {
                    if (i == 1)
                    {
                        c = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.AT_037a);
                    }
                    if (i == 2)
                    {
                        c = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.AT_037b);
                    }
                }
                if (c.name == CardDB.cardName.druidofthesaber)
                {
                    if (i == 1)
                    {
                        c = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.AT_042a);
                    }
                    if (i == 2)
                    {
                        c = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.AT_042b);
                    }
                }

                if (c.canplayCard(p, hc.manacost))
                {

                    int bestplace = p.getBestPlace(c, lethalcheck);
                    List<Minion> trgts = c.getTargetsForCard(p);
                    int cardplayPenality = 0;
                    if (trgts.Count == 0)
                    {


                        if (usePenalityManager)
                        {
                            cardplayPenality = pen.getPlayCardPenality(hc, null, p, i, lethalcheck);
                            if (cardplayPenality <= 499)
                            {
                                //help.logg(hc.card.name + " is played");
                                //pf.playCard(hc, hc.position - 1, hc.entity, -1, -1, i, bestplace, cardplayPenality);
                                // i is the choice
                                Action a = new Action(actionEnum.playcard, hc, null, bestplace, null, cardplayPenality, i);
                                //pf.playCard(hc, hc.position - 1, hc.entity, -1, -1, 0, bestplace, cardplayPenality);
                                returnlist.Add(a);
                            }
                        }
                        else
                        {
                            //pf.playCard(hc, hc.position - 1, hc.entity, -1, -1, i, bestplace, cardplayPenality);

                            Action a = new Action(actionEnum.playcard, hc, null, bestplace, null, cardplayPenality, i);
                            returnlist.Add(a);
                        }

                    }
                    else
                    {
                        foreach (Minion trgt in trgts)
                        {

                            if (usePenalityManager)
                            {
                                cardplayPenality = pen.getPlayCardPenality(hc, trgt, p, i, lethalcheck);

                                if (cardplayPenality <= 499)
                                {
                                    //help.logg(hc.card.name + " is played");
                                    //pf.playCard(hc, hc.position - 1, hc.entity, trgt.target, trgt.targetEntity, i, bestplace, cardplayPenality);

                                    Action a = new Action(actionEnum.playcard, hc, null, bestplace, trgt, cardplayPenality, i); //i is the choice
                                    returnlist.Add(a);
                                }
                            }
                            else
                            {
                                //pf.playCard(hc, hc.position - 1, hc.entity, trgt.target, trgt.targetEntity, i, bestplace, cardplayPenality);

                                Action a = new Action(actionEnum.playcard, hc, null, bestplace, trgt, cardplayPenality, i); //i is the choice
                                returnlist.Add(a);
                            }

                        }
                    }

                }

            }


            return returnlist;
        }
开发者ID:davidmann4,项目名称:silverfish,代码行数:101,代码来源:Movegenerator.cs

示例2: getMoveList

        public List<Action> getMoveList(Playfield p, bool isLethalCheck, bool usePenalityManager, bool useCutingTargets)
        {
            //generates only own moves

            List<Action> ret = new List<Action>();

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

            //play cards:

            List<CardDB.cardName> playedcards = new List<CardDB.cardName>();

            bool superplacement = false;
            bool useplacement = Settings.Instance.simulatePlacement && p.turnCounter == 0 && p.ownMinions.Count >= 2;
            foreach (Minion hc in p.ownMinions)
            {
                if (hc.handcard.card.name == CardDB.cardName.direwolfalpha || hc.handcard.card.name == CardDB.cardName.flametonguetotem || hc.handcard.card.name == CardDB.cardName.defenderofargus)
                {
                    superplacement = true;
                    break;
                }

            }

            foreach (Handmanager.Handcard hc in p.owncards)
            {
                CardDB.Card c = hc.card;
                //help.logg("try play crd" + c.name + " " + c.getManaCost(p) + " " + c.canplayCard(p));
                if (playedcards.Contains(c.name)) continue; // dont play the same card in one loop
                playedcards.Add(c.name);

                if (c.choice)
                {
                    ret.AddRange(this.doAllChoices(p, hc, isLethalCheck, usePenalityManager));
                }
                else
                {
                    int bestplace = p.getBestPlace(c, isLethalCheck);
                    if (hc.canplayCard(p))
                    {
                        List<Minion> trgts = c.getTargetsForCard(p);

                        if (isLethalCheck && trgts.Count >= 1 && (c.damagesTarget || c.damagesTargetWithSpecial))// only target enemy hero during Lethal check!
                        {
                            if (trgts.Count >= 1 && trgts[0].isHero && !trgts[0].own) // first minion is enemy hero (or he is not in list)
                            {
                                trgts.Clear();
                                trgts.Add(p.enemyHero);
                            }
                            else
                            {
                                // no enemy hero -> enemy have taunts ->kill the taunts from left to right
                                if (trgts.Count >= 1)
                                {
                                    Minion trg = trgts[0];
                                    trgts.Clear();
                                    trgts.Add(trg);
                                }
                            }
                        }


                        int cardplayPenality = 0;

                        if (trgts.Count == 0)
                        {


                            if (usePenalityManager)
                            {
                                cardplayPenality = pen.getPlayCardPenality(hc, null, p, 0, isLethalCheck);
                                if (cardplayPenality <= 499)
                                {

                                    if (useplacement && ((hc.card.name == CardDB.cardName.direwolfalpha || hc.card.name == CardDB.cardName.flametonguetotem || hc.card.name == CardDB.cardName.defenderofargus) || (superplacement && hc.card.type == CardDB.cardtype.MOB)))
                                    {
                                        int adding = 1;
                                        int subbing = 0;
                                        if (hc.card.name == CardDB.cardName.direwolfalpha || hc.card.name == CardDB.cardName.flametonguetotem)//|| hc.card.name == CardDB.cardName.defenderofargus)
                                        {
                                            adding = 2;
                                            subbing = 1;
                                        }
                                        //Helpfunctions.Instance.ErrorLog(adding + " " + subbing + " " + p.ownMinions.Count);
                                        for (int placer = 0; placer < p.ownMinions.Count - subbing; placer++)
                                        {
                                            Action a = new Action(actionEnum.playcard, hc, null, placer + adding, null, cardplayPenality, 0);
                                            //Helpfunctions.Instance.ErrorLog("place " +hc.card.name + " on pos " + (placer+adding) + " mincount " + p.ownMinions.Count);
                                            //pf.playCard(hc, hc.position - 1, hc.entity, -1, -1, 0, bestplace, cardplayPenality);
                                            ret.Add(a);
                                        }
                                    }
                                    else
                                    {
                                        Action a = new Action(actionEnum.playcard, hc, null, bestplace, null, cardplayPenality, 0);
                                        //pf.playCard(hc, hc.position - 1, hc.entity, -1, -1, 0, bestplace, cardplayPenality);
                                        ret.Add(a);
//.........这里部分代码省略.........
开发者ID:davidmann4,项目名称:silverfish,代码行数:101,代码来源:Movegenerator.cs

示例3: doAllChoices


//.........这里部分代码省略.........
                    }
                }
                if (c.name == CardDB.cardName.druidofthesaber)
                {
                    if (i == 1)
                    {
                        c = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.AT_042a);
                    }
                    if (i == 2)
                    {
                        c = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.AT_042b);
                    }
                }

                if (hcc.isChoiceTemp)
                {
                    i = 0;//its not a druid-choice
                    tracking = j;
                    hc = Handmanager.Instance.getCardChoice(tracking - 1);
                    c = hc.card;
                    //the tracking/discover card is a druid-choice-card himself :D
                    if (c.choice)
                    {
                        //Helpfunctions.Instance.ErrorLog("choice tracking " + c.name);
                        Handmanager.Handcard hccc = Handmanager.Instance.getCardChoice(tracking - 1);
                        returnlist.AddRange(doAllChoices( p, hccc, lethalcheck, usePenalityManager, tracking));
                        continue;
                    }
                    
                    basemana = c.cost;
                }

                if (c.canplayCard(p, basemana))
                {

                    int bestplace = p.getBestPlace(c, lethalcheck);
                    List<Minion> trgts = c.getTargetsForCard(p);
                    int cardplayPenality = 0;
                    if (trgts.Count == 0)
                    {


                        if (usePenalityManager)
                        {
                            cardplayPenality = pen.getPlayCardPenality(hc, null, p, i, lethalcheck);
                            if (cardplayPenality <= 499)
                            {
                                //help.logg(hc.card.name + " is played");
                                //pf.playCard(hc, hc.position - 1, hc.entity, -1, -1, i, bestplace, cardplayPenality);
                                // i is the choice
                                Action a = new Action(actionEnum.playcard, hc, null, bestplace, null, cardplayPenality, i , tracking);
                                //pf.playCard(hc, hc.position - 1, hc.entity, -1, -1, 0, bestplace, cardplayPenality);
                                returnlist.Add(a);
                            }
                        }
                        else
                        {
                            //pf.playCard(hc, hc.position - 1, hc.entity, -1, -1, i, bestplace, cardplayPenality);

                            Action a = new Action(actionEnum.playcard, hc, null, bestplace, null, cardplayPenality, i , tracking);
                            returnlist.Add(a);
                        }

                    }
                    else
                    {
                        foreach (Minion trgt in trgts)
                        {

                            if (usePenalityManager)
                            {
                                cardplayPenality = pen.getPlayCardPenality(hc, trgt, p, i, lethalcheck);

                                if (cardplayPenality <= 499)
                                {
                                    //help.logg(hc.card.name + " is played");
                                    //pf.playCard(hc, hc.position - 1, hc.entity, trgt.target, trgt.targetEntity, i, bestplace, cardplayPenality);

                                    Action a = new Action(actionEnum.playcard, hc, null, bestplace, trgt, cardplayPenality, i , tracking); //i is the choice
                                    returnlist.Add(a);
                                }
                            }
                            else
                            {
                                //pf.playCard(hc, hc.position - 1, hc.entity, trgt.target, trgt.targetEntity, i, bestplace, cardplayPenality);

                                Action a = new Action(actionEnum.playcard, hc, null, bestplace, trgt, cardplayPenality, i , tracking); //i is the choice
                                returnlist.Add(a);
                            }

                        }
                    }

                }

            }


            return returnlist;
        }
开发者ID:noHero123,项目名称:silverfish,代码行数:101,代码来源:Movegenerator.cs

示例4: doAllChoices

        private bool doAllChoices( Playfield p, Handmanager.Handcard hc, bool lethalcheck)
        {
            bool havedonesomething = false;

            for (int i = 1; i < 3; i++)
            {
                CardDB.Card c = hc.card;
                if (c.name == "starfall")
                {
                    if (i == 1)
                    {
                        c = CardDB.Instance.getCardDataFromID("NEW1_007b");
                    }
                    if (i == 2)
                    {
                        c = CardDB.Instance.getCardDataFromID("NEW1_007a");
                    }
                }

                if (c.name == "ancientoflore")
                {
                    if (i == 1)
                    {
                        c = CardDB.Instance.getCardDataFromID("NEW1_008a");
                    }
                    if (i == 2)
                    {
                        c = CardDB.Instance.getCardDataFromID("NEW1_008b");
                    }
                }

                if (hc.canplayCard(p))
                {
                    havedonesomething = true;

                    int bestplace = p.getBestPlace(c);
                    List<targett> trgts = c.getTargetsForCard(p);
                    int cardplayPenality = 0;
                    if (trgts.Count == 0)
                    {

                        if (usePenalityManager)
                        {
                            cardplayPenality = penman.getPlayCardPenality(c, -1, p, i, lethalcheck);
                            if (cardplayPenality <= 499)
                            {
                                Playfield pf = new Playfield(p);
                                pf.playCard(hc, hc.position - 1, hc.entity, -1, -1, i, bestplace, cardplayPenality);
                                this.posmoves.Add(pf);
                            }
                        }
                        else
                        {
                            Playfield pf = new Playfield(p);
                            pf.playCard(hc, hc.position - 1, hc.entity, -1, -1, i, bestplace, cardplayPenality);
                            this.posmoves.Add(pf);
                        }

                    }
                    else
                    {
                        foreach (targett trgt in trgts)
                        {

                            if (usePenalityManager)
                            {
                                cardplayPenality = penman.getPlayCardPenality(c, -1, p, i, lethalcheck);
                                if (cardplayPenality <= 499)
                                {
                                    Playfield pf = new Playfield(p);
                                    pf.playCard(hc, hc.position - 1, hc.entity, trgt.target, trgt.targetEntity, i, bestplace, cardplayPenality);
                                    this.posmoves.Add(pf);
                                }
                            }
                            else
                            {
                                Playfield pf = new Playfield(p);
                                pf.playCard(hc, hc.position - 1, hc.entity, trgt.target, trgt.targetEntity, i, bestplace, cardplayPenality);
                                this.posmoves.Add(pf);
                            }

                        }
                    }

                }

            }

            return havedonesomething;
        }
开发者ID:k3nj1,项目名称:HRCustomClasses,代码行数:90,代码来源:Ai.cs

示例5: getMoveList

        public List<Action> getMoveList(Playfield p, bool isLethalCheck, bool usePenalityManager, bool useCutingTargets)
        {
            //generates only own moves
            List<Action> ret = new List<Action>();
            List<Minion> trgts = new List<Minion>();

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

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

            foreach (Handmanager.Handcard hc in p.owncards)
            {
                CardDB.Card c = hc.card;
                if (playedcards.Contains(c.name) || !hc.canplayCard(p)) 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 = pen.getChooseCard(hc.card, i); // do all choice

                    if (p.mana >= c.getManaCost(p, hc.manacost)) // if enough manna
                    {
                        int cardplayPenality = 0;
                        int bestplace = p.getBestPlace(c, isLethalCheck);
                        trgts = c.getTargetsForCard(p, isLethalCheck);
                        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); //i is the choice
                                ret.Add(a);
                            }
                        }
                    }
                }
            }

            foreach (Action a in ret)
            {
                if (a.actionType == actionEnum.playcard)
                {
                    bool isCardValid = false;
                    foreach (Handmanager.Handcard hh in p.owncards)
                    {
                        if (hh.entity == a.card.entity)
                        {
                            isCardValid = true;
                            break;
                        }
                    }
                    if (!isCardValid)
                    {
                        int debug1 = 1;
                    }
                }
            }

          //get targets for Hero weapon and Minions  ###################################################################################

            trgts = p.getAttackTargets(true, isLethalCheck);
            if (!isLethalCheck) trgts = this.cutAttackList(trgts);

          // attack with minions
            List<Minion> attackingMinions = new List<Minion>(8);
            foreach (Minion m in p.ownMinions)
            {
                if (m.Ready && m.Angr >= 1 && !m.frozen) attackingMinions.Add(m); //* add non-attacing minions
            }
            attackingMinions = this.cutAttackList(attackingMinions);

            foreach (Minion m in attackingMinions)
            {
                int attackPenality = 0;
                foreach (Minion trgt in trgts)
                {
                    if (usePenalityManager) attackPenality = pen.getAttackWithMininonPenality(m, p, trgt, isLethalCheck);
                    if (attackPenality <= 499)
                    {
                        Action a = new Action(actionEnum.attackWithMinion, null, m, 0, trgt, attackPenality, 0);
                        ret.Add(a);
                    }
                }
            }

          // attack with hero (weapon)
            if (p.ownHero.Ready && p.ownHero.Angr >= 1)
            {
                int heroAttackPen = 0;
                foreach (Minion trgt in trgts)
                {
                    if (usePenalityManager) heroAttackPen = pen.getAttackWithHeroPenality(trgt, p, isLethalCheck);
                    if (heroAttackPen <= 499)
                    {
                        Action a = new Action(actionEnum.attackWithHero, null, p.ownHero, 0, trgt, heroAttackPen, 0);
//.........这里部分代码省略.........
开发者ID:shuyi3,项目名称:AIPJ,代码行数:101,代码来源:Movegenerator.cs

示例6: doAllChoices


//.........这里部分代码省略.........
                }
                if (c.name == CardDB.cardName.markofnature)
                {
                    if (i == 1)
                    {
                        c = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.EX1_155a);
                    }
                    if (i == 2)
                    {
                        c = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.EX1_155b);
                    }
                }
                if (c.name == CardDB.cardName.nourish)
                {
                    if (i == 1)
                    {
                        c = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.EX1_164a);
                    }
                    if (i == 2)
                    {
                        c = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.EX1_164b);
                    }
                }
                if (c.name == CardDB.cardName.wrath)
                {
                    if (i == 1)
                    {
                        c = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.EX1_154a);
                    }
                    if (i == 2)
                    {
                        c = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.EX1_154b);
                    }
                }

                if (c.canplayCard(p, hc.manacost))
                {
                    havedonesomething = true;



                    int bestplace = p.getBestPlace(c, lethalcheck);
                    List<targett> trgts = c.getTargetsForCard(p);
                    int cardplayPenality = 0;
                    if (trgts.Count == 0)
                    {


                        if (usePenalityManager)
                        {
                            cardplayPenality = pen.getPlayCardPenality(hc.card, -1, p, i, lethalcheck);
                            if (cardplayPenality <= 499)
                            {
                                //help.logg(hc.card.name + " is played");
                                Playfield pf = new Playfield(p);
                                pf.playCard(hc, hc.position - 1, hc.entity, -1, -1, i, bestplace, cardplayPenality);
                                addToPosmoves(pf);
                            }
                        }
                        else
                        {
                            Playfield pf = new Playfield(p);
                            pf.playCard(hc, hc.position - 1, hc.entity, -1, -1, i, bestplace, cardplayPenality);
                            addToPosmoves(pf);
                        }

                    }
                    else
                    {
                        foreach (targett trgt in trgts)
                        {

                            if (usePenalityManager)
                            {
                                cardplayPenality = pen.getPlayCardPenality(hc.card, trgt.target, p, 0, lethalcheck);
                                if (cardplayPenality <= 499)
                                {
                                    //help.logg(hc.card.name + " is played");
                                    Playfield pf = new Playfield(p);
                                    pf.playCard(hc, hc.position - 1, hc.entity, trgt.target, trgt.targetEntity, i, bestplace, cardplayPenality);
                                    addToPosmoves(pf);
                                }
                            }
                            else
                            {
                                Playfield pf = new Playfield(p);
                                pf.playCard(hc, hc.position - 1, hc.entity, trgt.target, trgt.targetEntity, i, bestplace, cardplayPenality);
                                addToPosmoves(pf);
                            }

                        }
                    }

                }

            }


            return havedonesomething;
        }
开发者ID:JulioCL,项目名称:HRCustomClasses,代码行数:101,代码来源:MiniSimulatorNextTurn.cs

示例7: doAllChoices

        private bool doAllChoices(CardDB.Card card, Playfield p, Handmanager.Handcard hc)
        {
            bool havedonesomething = false;

            for (int i = 1; i < 3; i++)
            {
                CardDB.Card c = card;
                if (card.name == "sternenregen")
                {
                    if (i == 1)
                    {
                        c = CardDB.Instance.getCardDataFromID("NEW1_007b");
                    }
                    if (i == 2)
                    {
                        c = CardDB.Instance.getCardDataFromID("NEW1_007a");
                    }
                }

                if (card.name == "urtumderlehren")
                {
                    if (i == 1)
                    {
                        c = CardDB.Instance.getCardDataFromID("NEW1_008a");
                    }
                    if (i == 2)
                    {
                        c = CardDB.Instance.getCardDataFromID("NEW1_008b");
                    }
                }

                if (c.canplayCard(p))
                {
                    havedonesomething = true;

                    int bestplace = p.getBestPlace(c);
                    List<targett> trgts = c.getTargetsForCard(p);

                    if (trgts.Count == 0)
                    {
                        Playfield pf = new Playfield(p);

                        pf.playCard(card, hc.position - 1, hc.entity, -1, -1, i, bestplace);
                        this.posmoves.Add(pf);
                    }
                    else
                    {
                        foreach (targett trgt in trgts)
                        {
                            Playfield pf = new Playfield(p);
                            pf.playCard(card, hc.position - 1, hc.entity, trgt.target, trgt.targetEntity, i, bestplace);
                            this.posmoves.Add(pf);
                        }
                    }

                }

            }

            return havedonesomething;
        }
开发者ID:phil01les,项目名称:HRCustomClasses,代码行数:61,代码来源:Ai.cs


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