Beispiel #1
0
        public void CheckAuroState()
        {
            foreach (LiveMonster mon in BattleManager.Instance.MonsterQueue.Enumerator)
            {
                if (mon.IsGhost || mon.Id == self.Id)
                {
                    continue;
                }
                if (target[0] != 'A' &&
                    ((BattleTargetManager.IsSpellEnemyMonster(target[0]) && self.IsLeft == mon.IsLeft) ||
                     (BattleTargetManager.IsSpellFriendMonster(target[0]) && self.IsLeft != mon.IsLeft)))
                {
                    continue;
                }
                if (targetMonsterId != 0 && mon.Avatar.Id != targetMonsterId)
                {
                    continue;
                }
                if (mon.Star > starMax || mon.Star < starMin)
                {
                    continue;
                }
                if (raceList.Count > 0 && !raceList.Contains((CardTypeSub)mon.Avatar.MonsterConfig.Type))
                {
                    continue;
                }
                if (attrList.Count > 0 && !attrList.Contains((CardElements)mon.Avatar.MonsterConfig.Attr))
                {
                    continue;
                }

                mon.AddBuff(buffId, level, 0.05);
            }
        }
Beispiel #2
0
        public void CheckSpellEffect(bool isLeft, LiveMonster target, Point mouse)
        {
            if (spellInfo.SpellConfig.Effect != null)
            {
                Player p1 = isLeft ? BattleManager.Instance.PlayerManager.LeftPlayer : BattleManager.Instance.PlayerManager.RightPlayer;
                Player p2 = !isLeft ? BattleManager.Instance.PlayerManager.LeftPlayer : BattleManager.Instance.PlayerManager.RightPlayer;

                spellInfo.SpellConfig.Effect(spellInfo, BattleManager.Instance.MemMap, p1, p2, target, mouse, Level);

                if (!string.IsNullOrEmpty(spellInfo.SpellConfig.AreaEffect))
                {
                    //播放特效
                    RegionTypes rt       = BattleTargetManager.GetRegionType(spellInfo.SpellConfig.Target[2]);
                    var         cardSize = BattleManager.Instance.MemMap.CardSize;
                    foreach (var memMapPoint in BattleManager.Instance.MemMap.Cells)
                    {
                        var pointData = memMapPoint.ToPoint();
                        if (BattleLocationManager.IsPointInRegionType(rt, mouse.X, mouse.Y, pointData, spellInfo.SpellConfig.Range, isLeft))
                        {
                            var effectData = new ActiveEffect(EffectBook.GetEffect(spellInfo.SpellConfig.AreaEffect), pointData + new Size(cardSize / 2, cardSize / 2), false);
                            BattleManager.Instance.EffectQueue.Add(effectData);
                        }
                    }
                }
            }
        }
Beispiel #3
0
        public static void CheckSpellEffect(Spell spell, bool isLeft, LiveMonster target, Point mouse)
        {
            MemBaseSpell spl = new MemBaseSpell(spell);

            spl.CheckSpellEffect(isLeft, target, mouse);
            if (spell.Addon != 0 && (spl.SpellConfig.Cure > 0 || spl.SpellConfig.Damage > 0))
            {
                BattleManager.Instance.FlowWordQueue.Add(new FlowWord(string.Format("{0}倍施法!", 1 + spell.Addon), mouse, 0, "Gold", 26, 0, 0, 2, 15), false);
            }

            SpellConfig spellConfig = spell.SpellConfig;

            if (spl.HintWord != "")
            {
                BattleManager.Instance.FlowWordQueue.Add(new FlowWord(spl.HintWord, mouse, 0, "Cyan", 26, 0, 0, 0, 15), false);
            }
            if (!string.IsNullOrEmpty(spellConfig.UnitEffect))
            {
                if (BattleTargetManager.PlayEffectOnMonster(spellConfig.Target))
                {
                    BattleManager.Instance.EffectQueue.Add(new ActiveEffect(EffectBook.GetEffect(spellConfig.UnitEffect), target, false));
                }
                if (BattleTargetManager.PlayEffectOnMouse(spellConfig.Target))
                {
                    BattleManager.Instance.EffectQueue.Add(new ActiveEffect(EffectBook.GetEffect(spellConfig.UnitEffect), mouse, false));
                }
            }
        }
