Esempio n. 1
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);
                        }
                    }
                }
            }
        }
Esempio n. 2
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));
        }
Esempio n. 3
0
        public Color GetMonsterColor(LiveMonster lm, int mouseX, int mouseY)
        {
            if (!Active)
            {
                return(Color.White);
            }

            foreach (var regionData in dataList)
            {
                if (regionData.Color == Color.Red && lm.IsLeft)
                {
                    continue;
                }

                if (regionData.Color == Color.Green && !lm.IsLeft)
                {
                    continue;
                }

                if (!BattleLocationManager.IsPointInRegionType(regionData.Type, mouseX, mouseY, lm.Position, regionData.Range, true))
                {
                    //magicregion永远为leftplayer服务
                    continue;
                }

                return(regionData.Color);
            }

            return(Color.White);
        }
Esempio n. 4
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);
                }
            }
        }
Esempio n. 5
0
 public void SetTile(Point point, int dis, int tile)
 {
     foreach (var memMapPoint in Cells)
     {
         if (BattleLocationManager.IsPointInRegionType(RegionTypes.Circle, point.X, point.Y, memMapPoint.ToPoint(), dis, true))//地形和方向无关,随便填一个
         {
             memMapPoint.Tile = tile;
         }
     }
     tiles.Clear();
     foreach (var memMapPoint in Cells)
     {
         tiles[memMapPoint.Tile == 9 ? 0 : memMapPoint.Tile]++;
     }
     isDirty = true;
 }
Esempio n. 6
0
        public void Draw(Graphics g, int round, int mouseX, int mouseY)
        {
            if (!Active)
            {
                return;
            }

            int size = BattleManager.Instance.MemMap.CardSize;

            int roundoff = ((round / 12) % 2) * 1 + 2;

            foreach (var memMapPoint in BattleManager.Instance.MemMap.Cells)
            {
                Color c = Color.Black;
                foreach (var regionData in dataList)
                {
                    if (BattleLocationManager.IsPointInRegionType(regionData.Type, mouseX, mouseY, memMapPoint.ToPoint(),
                                                                  regionData.Range, true)) //magicregion永远为leftplayer服务
                    {
                        if (c == Color.Black)
                        {
                            c = regionData.Color;
                        }
                        else
                        {
                            c = Color.FromArgb(c.R / 2 + regionData.Color.R / 2, c.G / 2 + regionData.Color.G / 2,
                                               c.B / 2 + regionData.Color.B / 2);
                        }
                    }

                    if (c != Color.Black)
                    {
                        SolidBrush fillBrush = new SolidBrush(Color.FromArgb(50, c));
                        Pen        borderPen = new Pen(c, 2);
                        g.FillRectangle(fillBrush, memMapPoint.X + roundoff, memMapPoint.Y + roundoff, size - roundoff * 2, size - roundoff * 2);
                        g.DrawRectangle(borderPen, memMapPoint.X + roundoff, memMapPoint.Y + roundoff, size - roundoff * 2, size - roundoff * 2);
                        borderPen.Dispose();
                        fillBrush.Dispose();
                    }
                }
            }
        }