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


C# Playfield.getRandomMinionFromSide_SERVER方法代码示例

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


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

示例1: onCardPlay

        //Destroy 2 random enemy minions. Discard 2 random cards.

        public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice)
        {
            if (p.isServer)
            {
                Minion choosen = p.getRandomMinionFromSide_SERVER(!ownplay, false);
                if (choosen != null) p.minionGetDestroyed(choosen);

                choosen = p.getRandomMinionFromSide_SERVER(!ownplay, false);
                if (choosen != null) p.minionGetDestroyed(choosen);

                p.discardRandomCard_SERVER(ownplay);
                p.discardRandomCard_SERVER(ownplay);
                return;
            }


            Minion choosen2 = p.searchRandomMinion(p.enemyMinions, Playfield.searchmode.searchLowestAttack);
            if (choosen2 != null) p.minionGetDestroyed(choosen2);

            choosen2 = p.searchRandomMinion(p.enemyMinions, Playfield.searchmode.searchLowestAttack);
            if (choosen2 != null) p.minionGetDestroyed(choosen2);

            p.disCardACard(ownplay);
            p.disCardACard(ownplay);
        }
开发者ID:protopenguin,项目名称:silverfish,代码行数:27,代码来源:Sim_AT_025.cs

示例2: onCardPlay

        //   Hero Power: Deal 8 damage to a random enemy. TWICE.

        public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice)
        {

            int dmg = 8;
            if (ownplay)
            {
                dmg += p.anzOwnFallenHeros;
                if (p.doublepriest >= 1) dmg *= (2 * p.doublepriest);
            }
            else
            {
                dmg += p.anzEnemyFallenHeros;
                if (p.enemydoublepriest >= 1) dmg *= (2 * p.enemydoublepriest);
            }

            if (p.isServer)
            {
                Minion poortarget = p.getRandomMinionFromSide_SERVER(!ownplay, true);
                if (poortarget != null) p.minionGetDamageOrHeal(poortarget, dmg);
                return;
            }




            int count = (ownplay) ? p.enemyMinions.Count : p.ownMinions.Count;
            if (count >= 1)
            {
                List<Minion> temp2 = (ownplay) ? new List<Minion>(p.enemyMinions) : new List<Minion>(p.ownMinions);
                temp2.Sort((a, b) => a.Hp.CompareTo(b.Hp));//damage the lowest
                foreach (Minion mins in temp2)
                {
                    p.minionGetDamageOrHeal(mins, dmg);
                    break;
                }
            }
            else
            {
                p.minionGetDamageOrHeal(ownplay ? p.enemyHero : p.ownHero, dmg);
            }

            p.doDmgTriggers();

            count = (ownplay) ? p.enemyMinions.Count : p.ownMinions.Count;
            if (count >= 1)
            {
                List<Minion> temp2 = (ownplay) ? new List<Minion>(p.enemyMinions) : new List<Minion>(p.ownMinions);
                temp2.Sort((a, b) => a.Hp.CompareTo(b.Hp));//damage the lowest
                foreach (Minion mins in temp2)
                {
                    p.minionGetDamageOrHeal(mins, dmg);
                    break;
                }
            }
            else
            {
                p.minionGetDamageOrHeal(ownplay ? p.enemyHero : p.ownHero, dmg);
            }

        }
开发者ID:cookiezeater,项目名称:silverfish,代码行数:62,代码来源:Sim_BRM_027pH.cs

示例3: onTurnEndsTrigger

        //    kann nicht angreifen. fügt am ende eures zuges einem zufälligen feind 8 schaden zu.

        public override void onTurnEndsTrigger(Playfield p, Minion triggerEffectMinion, bool turnEndOfOwner)
        {
            if (p.isServer)
            {
                Minion choosen = p.getRandomMinionFromSide_SERVER(!triggerEffectMinion.own, true);
                if (choosen != null) p.minionGetDamageOrHeal(choosen, 8);
                return;
            }

            if (triggerEffectMinion.own == turnEndOfOwner)
            {
                int count = (turnEndOfOwner) ? p.enemyMinions.Count : p.ownMinions.Count;
                if (count >= 1)
                {
                    List<Minion> temp2 = (turnEndOfOwner) ? new List<Minion>(p.enemyMinions) : new List<Minion>(p.ownMinions);
                    temp2.Sort((a, b) => a.Hp.CompareTo(b.Hp));//damage the lowest
                    foreach (Minion mins in temp2)
                    {
                        p.minionGetDamageOrHeal(mins, 8);
                        break;
                    }
                }
                else
                {
                    p.minionGetDamageOrHeal(turnEndOfOwner ? p.enemyHero : p.ownHero, 8);
                }
                triggerEffectMinion.stealth = false;
            }
        }
