Пример #1
0
        private static void TriggerAura(Battle _battle, Hero _hero, IAuraSDS _auraSDS, SuperEvent e, ref float _value)
        {
            Hero targetHero = e.datas[0] as Hero;

            if (targetHero == _hero)
            {
                return;
            }

            List <int> pos = BattlePublicTools.GetNeighbourPos(_battle.mapData.neighbourPosMap, _hero.pos);

            if (pos.Contains(targetHero.pos))
            {
                _value = _value * _auraSDS.GetAuraDatas()[0];
            }
        }
Пример #2
0
        private static void RoundStartSummonRecoverDie(Battle _battle, Hero _hero, ISkillSDS _skillSDS, Dictionary <Hero, int> _hpChangeDic, Dictionary <Hero, int> _powerChangeDic)
        {
            switch (_skillSDS.GetSkillTarget())
            {
            case SkillTarget.SELF:

                SkillTakeEffect(_skillSDS, new List <Hero>()
                {
                    _hero
                }, _hpChangeDic, _powerChangeDic);

                break;

            case SkillTarget.ALLY:

                List <Hero> heros = null;

                List <int> posList = BattlePublicTools.GetNeighbourPos(_battle.mapData.neighbourPosMap, _hero.pos);

                for (int i = 0; i < posList.Count; i++)
                {
                    int pos = posList[i];

                    if (_battle.heroMapDic.ContainsKey(pos))
                    {
                        Hero tmpHero = _battle.heroMapDic[pos];

                        if (tmpHero.isMine == _hero.isMine)
                        {
                            if (heros == null)
                            {
                                heros = new List <Hero>();
                            }

                            heros.Add(tmpHero);
                        }
                    }
                }

                if (heros != null)
                {
                    while (heros.Count > _skillSDS.GetTargetNum())
                    {
                        int index = (int)(Battle.random.NextDouble() * heros.Count);

                        heros.RemoveAt(index);
                    }

                    SkillTakeEffect(_skillSDS, heros, _hpChangeDic, _powerChangeDic);
                }

                break;

            case SkillTarget.ENEMY:

                heros = null;

                posList = BattlePublicTools.GetNeighbourPos(_battle.mapData.neighbourPosMap, _hero.pos);

                for (int i = 0; i < posList.Count; i++)
                {
                    int pos = posList[i];

                    if (_battle.heroMapDic.ContainsKey(pos))
                    {
                        Hero tmpHero = _battle.heroMapDic[pos];

                        if (tmpHero.isMine != _hero.isMine)
                        {
                            if (heros == null)
                            {
                                heros = new List <Hero>();
                            }

                            heros.Add(tmpHero);
                        }
                    }
                }

                if (heros != null)
                {
                    while (heros.Count > _skillSDS.GetTargetNum())
                    {
                        int index = (int)(Battle.random.NextDouble() * heros.Count);

                        heros.RemoveAt(index);
                    }

                    SkillTakeEffect(_skillSDS, heros, _hpChangeDic, _powerChangeDic);
                }

                break;
            }
        }
Пример #3
0
        private static void DoSummon(Battle _battle, bool _isMine, double _wrongValue)
        {
            //---summon
            int money;
            Dictionary <int, int> handCards;
            int oppBasePos;

            if (_isMine)
            {
                oppBasePos = _battle.mapData.oBase;
                money      = _battle.mMoney;
                handCards  = _battle.mHandCards;
            }
            else
            {
                oppBasePos = _battle.mapData.mBase;
                money      = _battle.oMoney;
                handCards  = _battle.oHandCards;
            }

            List <int>    cards       = new List <int>();
            List <double> randomList2 = new List <double>();

            Dictionary <int, int> .Enumerator enumerator4 = handCards.GetEnumerator();

            while (enumerator4.MoveNext())
            {
                KeyValuePair <int, int> pair = enumerator4.Current;

                int cardID = pair.Value;

                IHeroSDS heroSDS = Battle.GetHeroData(cardID);

                if (heroSDS.GetCost() <= money)
                {
                    cards.Add(pair.Key);

                    randomList2.Add(1);
                }
            }

            if (cards.Count > 0)
            {
                List <int> resultList = new List <int>();

                List <int> resultList2 = new List <int>();

                List <int> nowCheckPos = new List <int>()
                {
                    oppBasePos
                };

                Dictionary <int, bool> checkedPos = new Dictionary <int, bool>();

                checkedPos.Add(oppBasePos, false);

                while (nowCheckPos.Count > 0)
                {
                    int nowPos = nowCheckPos[0];

                    nowCheckPos.RemoveAt(0);

                    List <int> posList = BattlePublicTools.GetNeighbourPos(_battle.mapData.neighbourPosMap, nowPos);

                    for (int i = 0; i < posList.Count; i++)
                    {
                        int pos = posList[i];

                        if (!checkedPos.ContainsKey(pos))
                        {
                            checkedPos.Add(pos, false);

                            bool b = _battle.GetPosIsMine(pos);

                            if (b == _isMine)
                            {
                                if (!_battle.heroMapDic.ContainsKey(pos))
                                {
                                    resultList.Add(pos);
                                }
                            }
                            else
                            {
                                nowCheckPos.Add(pos);
                            }
                        }
                    }
                }

                for (int i = 0; i < resultList.Count; i++)
                {
                    int nowPos = resultList[i];

                    List <int> posList = BattlePublicTools.GetNeighbourPos(_battle.mapData.neighbourPosMap, nowPos);

                    for (int m = 0; m < posList.Count; m++)
                    {
                        int pos = posList[m];

                        if (!_battle.heroMapDic.ContainsKey(pos) && !resultList.Contains(pos) && !resultList2.Contains(pos))
                        {
                            bool b = _battle.GetPosIsMine(pos);

                            if (b == _isMine)
                            {
                                resultList2.Add(pos);
                            }
                        }
                    }
                }

                PublicTools.ShuffleList(cards, Battle.random);

                while (Battle.random.NextDouble() < 0.8 && cards.Count > 0 && (resultList.Count > 0 || resultList2.Count > 0))
                {
                    int cardUid = cards[0];

                    cards.RemoveAt(0);

                    randomList2.RemoveAt(0);

                    int cardID = handCards[cardUid];

                    IHeroSDS heroSDS = Battle.GetHeroData(cardID);

                    if (heroSDS.GetCost() <= money)
                    {
                        List <int> summonPosList;

                        if (resultList.Count > 0 && resultList2.Count > 0)
                        {
                            if (Battle.random.NextDouble() < 0.6)
                            {
                                summonPosList = resultList;
                            }
                            else
                            {
                                summonPosList = resultList2;
                            }
                        }
                        else if (resultList.Count > 0)
                        {
                            summonPosList = resultList;
                        }
                        else
                        {
                            summonPosList = resultList2;
                        }

                        int index = (int)(Battle.random.NextDouble() * summonPosList.Count);

                        int summonPos = summonPosList[index];

                        summonPosList.RemoveAt(index);

                        _battle.summon.Add(cardUid, summonPos);

                        money -= heroSDS.GetCost();
                    }
                    else
                    {
                        break;
                    }
                }
            }
        }