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


C# Playfield.getAttackTargets方法代码示例

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


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

示例1: isEnemyLowest

 private bool isEnemyLowest(Minion mnn, Playfield p)
 {
     bool ret = true;
     List<Minion> litt = p.getAttackTargets(true);
     int val = getValueOfEnemyMinion(mnn);
     foreach (Minion m in p.enemyMinions)
     {
         if (litt.Find(x => x.entitiyID == m.entitiyID) == null) continue;
         if (getValueOfEnemyMinion(m) < val) ret = false;
     }
     return ret;
 }
开发者ID:kenxp,项目名称:silverfish,代码行数:12,代码来源:PenalityManager.cs

示例2: getMoveList


//.........这里部分代码省略.........
                            if ((!isSpecial || (isSpecial && m.silenced)) && (!otherisSpecial || (otherisSpecial && mnn.silenced))) // both are not special, if they are the same, dont add
                            {
                                if (mnn.Angr == m.Angr && mnn.Hp == m.Hp && mnn.divineshild == m.divineshild && mnn.taunt == m.taunt && mnn.poisonous == m.poisonous) dontattacked = false;
                                continue;
                            }

                            if (isSpecial == otherisSpecial && !m.silenced && !mnn.silenced) // same are special
                            {
                                if (m.name != mnn.name) // different name -> take it
                                {
                                    continue;
                                }
                                // same name -> test whether they are equal
                                if (mnn.Angr == m.Angr && mnn.Hp == m.Hp && mnn.divineshild == m.divineshild && mnn.taunt == m.taunt && mnn.poisonous == m.poisonous) dontattacked = false;
                                continue;
                            }

                        }


                        if (dontattacked)
                        {
                            playedMinions.Add(m);
                        }
                        else
                        {
                            //help.logg(m.name + " doesnt need to attack!");
                            continue;
                        }
                    }
                    //END: cut (double/similar) attacking minions out#####################################

                    //help.logg(m.name + " is going to attack!");
                    List<Minion> trgts = p.getAttackTargets(true);
                    

                    if (isLethalCheck)// only target enemy hero during Lethal check!
                    {
                        if (trgts.Count >= 1 && trgts[0].isHero) // first minion is always hero if existent
                        {
                            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);
                            }
                        }
                    }
                    else
                    {
                        if (useCutingTargets) trgts = this.cutAttackTargets(trgts, p, true);
                    }

                    foreach (Minion trgt in trgts)
                    {
                        if (!m.silenced && m.name == CardDB.cardName.icehowl && trgt.isHero)
                        {
                            continue; //this minion cant attack heros!
                        }
开发者ID:davidmann4,项目名称:silverfish,代码行数:66,代码来源:Movegenerator.cs

示例3: getEnemyMoveList

        //turndeep = progress of current players turn
        public List<Action> getEnemyMoveList(Playfield p, bool isLethalCheck, bool usePenalityManager, bool useCutingTargets, int turndeep)
        {
            //generates only own moves

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

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


            //if he can use ability use it on his turnstart or never!###########################################################################################
            if (turndeep == 0 && p.enemyAbilityReady && p.mana >= 2 && p.enemyHeroAblility.card.canplayCard(p, 0) && p.ownloatheb==0)
            {
                int abilityPenality = 0;

                // if we have mage or priest, we have to target something####################################################
                if (pen.TargetAbilitysDatabase.ContainsKey(p.ownHeroAblility.card.cardIDenum))
                {
                    List<Minion> trgts = p.enemyHeroAblility.card.getTargetsForCardEnemy(p);
                    foreach (Minion trgt in trgts)
                    {
                        if (trgt.isHero) continue;//dont target hero
                        Action a = new Action(actionEnum.useHeroPower, null, null, 0, trgt, abilityPenality, 0);
                        ret.Add(a);
                    }
                }
                else
                {
                    // the other classes dont have to target####################################################
                    Action a = new Action(actionEnum.useHeroPower, null, null, 0, null, abilityPenality, 0);
                    ret.Add(a);
                }
                return ret;
            }


            // attack with minions ###############################################################################################################

            List<Minion> playedMinions = new List<Minion>(8);
            bool attackordermatters = this.didAttackOrderMatters(p);

            foreach (Minion m in p.enemyMinions)
            {

                if (m.Ready && m.Angr >= 1 && !m.frozen)
                {
                    //BEGIN:cut (double/similar) attacking minions out#####################################
                    // DONT LET SIMMILAR MINIONS ATTACK IN ONE TURN (example 3 unlesh the hounds-hounds doesnt need to simulated hole)
                    if (attackordermatters)
                    {
                        List<Minion> tempoo = new List<Minion>(playedMinions);
                        bool dontattacked = true;
                        bool isSpecial = m.handcard.card.isSpecialMinion;
                        foreach (Minion mnn in tempoo)
                        {
                            // special minions are allowed to attack in silended and unsilenced state!
                            //help.logg(mnn.silenced + " " + m.silenced + " " + mnn.name + " " + m.name + " " + penman.specialMinions.ContainsKey(m.name));

                            bool otherisSpecial = mnn.handcard.card.isSpecialMinion;

                            if ((!isSpecial || (isSpecial && m.silenced)) && (!otherisSpecial || (otherisSpecial && mnn.silenced))) // both are not special, if they are the same, dont add
                            {
                                if (mnn.Angr == m.Angr && mnn.Hp == m.Hp && mnn.divineshild == m.divineshild && mnn.taunt == m.taunt && mnn.poisonous == m.poisonous) dontattacked = false;
                                continue;
                            }

                            if (isSpecial == otherisSpecial && !m.silenced && !mnn.silenced) // same are special
                            {
                                if (m.name != mnn.name) // different name -> take it
                                {
                                    continue;
                                }
                                // same name -> test whether they are equal
                                if (mnn.Angr == m.Angr && mnn.Hp == m.Hp && mnn.divineshild == m.divineshild && mnn.taunt == m.taunt && mnn.poisonous == m.poisonous) dontattacked = false;
                                continue;
                            }

                        }

                        if (dontattacked)
                        {
                            playedMinions.Add(m);
                        }
                        else
                        {
                            //help.logg(m.name + " doesnt need to attack!");
                            continue;
                        }
                    }
                    //END: cut (double/similar) attacking minions out#####################################

                    //help.logg(m.name + " is going to attack!");
                    List<Minion> trgts = p.getAttackTargets(false);

                    if (useCutingTargets) trgts = this.cutAttackTargets(trgts, p, false);

                    foreach (Minion trgt in trgts)
//.........这里部分代码省略.........
开发者ID:davidmann4,项目名称:silverfish,代码行数:101,代码来源:Movegenerator.cs

示例4: 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


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