开发者ID:cookiezeater,项目名称:silverfish,代码行数:31,代码来源:Sim_EX1_298.cs

示例4: onTurnStartTrigger

        //    fügt zu beginn eures zuges einem zufälligen feind 2 schaden zu.

        public override void onTurnStartTrigger(Playfield p, Minion triggerEffectMinion, bool turnStartOfOwner)
        {
            if (triggerEffectMinion.own == turnStartOfOwner)
            {

                if (p.isServer)
                {
                    Minion choosen = p.getRandomMinionFromSide_SERVER(!triggerEffectMinion.own, true);
                    if (choosen != null) p.minionGetDamageOrHeal( choosen, 2);
                    return;
                }

                List<Minion> temp2 = (turnStartOfOwner) ? p.enemyMinions : p.ownMinions;
                bool dmgdone = false;
                foreach (Minion mins in temp2)
                {
                    p.minionGetDamageOrHeal(mins, 2);
                    dmgdone = true;
                    break;
                }
                if (!dmgdone)
                {
                    p.minionGetDamageOrHeal(turnStartOfOwner ? p.enemyHero : p.ownHero, 2);
                };
            }
        }
开发者ID:cookiezeater,项目名称:silverfish,代码行数:28,代码来源:Sim_EX1_102.cs

示例5: getBattlecryEffect

        // Battlecry: Deal 4 damage to a random enemy minion.  

        public override void getBattlecryEffect(Playfield p, Minion own, Minion target, int choice)
        {
            if (p.isServer)
            {
                Minion choosen = p.getRandomMinionFromSide_SERVER(!own.own, false);
                if (choosen != null) p.minionGetDamageOrHeal(choosen, 4);
                return;
            }

            List<Minion> temp = (own.own) ? p.enemyMinions : p.ownMinions;
            int times = 4;

            if (temp.Count >= 1)
            {
                //search Minion with lowest hp
                Minion enemy = temp[0];
                int minhp = 10000;
                foreach (Minion m in temp)
                {
                    if (m.Hp >= times + 1 && minhp > m.Hp)
                    {
                        enemy = m;
                        minhp = m.Hp;
                    }
                }

                p.minionGetDamageOrHeal(enemy, times);

            } 
        }
开发者ID:cookiezeater,项目名称:silverfish,代码行数:32,代码来源:Sim_GvG_099.cs

示例6: onDeathrattle

        //todo make it better
//    todesröcheln:/ übernehmt die kontrolle über einen zufälligen feindlichen diener.
        public override void onDeathrattle(Playfield p, Minion m)
        {
            if (p.isServer)
            {
                Minion choosen = p.getRandomMinionFromSide_SERVER(!m.own, false);
                if (choosen != null) p.minionGetControlled(choosen, m.own, false);
                return;
            }

                List<Minion> tmp = (m.own) ? p.enemyMinions : p.ownMinions;
                if (tmp.Count >= 1)
                {
                    Minion target = null;
                    int value = 10000;
                    bool found = false;

                    //search smallest minion:
                    foreach (Minion mnn in tmp)
                    {
                        if (mnn.Hp < value && mnn.Hp >= 1)
                        {
                            target = mnn;
                            value = target.Hp;
                            found = true;
                        }
                    }
                    if (found) p.minionGetControlled(target, m.own, false);
                }

            
        }
开发者ID:peppert,项目名称:silverfish,代码行数:33,代码来源:Sim_EX1_016.cs