Beispiel #4
0
        public MonsterCollection GetRangeMonsterGhost(bool isLeft, string target, string shape, int range, Point mouse)
        {
            List <IMonster> monsters = new List <IMonster>();
            RegionTypes     rt       = BattleTargetManager.GetRegionType(shape[0]);

            foreach (var mon in BattleManager.Instance.MonsterQueue.Enumerator)
            {
                if (!mon.IsGhost)
                {
                    continue;
                }

                if ((BattleTargetManager.IsSpellEnemyMonster(target[0]) && isLeft != mon.Owner.IsLeft) || (BattleTargetManager.IsSpellFriendMonster(target[0]) && isLeft == mon.Owner.IsLeft))
                {
                    if (!BattleLocationManager.IsPointInRegionType(rt, mouse.X, mouse.Y, mon.Position, range, isLeft))
                    {
                        continue;
                    }

                    monsters.Add(mon);
                }
            }

            return(new MonsterCollection(monsters, mouse));
        }
Beispiel #5
0
 private void OnSelectCardChange()
 {
     magicRegion.Clear();
     if (leftSelectCard != null)
     {
         if (leftSelectCard.CardType == CardTypes.Monster)
         {
             var monsterConfig = ConfigData.GetMonsterConfig(leftSelectCard.CardId);
             magicRegion.Add(RegionTypes.Circle, monsterConfig.Range, Color.Magenta);
             var skillConfig = MonsterBook.GetAreaSkill(leftSelectCard.CardId);
             if (skillConfig != null)
             {
                 var type = BattleTargetManager.GetRegionType(skillConfig.Target[2]);
                 if (type != RegionTypes.None)
                 {
                     magicRegion.Add(type, skillConfig.Range, MagicRegion.GetTargetColor(skillConfig.Target[1]));
                 }
             }
         }
         else if (leftSelectCard.CardType == CardTypes.Spell)
         {
             var spellConfig = ConfigData.GetSpellConfig(leftSelectCard.CardId);
             var type        = BattleTargetManager.GetRegionType(spellConfig.Target[2]);
             if (type != RegionTypes.None)
             {
                 magicRegion.Add(type, spellConfig.Range, MagicRegion.GetTargetColor(spellConfig.Target[1]));
             }
         }
     }
 }
Beispiel #6
0
        private void SendAreaEffect(Point pos)
        {
            //播放特效
            RegionTypes rt       = BattleTargetManager.GetRegionType(SkillInfo.SkillConfig.Target[2]);
            var         cardSize = BattleManager.Instance.MemMap.CardSize;

            foreach (var memMapPoint in BattleManager.Instance.MemMap.Cells)
            {
                var pointData = memMapPoint.ToPoint();
                if (BattleLocationManager.IsPointInRegionType(rt, pos.X, pos.Y, pointData, SkillInfo.SkillConfig.Range, Self.IsLeft))
                {
                    var effectData = new ActiveEffect(EffectBook.GetEffect(SkillInfo.SkillConfig.EffectArea), pointData + new Size(cardSize / 2, cardSize / 2), false);
                    BattleManager.Instance.EffectQueue.Add(effectData);
                }
            }
        }
