示例#1
0
        public void FireBreath(Mobile from)
        {
            if (this == null)
            {
                return;
            }
            if (this.Deleted)
            {
                return;
            }
            if (from == null)
            {
                return;
            }

            Effects.PlaySound(Location, Map, 0x227);

            Dictionary <Point3D, double> m_BreathTiles = new Dictionary <Point3D, double>();

            double tileDelay = .10;
            int    distance  = 8;

            m_BreathTiles.Add(Location, 0);

            Direction breathDirection = Direction.South;

            Point3D previousPoint = Location;
            Point3D nextPoint;

            for (int a = 0; a < distance; a++)
            {
                nextPoint = SpecialAbilities.GetPointByDirection(previousPoint, breathDirection);

                bool canFit = SpellHelper.AdjustField(ref nextPoint, Map, 12, false);

                if (Map != null && canFit && Map.InLOS(Location, nextPoint))
                {
                    if (!m_BreathTiles.ContainsKey(nextPoint))
                    {
                        m_BreathTiles.Add(nextPoint, a * tileDelay);
                    }
                }

                List <Point3D> perpendicularPoints = SpecialAbilities.GetPerpendicularPoints(previousPoint, nextPoint, a + 1);

                foreach (Point3D point in perpendicularPoints)
                {
                    Point3D ppoint = new Point3D(point.X, point.Y, point.Z);

                    canFit = SpellHelper.AdjustField(ref ppoint, Map, 12, false);

                    if (Map != null && canFit && Map.InLOS(Location, ppoint))
                    {
                        if (!m_BreathTiles.ContainsKey(ppoint))
                        {
                            m_BreathTiles.Add(ppoint, a * tileDelay);
                        }
                    }
                }

                previousPoint = nextPoint;

                Timer.DelayCall(TimeSpan.FromSeconds(a * tileDelay), delegate
                {
                    if (this == null)
                    {
                        return;
                    }
                    if (this.Deleted)
                    {
                        return;
                    }

                    Effects.PlaySound(nextPoint, Map, 0x208);
                });
            }

            foreach (KeyValuePair <Point3D, double> pair in m_BreathTiles)
            {
                Timer.DelayCall(TimeSpan.FromSeconds(pair.Value), delegate
                {
                    if (this == null)
                    {
                        return;
                    }
                    if (this.Deleted)
                    {
                        return;
                    }

                    Point3D breathLocation = pair.Key;

                    Effects.SendLocationParticles(EffectItem.Create(breathLocation, Map, TimeSpan.FromSeconds(1.0)), 0x3709, 10, 30, 0, 0, 5052, 0);

                    Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate
                    {
                        if (this == null)
                        {
                            return;
                        }
                        if (this.Deleted)
                        {
                            return;
                        }

                        //Fire Field Resolution
                        if (Utility.RandomDouble() < .25)
                        {
                            int duration = 5;

                            Effects.PlaySound(breathLocation, Map, 0x208);
                            Effects.SendLocationParticles(EffectItem.Create(breathLocation, Map, TimeSpan.FromSeconds(duration)), 0x3996, 10, 100, 5029);

                            for (int a = 1; a < (duration + 1); a++)
                            {
                                Timer.DelayCall(TimeSpan.FromSeconds(a), delegate
                                {
                                    Effects.PlaySound(breathLocation, Map, 0x208);
                                });
                            }
                        }
                    });
                });
            }

            if (m_BreathTiles.Count > 0)
            {
                m_NextUseAllowed = DateTime.UtcNow + UsageCooldown;
            }
        }