示例7: onCardPlay

        //    Deal $4 damage to a random enemy minion.

        public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice)
        {
            if (p.isServer)
            {
                int dmg = (ownplay) ? p.getSpellDamageDamage(4) : p.getEnemySpellDamageDamage(4);
                Minion poortarget = p.getRandomMinionFromSide_SERVER(!ownplay, false);
                if (poortarget != null) p.minionGetDamageOrHeal(poortarget, dmg);
                return;
            }

            // optimistic

            List<Minion> temp = (ownplay) ? p.enemyMinions : p.ownMinions;
            int times = (ownplay) ? p.getSpellDamageDamage(4) : p.getEnemySpellDamageDamage(4);

            if (temp.Count >= 1)
            {
                //search Minion with lowest hp
                Minion enemy = temp[0];
                int minhp = 10000;
                foreach (Minion m in temp)
                {
                    if (m.Hp >= times + 1 && minhp > m.Hp)
                    {
                        enemy = m;
                        minhp = m.Hp;
                    }
                }

                p.minionGetDamageOrHeal(enemy, times);

            }
        }
开发者ID:peppert,项目名称:silverfish,代码行数:35,代码来源:Sim_GvG_001.cs

示例8: onCardPlay

        //    Give your weapon +3 Attack. Combo: Give a random friendly minion +3 Attack.

        public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice)
        {
            if (p.isServer)
            {
                if (ownplay)
                {
                    if (p.ownWeaponDurability >= 1)
                    {
                        p.ownWeaponAttack += 3;
                        p.minionGetBuffed(p.ownHero, 3, 0);
                    }
                    
                }
                else
                {
                    if (p.enemyWeaponDurability >= 1)
                    {
                        p.enemyWeaponAttack += 3;
                        p.minionGetBuffed(p.enemyHero, 3, 0);
                    }
                    
                }

                if (p.cardsPlayedThisTurn >= 1 )
                {
                    Minion choosen = p.getRandomMinionFromSide_SERVER(ownplay, false);
                    if (choosen != null) p.minionGetBuffed(choosen, 3, 0); 
                }
                
                return;
            }

            if (ownplay)
            {
                if (p.ownWeaponDurability >= 1)
                {
                    p.ownWeaponAttack += 3;
                    p.minionGetBuffed(p.ownHero, 3, 0);
                }
                if (p.cardsPlayedThisTurn >= 1 && p.ownMinions.Count >= 1)
                {
                    p.minionGetBuffed(p.searchRandomMinion(p.ownMinions, Playfield.searchmode.searchLowestHP), 3, 0);
                }
            }
            else
            {
                if (p.enemyWeaponDurability >= 1)
                {
                    p.enemyWeaponAttack += 3;
                    p.minionGetBuffed(p.enemyHero, 3, 0);
                }
                if (p.cardsPlayedThisTurn >= 1 && p.enemyMinions.Count >= 1)
                {
                    p.minionGetBuffed(p.searchRandomMinion(p.enemyMinions, Playfield.searchmode.searchHighestHP), 3, 0);
                }
            }
        }
开发者ID:cookiezeater,项目名称:silverfish,代码行数:59,代码来源:Sim_GvG_022.cs

示例9: onCardWasPlayed

        //    After you cast a spell, deal 2 damage randomly split among all enemies.

        public override void onCardWasPlayed(Playfield p, CardDB.Card c, bool wasOwnCard, Minion triggerEffectMinion)
        {
            if (triggerEffectMinion.own == wasOwnCard)
            {
                if (p.isServer)
                {
                    int timesS = 2;
                    for (int iS = 0; iS < timesS; iS++)
                    {
                        Minion poortarget = p.getRandomMinionFromSide_SERVER(!wasOwnCard, true);
                        if (poortarget != null) p.minionGetDamageOrHeal(poortarget, 1);
                    }
                    return;
                }

                List<Minion> temp = (triggerEffectMinion.own) ? p.enemyMinions : p.ownMinions;
                for (int i = 0; i < 2; i++)
                {
                    if (temp.Count >= 1)
                    {
                        //search Minion with lowest hp
                        Minion enemy = temp[0];
                        int minhp = 10000;
                        bool found = false;
                        foreach (Minion m in temp)
                        {
                            if (m.name == CardDB.cardName.nerubianegg && m.Hp >= 2) continue; //dont attack nerubianegg!
                            if (m.handcard.card.isToken && m.Hp == 1) continue;
                            if (m.name == CardDB.cardName.defender) continue;
                            if (m.name == CardDB.cardName.spellbender) continue;
                            if (m.Hp >= 2 && minhp > m.Hp)
                            {
                                enemy = m;
                                minhp = m.Hp;
                                found = true;
                            }
                        }

                        if (found)
                        {
                            p.minionGetDamageOrHeal(enemy, 1);
                        }
                        else
                        {
                            p.minionGetDamageOrHeal(triggerEffectMinion.own ? p.enemyHero : p.ownHero, 1);
                        }

                    }
                    else
                    {
                        p.minionGetDamageOrHeal(triggerEffectMinion.own ? p.enemyHero : p.ownHero, 1);
                    }
                }

                triggerEffectMinion.stealth = false;
            }
        }