Beispiel #7
0
        internal static void AIProc(Player player)
        {
            if (player.CardNumber <= 0)
            {
                return;
            }

            if (MathTool.GetRandom(4) != 0)
            {
                return;
            }

            int  row    = BattleManager.Instance.MemMap.RowCount;
            int  size   = BattleManager.Instance.MemMap.CardSize;
            bool isLeft = player.IsLeft;
            var  rival  = player == BattleManager.Instance.PlayerManager.LeftPlayer ?
                          BattleManager.Instance.PlayerManager.RightPlayer : BattleManager.Instance.PlayerManager.LeftPlayer;

            player.CardsDesk.SetSelectId(MathTool.GetRandom(player.CardNumber) + 1);
            if (player.SelectCardId != 0)
            {
                ActiveCard card = player.CardsDesk.GetSelectCard();
                if (player.CheckUseCard(card, player, rival) != HSErrorTypes.OK)
                {
                    return;
                }

                int tar = -1;
                if (card.CardType == CardTypes.Weapon)
                {
                    for (int i = 0; i < BattleManager.Instance.MonsterQueue.Count; i++)
                    {
                        LiveMonster monster = BattleManager.Instance.MonsterQueue[i];
                        if (!monster.IsGhost && monster.IsLeft == isLeft && monster.Weapon == null && monster.Life > monster.RealMaxHp / 2)
                        {
                            if (!monster.CanAddWeapon())//建筑无法使用武器
                            {
                                continue;
                            }

                            if (tar == -1 || monster.Avatar.MonsterConfig.Star > BattleManager.Instance.MonsterQueue[tar].Avatar.MonsterConfig.Star)
                            {
                                tar = i;
                            }
                        }
                    }
                    if (tar == -1)
                    {
                        return;
                    }
                }
                else if (card.CardType == CardTypes.Spell)
                {
                    SpellConfig spellConfig = ConfigData.GetSpellConfig(card.CardId);
                    if (BattleTargetManager.IsSpellUnitTarget(spellConfig.Target))
                    {
                        var targetStar = -1;
                        if (tar >= 0)
                        {
                            targetStar = BattleManager.Instance.MonsterQueue[tar].Avatar.MonsterConfig.Star;
                        }
                        for (int i = 0; i < BattleManager.Instance.MonsterQueue.Count; i++)
                        {
                            LiveMonster monster = BattleManager.Instance.MonsterQueue[i];
                            if (monster.IsGhost)
                            {
                                continue;
                            }
                            if ((monster.IsLeft != isLeft && spellConfig.Target[1] != 'F') || (monster.IsLeft == isLeft && spellConfig.Target[1] != 'E'))
                            {
                                if (tar == -1 || monster.Avatar.MonsterConfig.Star > targetStar)
                                {
                                    tar        = i;
                                    targetStar = monster.Avatar.MonsterConfig.Star;
                                }
                            }
                        }
                        if (tar == -1)
                        {
                            return;
                        }
                    }
                }

                if (card.CardType == CardTypes.Monster)
                {
                    Point monPos = GetMonsterPoint(card.CardId, false);
                    player.UseMonster(card, monPos);
                }
                else if (card.CardType == CardTypes.Weapon)
                {
                    var lm = BattleManager.Instance.MonsterQueue[tar];
                    player.UseWeapon(lm, card);
                }
                else if (card.CardType == CardTypes.Spell)
                {
                    SpellConfig spellConfig   = ConfigData.GetSpellConfig(card.CardId);
                    Point       targetPos     = Point.Empty;
                    LiveMonster targetMonster = null;
                    if (BattleTargetManager.IsSpellNullTarget(spellConfig.Target))
                    {
                        targetPos = new Point(isLeft ? MathTool.GetRandom(200, 300) : MathTool.GetRandom(600, 700), MathTool.GetRandom(size * 3 / 10, row * size - size * 3 / 10));
                    }
                    else if (BattleTargetManager.IsSpellUnitTarget(spellConfig.Target))
                    {
                        targetMonster = BattleManager.Instance.MonsterQueue[tar];
                        targetPos     = targetMonster.CenterPosition;
                    }

                    player.DoSpell(targetMonster, card, targetPos);
                }
            }
        }