开发者ID:peppert,项目名称:silverfish,代码行数:59,代码来源:Sim_BRM_002.cs

示例10: onMinionWasSummoned

        //    fügt einem zufälligen feind 1 schaden zu, nachdem ihr einen diener herbeigerufen habt.
        public override void onMinionWasSummoned(Playfield p, Minion triggerEffectMinion, Minion summonedMinion)
        {
            if (triggerEffectMinion.entityID != summonedMinion.entityID && triggerEffectMinion.own == summonedMinion.own)
            {
                if (p.isServer)
                {
                    Minion choosen = p.getRandomMinionFromSide_SERVER(!triggerEffectMinion.own, true);
                    if (choosen != null)
                    {
                        p.minionGetDamageOrHeal(choosen, 1);
                        triggerEffectMinion.stealth = false;
                    }
                    return;
                }

                List<Minion> temp = (triggerEffectMinion.own) ? p.enemyMinions : p.ownMinions;

                if (temp.Count >= 1)
                {
                    //search Minion with lowest hp
                    Minion enemy = temp[0];
                    int minhp = 10000;
                    bool found = false;
                    foreach (Minion m in temp)
                    {
                        if (m.name == CardDB.cardName.nerubianegg && m.Hp >= 2) continue; //dont attack nerubianegg!
                        if (m.handcard.card.isToken && m.Hp == 1) continue;
                        if (m.name == CardDB.cardName.defender) continue;
                        if (m.name == CardDB.cardName.spellbender) continue;
                        if (m.Hp >= 2 && minhp > m.Hp)
                        {
                            enemy = m;
                            minhp = m.Hp;
                            found = true;
                        }
                    }

                    if (found)
                    {
                        p.minionGetDamageOrHeal(enemy, 1);
                    }
                    else
                    {
                        p.minionGetDamageOrHeal(triggerEffectMinion.own ? p.enemyHero : p.ownHero, 1);
                    }

                }
                else
                {
                    p.minionGetDamageOrHeal(triggerEffectMinion.own ? p.enemyHero : p.ownHero, 1);
                }

                triggerEffectMinion.stealth = false;
            }
        }
开发者ID:cookiezeater,项目名称:silverfish,代码行数:56,代码来源:Sim_NEW1_019.cs

示例11: onCardPlay

        //   When you play or discard this, deal $4 damage to a random enemy.<

        public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice)
        {

            int dmg = (ownplay) ? p.getSpellDamageDamage(4) : p.getEnemySpellDamageDamage(4);
            if (p.isServer)
            {
                Minion choosen = p.getRandomMinionFromSide_SERVER(!ownplay, true);
                if (choosen != null) p.minionGetDamageOrHeal(choosen, dmg);
                return;
            }
            p.doDmgToRandomEnemyCLIENT(dmg, true, !ownplay);
        }
开发者ID:protopenguin,项目名称:silverfish,代码行数:14,代码来源:Sim_AT_022.cs

示例12: onDeathrattle

        //todo make it better
//    todesröcheln:/ übernehmt die kontrolle über einen zufälligen feindlichen diener.
        public override void onDeathrattle(Playfield p, Minion m)
        {
            if (p.isServer)
            {
                Minion choosen = p.getRandomMinionFromSide_SERVER(!m.own, false);
                if (choosen != null) p.minionGetControlled(choosen, m.own, false);
                return;
            }

                List<Minion> tmp = (m.own) ? p.enemyMinions : p.ownMinions;
                if (tmp.Count >= 1)
                {
                    Minion target = null;
                    int value = 10000;
                    bool found = false;

                    //search smallest minion:
                    if (m.own)
                    {
                        foreach (Minion mnn in tmp)
                        {
                            if (mnn.Hp < value && mnn.Hp >= 1)
                            {
                                target = mnn;
                                value = target.Hp;
                                found = true;
                            }
                        }
                    }
                    else
                    {
                        //steal a minion with has not attacked or has taunt
                        value = -1000;
                        foreach (Minion mnn in tmp)
                        {
                            int special = (m.Ready) ? 10 : 0;
                            special += (m.taunt) ? 5 : 0;
                            special += mnn.Hp;
                            if (special > value)
                            {
                                
                                target = mnn;
                                value = special;
                                found = true;
                            }
                        }
                    }
                    if (found) p.minionGetControlled(target, m.own, false);
                }

            
        }
开发者ID:noHero123,项目名称:silverfish,代码行数:54,代码来源:Sim_EX1_016.cs

示例13: onDeathrattle

        //  Deathrattle: Deal 1 damage to a random enemy.

        

        public override void onDeathrattle(Playfield p, Minion m)
        {
            if (p.isServer)
            {
                int randdmg = 1;
                Minion poortarget = p.getRandomMinionFromSide_SERVER(!m.own, true);
                if (poortarget != null) p.minionGetDamageOrHeal(poortarget, randdmg);
                return;
            }

            p.doDmgToRandomEnemyCLIENT2(1, true, m.own);

        }
开发者ID:noHero123,项目名称:silverfish,代码行数:17,代码来源:Sim__LOE_046.cs

示例14: getBattlecryEffect

        //    Battlecry: If you have a Mech, deal 4 damage randomly split among all enemies.

        public override void getBattlecryEffect(Playfield p, Minion own, Minion target, int choice)
        {

            // conservative/realistic
            bool ownplay = own.own;
            List<Minion> temp1 = (ownplay) ? p.ownMinions : p.enemyMinions;
            bool haveAMech = false;
            foreach (Minion m in temp1)
            {
                if ((TAG_RACE)m.handcard.card.race == TAG_RACE.MECHANICAL)
                {
                    haveAMech = true;
                    break;
                }
            }
            if (!haveAMech) return;

            if (p.isServer)
            {
                int timesS = 4;
                for (int iS = 0; iS < timesS; iS++)
                {
                    Minion poortarget = p.getRandomMinionFromSide_SERVER(!ownplay, true);
                    if (poortarget != null) p.minionGetDamageOrHeal(poortarget, 1);
                }
                return;
            }

            List<Minion> targets = (ownplay) ? new List<Minion>(p.enemyMinions) : new List<Minion>(p.ownMinions);
            int times = (ownplay) ? p.getSpellDamageDamage(4) : p.getEnemySpellDamageDamage(4);

            if (ownplay)
            {
                targets.Add(p.enemyHero);
                targets.Sort((a, b) => -a.Hp.CompareTo(b.Hp));  // most hp -> least
            }
            else
            {
                targets.Add(p.ownHero);
                targets.Sort((a, b) => a.Hp.CompareTo(b.Hp));  // least hp -> most
            }

            // Distribute the damage evenly among the targets
            int i = 0;
            while (i < times)
            {
                int loc = i % targets.Count;
                p.minionGetDamageOrHeal(targets[loc], 1);
                i++;
            }
        }
开发者ID:cookiezeater,项目名称:silverfish,代码行数:53,代码来源:Sim_GvG_004.cs

示例15: onCardIsGoingToBePlayed

        //Whenever you target this minion with a spell, deal 3 damage to a random enemy.

        public override void onCardIsGoingToBePlayed(Playfield p, CardDB.Card c, bool wasOwnCard, Minion triggerEffectMinion, Minion target, int choice)
        {
            if (triggerEffectMinion.own == wasOwnCard && c.type == CardDB.cardtype.SPELL && target!=null && target.entitiyID == triggerEffectMinion.entitiyID)
            {
                if (p.isServer)
                {
                    Minion choosen = p.getRandomMinionFromSide_SERVER(!triggerEffectMinion.own, true);
                    if (choosen != null) p.minionGetDamageOrHeal(choosen, 3);
                    return;
                }

                p.doDmgToRandomEnemyCLIENT2(3, true, triggerEffectMinion.own);
            }
        }
开发者ID:noHero123,项目名称:silverfish,代码行数:16,代码来源:Sim_AT_131.cs


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