コード例 #1
0
        public virtual void Explode(Mobile from, Point3D loc, Map map)
        {
            if (Deleted || map == null)
            {
                return;
            }

            Consume();

            // Check if any other players are using this potion
            for (int i = 0; i < m_Users.Count; i++)
            {
                ThrowTarget targ = m_Users[i].Target as ThrowTarget;

                if (targ != null && targ.Potion == this)
                {
                    Target.Cancel(from);
                }
            }

            // Effects
            Effects.PlaySound(loc, map, 0x20C);

            for (int i = -2; i <= 2; i++)
            {
                for (int j = -2; j <= 2; j++)
                {
                    Point3D p = new Point3D(loc.X + i, loc.Y + j, map.GetAverageZ(loc.X + i, loc.Y + j));
                    SpellHelper.AdjustField(ref p, map, 16, true);

                    if (map.CanFit(new Point3D(p), 12, true, false) && from.InLOS(p))
                    {
                        new InternalItem(from, p, map, MinDamage, MaxDamage);
                    }
                }
            }
        }
コード例 #2
0
        public override void BeforeBreak(Mobile from, InteractionType interactionType)
        {
            int fragments = Utility.RandomMinMax(2, 3);

            for (int a = 0; a < fragments; a++)
            {
                TimedStatic ore = new TimedStatic(6583, 5);
                ore.Name = "lunite fragments";
                ore.Hue  = 2603;

                Point3D oreLocation = new Point3D(Location.X + Utility.RandomList(-1, 1), Location.Y + Utility.RandomList(-1, 1), Location.Z);
                SpellHelper.AdjustField(ref oreLocation, Map, 12, false);
                ore.MoveToWorld(oreLocation, Map);
            }

            if (m_LuniteOreFormationSpawner != null)
            {
                m_LuniteOreFormationSpawner.ResetTimer();
            }

            Point3D location = Location;
            Map     map      = Map;

            Effects.PlaySound(location, map, 0x5CA);
            Effects.SendLocationParticles(EffectItem.Create(location, map, TimeSpan.FromSeconds(0.25)), 0x3709, 10, 30, 2602, 0, 5029, 0);

            Timer.DelayCall(TimeSpan.FromSeconds(1), delegate
            {
                int amount = Utility.RandomMinMax(3, 5);

                LuniteOre ore = new LuniteOre(amount);
                ore.MoveToWorld(location, map);
            });

            base.BeforeBreak(from, interactionType);
        }
コード例 #3
0
        public override bool OnBeforeDeath()
        {
            foreach (Mobile mobile in m_SwallowedMobiles)
            {
                if (mobile == null)
                {
                    continue;
                }
                if (mobile.Deleted)
                {
                    continue;
                }

                mobile.Squelched = false;
                mobile.Hidden    = false;

                Point3D ichorLocation = new Point3D(mobile.Location.X + Utility.RandomMinMax(-2, 2), mobile.Location.Y + Utility.RandomMinMax(-2, 2), mobile.Location.Z);
                SpellHelper.AdjustField(ref ichorLocation, mobile.Map, 12, false);

                TimedStatic ichor = new TimedStatic(Utility.RandomList(4650, 4651, 4652, 4653, 4654, 4655), 5);
                ichor.Hue  = 2051;
                ichor.Name = "ichor";
                ichor.MoveToWorld(ichorLocation, mobile.Map);

                Effects.PlaySound(mobile.Location, mobile.Map, Utility.RandomList(0x101));
            }

            MassiveCorpseExplosion();

            CantWalk     = true;
            ActiveSpeed  = 1.5;
            PassiveSpeed = 1.5;
            CurrentSpeed = 1.5;

            return(base.OnBeforeDeath());
        }
コード例 #4
0
        public override void OnGaveMeleeAttack(Mobile defender)
        {
            base.OnGaveMeleeAttack(defender);

            if (Utility.RandomDouble() <= .2)
            {
                TimedStatic darkEssence = new TimedStatic(Utility.RandomList(4650, 4651, 4652, 4653, 4654, 4655), 5);
                darkEssence.Hue  = 2051;
                darkEssence.Name = "dark essence";
                darkEssence.MoveToWorld(defender.Location, Map);

                Point3D newPoint = new Point3D(defender.Location.X + Utility.RandomList(-1, 1), defender.Location.Y + Utility.RandomList(-1, 1), defender.Location.Z);
                SpellHelper.AdjustField(ref newPoint, defender.Map, 12, false);

                darkEssence      = new TimedStatic(Utility.RandomList(4650, 4651, 4652, 4653, 4654, 4655), 5);
                darkEssence.Hue  = 2051;
                darkEssence.Name = "dark essence";
                darkEssence.MoveToWorld(newPoint, defender.Map);

                PlaySound(0x379);

                SpecialAbilities.DisorientSpecialAbility(1.0, this, defender, .05, 20, -1, false, "", "You have been cursed by dark energy and are disoriented.", "-1");
            }
        }
コード例 #5
0
            protected override void OnTick()
            {
                if (m_From == null || m_From.Deleted || m_Map == null || m_Map == Map.Internal)
                {
                    Stop();
                    return;
                }

                if (0.33 > Utility.RandomDouble())
                {
                    var field = new FireField(m_From, 25, Utility.RandomBool());
                    field.MoveToWorld(m_LastTarget, m_Map);
                }

                Point3D start  = new Point3D();
                Point3D finish = new Point3D();

                finish.X = m_ShowerArea.X + Utility.Random(m_ShowerArea.Width);
                finish.Y = m_ShowerArea.Y + Utility.Random(m_ShowerArea.Height);
                finish.Z = m_From.Z;

                SpellHelper.AdjustField(ref finish, m_Map, 16, false);

                //objects move from upper right/right to left as per OSI
                start.X = finish.X + Utility.RandomMinMax(-4, 4);
                start.Y = finish.Y - 15;
                start.Z = finish.Z + 50;

                Effects.SendMovingParticles(
                    new Entity(Serial.Zero, start, m_Map),
                    new Entity(Serial.Zero, finish, m_Map),
                    0x36D4, 15, 0, false, false, 0, 0, 9502, 1, 0, (EffectLayer)255, 0x100);

                Effects.PlaySound(finish, m_Map, 0x11D);

                m_LastTarget = finish;
                m_Count++;

                if (m_Count >= m_MaxCount / 2 && !m_DoneDamage)
                {
                    if (m_ToDamage != null && m_ToDamage.Count > 0)
                    {
                        int damage;

                        foreach (Mobile mob in m_ToDamage)
                        {
                            damage = Utility.RandomMinMax(m_MinDamage, m_MaxDamage);

                            m_From.DoHarmful(mob);
                            AOS.Damage(mob, m_From, damage, 0, 100, 0, 0, 0);

                            mob.FixedParticles(0x36BD, 1, 15, 9502, 0, 3, (EffectLayer)255);
                        }
                    }

                    m_DoneDamage = true;
                    return;
                }

                if (m_Count >= m_MaxCount)
                {
                    Stop();
                }
            }
コード例 #6
0
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else if (SpellHelper.CheckTown(p, Caster) && SpellHelper.CheckWater(new Point3D(p), Caster.Map) && CheckSequence())
            {
                SpellHelper.Turn(Caster, p);

                SpellHelper.GetSurfaceTop(ref p);

                int dx = Caster.Location.X - p.X;
                int dy = Caster.Location.Y - p.Y;
                int rx = (dx - dy) * 44;
                int ry = (dx + dy) * 44;

                bool eastToWest;

                if (rx >= 0 && ry >= 0)
                {
                    eastToWest = false;
                }
                else if (rx >= 0)
                {
                    eastToWest = true;
                }
                else if (ry >= 0)
                {
                    eastToWest = true;
                }
                else
                {
                    eastToWest = false;
                }

                Effects.PlaySound(p, Caster.Map, 0x20B);
                int itemID = eastToWest ? 0x3967 : 0x3979;

                Point3D  pnt      = new Point3D(p);
                TimeSpan duration = TimeSpan.FromSeconds(3.0 + (Caster.Skills[SkillName.Magery].Value / 3.0));

                if (SpellHelper.CheckField(pnt, Caster.Map))
                {
                    new InternalItem(itemID, pnt, Caster, Caster.Map, duration);
                }

                for (int i = 1; i <= 2; ++i)
                {
                    Timer.DelayCall(TimeSpan.FromMilliseconds(i * 300), index =>
                    {
                        Point3D point = new Point3D(eastToWest ? pnt.X + index : pnt.X, eastToWest ? pnt.Y : pnt.Y + index, pnt.Z);
                        SpellHelper.AdjustField(ref point, Caster.Map, 16, false);

                        if (SpellHelper.CheckField(point, Caster.Map))
                        {
                            new InternalItem(itemID, point, Caster, Caster.Map, duration);
                        }

                        point = new Point3D(eastToWest ? pnt.X + -index : pnt.X, eastToWest ? pnt.Y : pnt.Y + -index, pnt.Z);
                        SpellHelper.AdjustField(ref point, Caster.Map, 16, false);

                        if (SpellHelper.CheckField(point, Caster.Map))
                        {
                            new InternalItem(itemID, point, Caster, Caster.Map, duration);
                        }
                    }, i);
                }
            }

            FinishSequence();
        }
コード例 #7
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;
            }
        }
コード例 #8
0
ファイル: SchoolOfFish.cs プロジェクト: Pumpk1ns/outlands
        public void FindCreature(Mobile from, int creatureLevel)
        {
            if (from == null)
            {
                return;
            }

            PlayerMobile player = from as PlayerMobile;

            if (player == null)
            {
                return;
            }

            int waterLocationChecks = 20;

            int minSpawnRadius = 3;
            int maxSpawnRadius = 6;

            bool foundWaterSpot   = false;
            bool spawnedCreatures = false;

            Point3D spawnLocation = Location;
            Point3D newLocation   = new Point3D();

            for (int a = 0; a < waterLocationChecks; a++)
            {
                int x = X;

                int xOffset = Utility.RandomMinMax(minSpawnRadius, maxSpawnRadius);
                if (Utility.RandomDouble() >= .5)
                {
                    xOffset *= -1;
                }

                x += xOffset;

                int y = Y;

                int yOffset = Utility.RandomMinMax(minSpawnRadius, maxSpawnRadius);
                if (Utility.RandomDouble() >= .5)
                {
                    yOffset *= -1;
                }

                y += yOffset;

                newLocation.X = x;
                newLocation.Y = y;
                newLocation.Z = -5;

                bool waterTile = BaseBoat.IsWaterTile(newLocation, Map);

                if (waterTile)
                {
                    if (BaseBoat.FindBoatAt(newLocation, Map) != null)
                    {
                        continue;
                    }

                    SpellHelper.AdjustField(ref spawnLocation, Map, 12, false);

                    foundWaterSpot = true;
                    break;
                }
            }

            if (!foundWaterSpot)
            {
                return;
            }

            int count = 0;

            switch (creatureLevel)
            {
            case 1:
                count = Utility.RandomMinMax(1, 2);

                for (int a = 0; a < count; a++)
                {
                    BaseCreature bc_Creature = new Puddle();

                    bc_Creature.m_WasFishedUp = true;
                    bc_Creature.MoveToWorld(spawnLocation, from.Map);
                    spawnedCreatures = true;
                }

                if (spawnedCreatures)
                {
                    from.PublicOverheadMessage(MessageType.Regular, 0, false, "*something rises from the water*");
                }
                break;

            case 2:
                count = Utility.RandomMinMax(1, 2);

                for (int a = 0; a < count; a++)
                {
                    BaseCreature bc_Creature = new WaterElemental();

                    bc_Creature.m_WasFishedUp = true;
                    bc_Creature.MoveToWorld(spawnLocation, from.Map);
                    spawnedCreatures = true;
                }

                if (spawnedCreatures)
                {
                    from.PublicOverheadMessage(MessageType.Regular, 0, false, "*something rises from the water*");
                }
                break;

            case 3:
                count = Utility.RandomMinMax(1, 2);

                for (int a = 0; a < count; a++)
                {
                    BaseCreature bc_Creature = new DeepSeaSerpent();

                    bc_Creature.m_WasFishedUp = true;
                    bc_Creature.MoveToWorld(spawnLocation, from.Map);
                    spawnedCreatures = true;
                }

                if (spawnedCreatures)
                {
                    from.PublicOverheadMessage(MessageType.Regular, 0, false, "*something rises from the water*");
                }
                break;

            case 4:
                count = Utility.RandomMinMax(1, 2);

                for (int a = 0; a < count; a++)
                {
                    BaseCreature bc_Creature = new Kraken();

                    bc_Creature.m_WasFishedUp = true;
                    bc_Creature.MoveToWorld(spawnLocation, from.Map);
                    spawnedCreatures = true;
                }

                if (spawnedCreatures)
                {
                    from.PublicOverheadMessage(MessageType.Regular, 0, false, "*something rises from the water*");
                }
                break;
            }
        }
コード例 #9
0
        public void FireBarrage()
        {
            if (!SpecialAbilities.Exists(this))
            {
                return;
            }

            IPooledEnumerable nearbyMobiles = Map.GetMobilesInRange(Location, FireBarrageRange);

            int mobileCount = 0;

            foreach (Mobile mobile in nearbyMobiles)
            {
                if (mobile == this)
                {
                    continue;
                }
                if (!SpecialAbilities.MonsterCanDamage(this, mobile))
                {
                    continue;
                }
                if (!Map.InLOS(Location, mobile.Location))
                {
                    continue;
                }
                if (mobile.Hidden)
                {
                    continue;
                }

                mobileCount++;
            }

            nearbyMobiles.Free();
            nearbyMobiles = Map.GetMobilesInRange(Location, FireBarrageRange);

            List <Mobile> m_NearbyMobiles = new List <Mobile>();

            foreach (Mobile mobile in nearbyMobiles)
            {
                if (mobile == this)
                {
                    continue;
                }
                if (!SpecialAbilities.MonsterCanDamage(this, mobile))
                {
                    continue;
                }
                if (!Map.InLOS(Location, mobile.Location))
                {
                    continue;
                }
                if (mobile.Hidden)
                {
                    continue;
                }
                if (Combatant != null)
                {
                    if (mobileCount > 1 && mobile == Combatant)
                    {
                        continue;
                    }
                }

                m_NearbyMobiles.Add(mobile);
            }

            nearbyMobiles.Free();

            if (m_NearbyMobiles.Count == 0)
            {
                return;
            }

            Mobile mobileTarget = m_NearbyMobiles[Utility.RandomMinMax(0, m_NearbyMobiles.Count - 1)];

            double spawnPercent = (double)intervalCount / (double)totalIntervals;

            int maxExtraFireballs = 10;
            int fireballs         = 10 + (int)Math.Ceiling(((double)maxExtraFireballs * spawnPercent));

            double directionDelay = .25;
            double initialDelay   = 1;
            double fireballDelay  = .1;
            double totalDelay     = 1 + directionDelay + initialDelay + ((double)fireballs * fireballDelay);

            SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1.0, totalDelay, true, 0, false, "", "", "-1");

            m_NextFireBarrageAllowed = DateTime.UtcNow + NextFireBarrageDelay + TimeSpan.FromSeconds(totalDelay);
            m_NextAbilityAllowed     = DateTime.UtcNow + NextAbilityDelay + TimeSpan.FromSeconds(totalDelay);

            AbilityInProgress = true;

            Timer.DelayCall(TimeSpan.FromSeconds(totalDelay), delegate
            {
                if (SpecialAbilities.Exists(this))
                {
                    AbilityInProgress = false;
                }
            });

            PublicOverheadMessage(MessageType.Regular, 0, false, "*takes deep breath*");

            Point3D location = Location;
            Map     map      = Map;

            Point3D targetLocation = mobileTarget.Location;
            Map     targetMap      = mobileTarget.Map;

            Direction = Utility.GetDirection(Location, targetLocation);

            Timer.DelayCall(TimeSpan.FromSeconds(directionDelay), delegate
            {
                if (!SpecialAbilities.Exists(this))
                {
                    return;
                }

                Animate(5, 15, 1, true, false, 0);
                PlaySound(GetAngerSound());

                Timer.DelayCall(TimeSpan.FromSeconds(initialDelay), delegate
                {
                    if (!SpecialAbilities.Exists(this))
                    {
                        return;
                    }

                    for (int a = 0; a < fireballs; a++)
                    {
                        Timer.DelayCall(TimeSpan.FromSeconds(a * fireballDelay), delegate
                        {
                            if (!SpecialAbilities.Exists(this))
                            {
                                return;
                            }
                            if (DamageIntervalInProgress)
                            {
                                return;
                            }

                            bool mobileTargetValid = true;

                            if (mobileTarget == null)
                            {
                                mobileTargetValid = false;
                            }

                            else if (mobileTarget.Deleted || !mobileTarget.Alive)
                            {
                                mobileTargetValid = false;
                            }

                            else
                            {
                                if (mobileTarget.Hidden || Utility.GetDistance(Location, mobileTarget.Location) >= FireBarrageRange)
                                {
                                    mobileTargetValid = false;
                                }
                            }

                            if (mobileTargetValid)
                            {
                                targetLocation = mobileTarget.Location;
                                targetMap      = mobileTarget.Map;
                            }

                            int effectSound = 0x357;
                            int itemID      = 0x36D4;
                            int itemHue     = 2602;

                            int impactSound = 0x226;
                            int impactHue   = 2602;

                            int xOffset = 0;
                            int yOffset = 0;

                            int distance = Utility.GetDistance(Location, targetLocation);

                            if (distance > 1)
                            {
                                if (Utility.RandomDouble() <= .5)
                                {
                                    xOffset = Utility.RandomList(-1, 1);
                                }

                                if (Utility.RandomDouble() <= .5)
                                {
                                    yOffset = Utility.RandomList(-1, 1);
                                }
                            }

                            IEntity startLocation = new Entity(Serial.Zero, new Point3D(location.X, location.Y, location.Z + 10), map);

                            Point3D adjustedLocation = new Point3D(targetLocation.X + xOffset, targetLocation.Y + yOffset, targetLocation.Z);
                            SpellHelper.AdjustField(ref adjustedLocation, targetMap, 12, false);

                            IEntity endLocation = new Entity(Serial.Zero, new Point3D(adjustedLocation.X, adjustedLocation.Y, adjustedLocation.Z + 10), targetMap);

                            Effects.PlaySound(location, map, effectSound);
                            Effects.SendMovingEffect(startLocation, endLocation, itemID, 8, 0, false, false, itemHue, 0);

                            double targetDistance   = Utility.GetDistanceToSqrt(location, adjustedLocation);
                            double destinationDelay = (double)targetDistance * .06;

                            Direction newDirection = Utility.GetDirection(location, adjustedLocation);

                            if (Direction != newDirection)
                            {
                                Direction = newDirection;
                            }

                            Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate
                            {
                                Effects.PlaySound(adjustedLocation, targetMap, impactSound);
                                Effects.SendLocationParticles(EffectItem.Create(adjustedLocation, targetMap, EffectItem.DefaultDuration), 0x3709, 20, 20, impactHue, 0, 0, 0);

                                Queue m_Queue = new Queue();

                                nearbyMobiles = targetMap.GetMobilesInRange(adjustedLocation, 0);

                                foreach (Mobile mobile in nearbyMobiles)
                                {
                                    if (mobile == this)
                                    {
                                        continue;
                                    }
                                    if (!SpecialAbilities.MonsterCanDamage(this, mobile))
                                    {
                                        continue;
                                    }

                                    m_Queue.Enqueue(mobile);
                                }

                                nearbyMobiles.Free();

                                while (m_Queue.Count > 0)
                                {
                                    Mobile mobile = (Mobile)m_Queue.Dequeue();

                                    int damage = (int)(Math.Round((double)DamageMin / 5));

                                    if (mobile is BaseCreature)
                                    {
                                        damage *= 3;
                                    }

                                    else
                                    {
                                        if (Utility.GetDistance(Location, mobile.Location) <= 1)
                                        {
                                            damage = (int)(Math.Round((double)damage * .5));
                                        }
                                    }

                                    DoHarmful(mobile);

                                    new Blood().MoveToWorld(mobile.Location, mobile.Map);
                                    AOS.Damage(mobile, this, damage, 0, 100, 0, 0, 0);
                                }
                            });
                        });
                    }
                });
            });
        }
コード例 #10
0
        public override void OnComponentUsed(AddonComponent c, Mobile from)
        {
            base.OnComponentUsed(c, from);

            if (!from.Alive)
            {
                return;
            }

            if (DateTime.UtcNow < NextUsageAllowed && from.AccessLevel == AccessLevel.Player)
            {
                string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, NextUsageAllowed, false, true, true, true, true);
                from.SendMessage("You must wait another " + timeRemaining + " before that may be used again.");

                return;
            }

            NextUsageAllowed = DateTime.UtcNow + UsageCooldown;

            BaseCreature deadCreature = null;

            switch (Utility.RandomMinMax(1, 3))
            {
            case 1: deadCreature = new Skeleton(); break;

            case 2: deadCreature = new Zombie(); break;

            case 3: deadCreature = new Ghoul(); break;
            }

            if (deadCreature == null)
            {
                return;
            }

            creature = deadCreature;

            Point3D creatureLocation = new Point3D(Location.X + 1, Location.Y + 1, Location.Z + 6);

            deadCreature.Blessed = true;
            deadCreature.Hidden  = true;
            deadCreature.Frozen  = true;

            deadCreature.MoveToWorld(creatureLocation, c.Map);

            int animation  = Utility.RandomMinMax(2, 3);
            int frameCount = 4;

            int bonesItemID = 6937;

            int    radius           = 3;
            double smallBonesChance = .25;

            Point3D startLocation = Location;
            Map     startMap      = Map;

            for (int a = -1 * radius; a < radius + 1; a++)
            {
                for (int b = -1 * radius; b < radius + 1; b++)
                {
                    Point3D newPoint = new Point3D(Location.X + a, Location.Y + b, Location.Z);
                    SpellHelper.AdjustField(ref newPoint, Map, 12, false);

                    double distanceFromCenter = Utility.GetDistanceToSqrt(Location, newPoint);

                    double extraBonesChance = 1;

                    if (distanceFromCenter >= 1)
                    {
                        extraBonesChance = (1 / (distanceFromCenter)) * smallBonesChance;
                    }

                    if (Utility.RandomDouble() <= extraBonesChance)
                    {
                        Timer.DelayCall(TimeSpan.FromSeconds(distanceFromCenter * .25), delegate
                        {
                            if (this == null)
                            {
                                return;
                            }
                            if (Deleted)
                            {
                                return;
                            }

                            TimedStatic smallBones = new TimedStatic(Utility.RandomList(6929, 6930, 6937, 6938, 6933, 6934, 6935, 6936, 6939, 6940, 6882, 6883), 5);
                            smallBones.Name        = "bones";
                            smallBones.MoveToWorld(startLocation, startMap);
                        });
                    }
                }
            }

            for (int a = 0; a < 30; a++)
            {
                Point3D newPoint = new Point3D(Location.X + Utility.RandomList(-4, -3, -2, 2, 3, 4), Location.Y + Utility.RandomList(-4, -3, -2, 2, 3, 4), Location.Z);
                SpellHelper.AdjustField(ref newPoint, Map, 12, false);

                TimedStatic smallBones = new TimedStatic(Utility.RandomList(6929, 6930, 6937, 6938, 6933, 6934, 6935, 6936, 6939, 6940, 6882, 6883), 5);
                smallBones.Name = "bones";
                smallBones.MoveToWorld(newPoint, Map);
            }

            Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate
            {
                if (deadCreature == null)
                {
                    return;
                }
                if (deadCreature.Deleted || !deadCreature.Alive)
                {
                    return;
                }

                deadCreature.Hidden = false;

                deadCreature.PlaySound(deadCreature.GetIdleSound());
                deadCreature.Animate(animation, frameCount, 1, false, false, 2);

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

                    deadCreature.PlaySound(deadCreature.GetAngerSound());
                    deadCreature.Delete();
                });
            });
        }
コード例 #11
0
ファイル: UOACZTunnel.cs プロジェクト: Pumpk1ns/outlands
        public override void OnDoubleClick(Mobile from)
        {
            base.OnDoubleClick(from);

            PlayerMobile player = from as PlayerMobile;

            if (player == null)
            {
                return;
            }
            if (!Visible)
            {
                return;
            }
            if (player.AccessLevel > AccessLevel.Player)
            {
                return;
            }

            if (Utility.GetDistance(from.Location, Location) > 1)
            {
                from.SendMessage("You are too far way from that to use it.");
                return;
            }

            if (player.LastPlayerCombatTime + UOACZSystem.TunnelDigPvPThreshold > DateTime.UtcNow)
            {
                string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, player.LastPlayerCombatTime + UOACZSystem.TunnelDigPvPThreshold, false, true, true, true, true);

                player.SendMessage("You have been in combat with another player too recently and must wait " + timeRemaining + " before you may use this a tunnel.");
                return;
            }

            List <UOACZTunnel> m_Destinations = new List <UOACZTunnel>();

            foreach (UOACZTunnel tunnel in m_Instances)
            {
                if (tunnel == null)
                {
                    continue;
                }
                if (tunnel.Deleted)
                {
                    continue;
                }
                if (!UOACZRegion.ContainsItem(tunnel))
                {
                    continue;
                }
                if (TunnelType == TunnelLocation.Town && tunnel.TunnelType == TunnelLocation.Town)
                {
                    continue;
                }
                if (TunnelType == TunnelLocation.Wilderness && tunnel.TunnelType == TunnelLocation.Wilderness)
                {
                    continue;
                }

                m_Destinations.Add(tunnel);
            }

            if (m_Destinations.Count == 0)
            {
                return;
            }

            Effects.PlaySound(Location, Map, 0x247);
            Effects.SendLocationEffect(Location, Map, 0x3728, 10, 10, 0, 0);

            TimedStatic dirt = new TimedStatic(Utility.RandomList(7681, 7682), 5);

            dirt.Name = "dirt";
            dirt.MoveToWorld(Location, Map);
            dirt.PublicOverheadMessage(MessageType.Regular, 0, false, "*goes into tunnel*");

            UOACZPersistance.CheckAndCreateUOACZAccountEntry(player);
            player.m_UOACZAccountEntry.TunnelsUsed++;

            for (int b = 0; b < 8; b++)
            {
                dirt      = new TimedStatic(Utility.RandomList(7681, 7682), 5);
                dirt.Name = "dirt";

                Point3D dirtLocation = new Point3D(Location.X + Utility.RandomList(-2, -1, 1, 2), Location.Y + Utility.RandomList(-2, -1, 1, 2), Location.Z);
                SpellHelper.AdjustField(ref dirtLocation, from.Map, 12, false);

                dirt.MoveToWorld(dirtLocation, Map);
            }

            UOACZTunnel targetTunnel = m_Destinations[Utility.RandomMinMax(0, m_Destinations.Count - 1)];

            Visible = false;

            player.Location = targetTunnel.Location;

            foreach (Mobile follower in player.AllFollowers)
            {
                if (UOACZSystem.IsUOACZValidMobile(follower))
                {
                    follower.Location = targetTunnel.Location;
                }
            }

            if (targetTunnel.TunnelType == TunnelLocation.Wilderness)
            {
                from.SendMessage("The tunnel collapses behind you and you find yourself in the wilderness.");
            }

            else
            {
                from.SendMessage("The tunnel collapses behind you and you find yourself in town.");
            }

            Effects.SendLocationEffect(targetTunnel.Location, targetTunnel.Map, 0x3728, 10, 10, 0, 0);
            Effects.PlaySound(targetTunnel.Location, targetTunnel.Map, 0x247);

            dirt      = new TimedStatic(Utility.RandomList(7681, 7682), 5);
            dirt.Name = "dirt";
            dirt.MoveToWorld(targetTunnel.Location, Map);
            dirt.PublicOverheadMessage(MessageType.Regular, 0, false, "*appears from tunnel*");

            for (int b = 0; b < 8; b++)
            {
                dirt      = new TimedStatic(Utility.RandomList(7681, 7682), 5);
                dirt.Name = "dirt";

                Point3D dirtLocation = new Point3D(targetTunnel.Location.X + Utility.RandomList(-2, -1, 1, 2), targetTunnel.Location.Y + Utility.RandomList(-2, -1, 1, 2), targetTunnel.Location.Z);
                SpellHelper.AdjustField(ref dirtLocation, Map, 12, false);

                dirt.MoveToWorld(dirtLocation, Map);
            }
        }
コード例 #12
0
ファイル: UOACZOilFlask.cs プロジェクト: Pumpk1ns/outlands
            protected override void OnTarget(Mobile from, object target)
            {
                PlayerMobile player = from as PlayerMobile;

                if (!UOACZSystem.IsUOACZValidMobile(player))
                {
                    return;
                }
                if (!player.IsUOACZHuman)
                {
                    return;
                }

                if (m_OilFlask == null)
                {
                    return;
                }
                if (m_OilFlask.Deleted)
                {
                    return;
                }

                if (!m_OilFlask.IsChildOf(from.Backpack))
                {
                    from.SendMessage("The oil flask is no longer in your pack.");
                    return;
                }

                IPoint3D location = target as IPoint3D;

                if (location == null)
                {
                    return;
                }

                Map map = player.Map;

                if (map == null)
                {
                    return;
                }

                SpellHelper.GetSurfaceTop(ref location);

                if (location is Mobile)
                {
                    targetLocation = (Mobile)location;
                }

                else
                {
                    targetLocation = new Entity(Serial.Zero, new Point3D(location), map);
                }

                if (Utility.GetDistance(player.Location, targetLocation.Location) > ThrowRange)
                {
                    player.SendMessage("That location is too far away.");
                    return;
                }

                if (!player.Map.InLOS(player.Location, targetLocation.Location))
                {
                    player.SendMessage("That is not within in your line of sight.");
                    return;
                }

                player.RevealingAction();

                SpecialAbilities.HinderSpecialAbility(1.0, null, player, 1.0, 1, true, 0, false, "", "", "-1");

                m_OilFlask.Delete();

                player.Animate(31, 7, 1, true, false, 0);

                Timer.DelayCall(usageCooldown, delegate
                {
                    if (player != null)
                    {
                        player.EndAction(typeof(UOACZOilFlask));
                    }
                });

                int throwSound  = 0x5D3;
                int hitSound    = Utility.RandomList(0x38E, 0x38F, 0x390);
                int effectSound = 0x5D8;
                int itemID      = 7192;
                int itemHue     = 0;

                int    radius = 2;
                double additionalOilChance = .5;

                Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate
                {
                    if (!UOACZSystem.IsUOACZValidMobile(player))
                    {
                        return;
                    }
                    if (!player.IsUOACZHuman)
                    {
                        return;
                    }

                    Effects.PlaySound(player.Location, player.Map, throwSound);

                    IEntity startLocation = new Entity(Serial.Zero, new Point3D(player.Location.X, player.Location.Y, player.Location.Z + 5), player.Map);
                    IEntity endLocation   = new Entity(Serial.Zero, new Point3D(targetLocation.Location.X, targetLocation.Location.Y, targetLocation.Location.Z + 5), targetLocation.Map);

                    Effects.SendMovingEffect(startLocation, endLocation, itemID, 10, 0, false, false, itemHue, 0); //5

                    double distance         = player.GetDistanceToSqrt(endLocation.Location);
                    double destinationDelay = (double)distance * .06; //.08

                    Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate
                    {
                        if (!UOACZPersistance.Active)
                        {
                            return;
                        }

                        Effects.PlaySound(endLocation.Location, endLocation.Map, hitSound);

                        for (int a = -1 * radius; a < radius + 1; a++)
                        {
                            for (int b = -1 * radius; b < radius + 1; b++)
                            {
                                Point3D newPoint = new Point3D(endLocation.Location.X + a, endLocation.Location.Y + b, endLocation.Location.Z);
                                SpellHelper.AdjustField(ref newPoint, map, 12, false);

                                if (!map.InLOS(endLocation.Location, newPoint))
                                {
                                    continue;
                                }

                                double distanceFromCenter = Utility.GetDistanceToSqrt(endLocation.Location, newPoint);

                                bool validLocation = true;

                                double extraOilChance = 1;

                                if (distanceFromCenter >= 1)
                                {
                                    extraOilChance = (1 / (distanceFromCenter)) * additionalOilChance;
                                }

                                if (Utility.RandomDouble() <= extraOilChance)
                                {
                                    Timer.DelayCall(TimeSpan.FromSeconds(distanceFromCenter * .1), delegate
                                    {
                                        if (!UOACZPersistance.Active)
                                        {
                                            return;
                                        }

                                        bool foundAnother = false;

                                        IPooledEnumerable nearbyItems = map.GetItemsInRange(newPoint, 0);

                                        foreach (Item item in nearbyItems)
                                        {
                                            if (item is UOACZOilLocation)
                                            {
                                                foundAnother = true;
                                                break;
                                            }
                                        }

                                        nearbyItems.Free();

                                        if (!foundAnother)
                                        {
                                            Effects.PlaySound(newPoint, map, effectSound);
                                            new UOACZOilLocation().MoveToWorld(newPoint, map);
                                        }
                                    });
                                }
                            }
                        }
                    });
                });
            }
コード例 #13
0
        public override void Drink(Mobile from)
        {
            if (this != null && ParentEntity != from.Backpack)
            {
                from.SendMessage("The potion must be in your pack to drink it.");
            }

            else
            {
                if (!from.CanBeginAction(typeof(UOACZLesserConfusionPotion)))
                {
                    from.SendMessage("You must wait before using another potion of that type.");
                    return;
                }

                from.BeginAction(typeof(UOACZLesserConfusionPotion));

                Timer.DelayCall(TimeSpan.FromSeconds(60), delegate
                {
                    from.EndAction(typeof(UOACZLesserConfusionPotion));
                });

                Consume();

                Point3D location = from.Location;
                Map     map      = from.Map;

                int    range    = 2;
                double duration = 5;

                Queue m_Queue = new Queue();

                IPooledEnumerable nearbyMobiles = map.GetMobilesInRange(location, range);

                foreach (Mobile mobile in nearbyMobiles)
                {
                    if (mobile == from)
                    {
                        continue;
                    }
                    if (!UOACZSystem.IsUOACZValidMobile(mobile))
                    {
                        continue;
                    }
                    if (!(mobile is BaseCreature))
                    {
                        continue;
                    }

                    bool validCombatant = false;

                    if (mobile.Combatant != null && mobile.Combatant == from)
                    {
                        validCombatant = true;
                    }

                    foreach (AggressorInfo aggressor in from.Aggressors)
                    {
                        if (aggressor.Attacker == mobile || aggressor.Defender == mobile)
                        {
                            validCombatant = true;
                        }
                    }

                    foreach (AggressorInfo aggressed in from.Aggressed)
                    {
                        if (aggressed.Attacker == mobile || aggressed.Defender == mobile)
                        {
                            validCombatant = true;
                        }
                    }

                    if (mobile is UOACZBaseHuman && !validCombatant)
                    {
                        continue;
                    }

                    m_Queue.Enqueue(mobile);
                }

                nearbyMobiles.Free();

                while (m_Queue.Count > 0)
                {
                    BaseCreature bc_Creature = (BaseCreature)m_Queue.Dequeue();

                    bc_Creature.Pacify(from, TimeSpan.FromSeconds(duration), false);
                }

                for (int a = 0; a < 30; a++)
                {
                    Timer.DelayCall(TimeSpan.FromSeconds(a * .05), delegate
                    {
                        if (!UOACZPersistance.Active)
                        {
                            return;
                        }

                        Point3D effectLocation = new Point3D(location.X + Utility.RandomMinMax(-1 * range, range), location.Y + Utility.RandomMinMax(-1 * range, range), location.Z);
                        SpellHelper.AdjustField(ref effectLocation, map, 12, false);

                        IEntity explosionLocationEntity = new Entity(Serial.Zero, new Point3D(effectLocation.X, effectLocation.Y, effectLocation.Z - 1), map);

                        switch (Utility.RandomMinMax(1, 3))
                        {
                        case 1: Effects.SendLocationParticles(explosionLocationEntity, 0x37B9, 10, 6, 0, 0, 5044, 0); break;

                        case 2: Effects.SendLocationParticles(explosionLocationEntity, 0x372A, 10, 20, 0, 0, 5029, 0); break;

                        case 3: Effects.SendLocationParticles(explosionLocationEntity, Utility.RandomList(0x36BD, 0x36BF, 0x36CB, 0x36BC), 30, 7, 2499, 0, 5044, 0); break;
                        }

                        Effects.SendLocationParticles(explosionLocationEntity, 0x3709, 10, 30, 2499, 0, 5029, 0);
                        Effects.PlaySound(explosionLocationEntity.Location, map, Utility.RandomList(0x22A, 0x229));
                    });
                }
            }
        }
コード例 #14
0
        public void ArrowStorm()
        {
            if (!UOACZSystem.IsUOACZValidMobile(this))
            {
                return;
            }

            int arrowStormRange = 20;

            IPooledEnumerable nearbyMobiles = Map.GetMobilesInRange(Location, arrowStormRange);

            int mobileCount = 0;

            foreach (Mobile mobile in nearbyMobiles)
            {
                if (mobile == this)
                {
                    continue;
                }
                if (!UOACZSystem.IsUOACZValidMobile(mobile))
                {
                    continue;
                }
                if (!Map.InLOS(Location, mobile.Location))
                {
                    continue;
                }
                if (mobile.Hidden)
                {
                    continue;
                }
                if (mobile is UOACZBaseHuman)
                {
                    continue;
                }
                if (mobile is UOACZBaseWildlife)
                {
                    continue;
                }

                if (mobile is PlayerMobile)
                {
                    PlayerMobile pm_Mobile = mobile as PlayerMobile;

                    if (pm_Mobile.IsUOACZHuman && Combatant != pm_Mobile)
                    {
                        continue;
                    }
                }

                mobileCount++;
            }

            nearbyMobiles.Free();
            nearbyMobiles = Map.GetMobilesInRange(Location, arrowStormRange);

            List <Mobile> m_NearbyMobiles = new List <Mobile>();

            foreach (Mobile mobile in nearbyMobiles)
            {
                if (mobile == this)
                {
                    continue;
                }
                if (!UOACZSystem.IsUOACZValidMobile(mobile))
                {
                    continue;
                }
                if (!Map.InLOS(Location, mobile.Location))
                {
                    continue;
                }
                if (mobile.Hidden)
                {
                    continue;
                }
                if (mobile is UOACZBaseHuman)
                {
                    continue;
                }
                if (mobile is UOACZBaseWildlife)
                {
                    continue;
                }

                if (mobile is PlayerMobile)
                {
                    PlayerMobile pm_Mobile = mobile as PlayerMobile;

                    if (pm_Mobile.IsUOACZHuman && Combatant != pm_Mobile)
                    {
                        continue;
                    }
                }

                if (Combatant != null)
                {
                    if (mobileCount > 1 && mobile == Combatant)
                    {
                        continue;
                    }
                }

                m_NearbyMobiles.Add(mobile);
            }

            nearbyMobiles.Free();

            if (m_NearbyMobiles.Count == 0)
            {
                return;
            }

            Mobile mobileTarget = m_NearbyMobiles[Utility.RandomMinMax(0, m_NearbyMobiles.Count - 1)];

            double spawnPercent = (double)intervalCount / (double)totalIntervals;

            int maxExtraArrows = 6;
            int arrows         = 6 + (int)Math.Ceiling(((double)maxExtraArrows * spawnPercent));

            double directionDelay = .25;
            double initialDelay   = 1;
            double arrowDelay     = .1;
            double totalDelay     = 1 + directionDelay + initialDelay + ((double)arrows * arrowDelay);

            SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1.0, totalDelay, true, 0, false, "", "", "-1");

            m_NextArrowStormAllowed = DateTime.UtcNow + NextArrowStormDelay + TimeSpan.FromSeconds(totalDelay);
            m_NextAbilityAllowed    = DateTime.UtcNow + NextAbilityDelay + TimeSpan.FromSeconds(totalDelay);

            AbilityInProgress = true;

            Timer.DelayCall(TimeSpan.FromSeconds(totalDelay), delegate
            {
                if (!UOACZSystem.IsUOACZValidMobile(this))
                {
                    return;
                }
                AbilityInProgress = false;
            });

            PublicOverheadMessage(MessageType.Regular, 0, false, "*unleashes a storm of arrows*");

            Point3D location = Location;
            Map     map      = Map;

            Point3D targetLocation = mobileTarget.Location;
            Map     targetMap      = mobileTarget.Map;

            Direction = Utility.GetDirection(Location, targetLocation);

            Timer.DelayCall(TimeSpan.FromSeconds(directionDelay), delegate
            {
                if (!UOACZSystem.IsUOACZValidMobile(this))
                {
                    return;
                }

                PlaySound(0x522);

                Timer.DelayCall(TimeSpan.FromSeconds(initialDelay), delegate
                {
                    if (!UOACZSystem.IsUOACZValidMobile(this))
                    {
                        return;
                    }

                    for (int a = 0; a < arrows; a++)
                    {
                        Timer.DelayCall(TimeSpan.FromSeconds(a * arrowDelay), delegate
                        {
                            if (!UOACZSystem.IsUOACZValidMobile(this))
                            {
                                return;
                            }

                            bool mobileTargetValid = true;

                            if (mobileTarget == null)
                            {
                                mobileTargetValid = false;
                            }

                            else if (mobileTarget.Deleted || !mobileTarget.Alive)
                            {
                                mobileTargetValid = false;
                            }

                            else
                            {
                                if (mobileTarget.Hidden || Utility.GetDistance(Location, mobileTarget.Location) >= arrowStormRange)
                                {
                                    mobileTargetValid = false;
                                }
                            }

                            if (mobileTargetValid)
                            {
                                targetLocation = mobileTarget.Location;
                                targetMap      = mobileTarget.Map;
                            }

                            int effectSound = 0x238;
                            int itemID      = 3906; //7166
                            int itemHue     = 0;

                            int impactSound = 0x234;
                            int impactHue   = 0;

                            int xOffset = 0;
                            int yOffset = 0;

                            int distance = Utility.GetDistance(Location, targetLocation);

                            if (distance > 1)
                            {
                                if (Utility.RandomDouble() <= .25)
                                {
                                    xOffset = Utility.RandomList(-1, 1);
                                }

                                if (Utility.RandomDouble() <= .25)
                                {
                                    yOffset = Utility.RandomList(-1, 1);
                                }
                            }

                            IEntity startLocation = new Entity(Serial.Zero, new Point3D(location.X, location.Y, location.Z + 10), map);

                            Point3D adjustedLocation = new Point3D(targetLocation.X + xOffset, targetLocation.Y + yOffset, targetLocation.Z);
                            SpellHelper.AdjustField(ref adjustedLocation, targetMap, 12, false);

                            IEntity endLocation = new Entity(Serial.Zero, new Point3D(adjustedLocation.X, adjustedLocation.Y, adjustedLocation.Z + 10), targetMap);

                            Effects.PlaySound(location, map, effectSound);
                            Effects.SendMovingEffect(startLocation, endLocation, itemID, 8, 0, false, false, itemHue, 0);

                            double targetDistance   = Utility.GetDistanceToSqrt(location, adjustedLocation);
                            double destinationDelay = (double)targetDistance * .06;

                            Direction newDirection = Utility.GetDirection(location, adjustedLocation);

                            if (Direction != newDirection)
                            {
                                Direction = newDirection;
                            }

                            Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate
                            {
                                if (!UOACZSystem.IsUOACZValidMobile(this))
                                {
                                    return;
                                }

                                PlaySound(0x238);

                                Queue m_Queue = new Queue();

                                nearbyMobiles = targetMap.GetMobilesInRange(adjustedLocation, 0);

                                foreach (Mobile mobile in nearbyMobiles)
                                {
                                    if (mobile == this)
                                    {
                                        continue;
                                    }
                                    if (!UOACZSystem.IsUOACZValidMobile(mobile))
                                    {
                                        continue;
                                    }
                                    if (mobile is UOACZBaseHuman)
                                    {
                                        continue;
                                    }
                                    if (mobile is UOACZBaseWildlife)
                                    {
                                        continue;
                                    }

                                    if (mobile is PlayerMobile)
                                    {
                                        PlayerMobile pm_Mobile = mobile as PlayerMobile;

                                        if (pm_Mobile.IsUOACZHuman && Combatant != pm_Mobile)
                                        {
                                            continue;
                                        }
                                    }

                                    m_Queue.Enqueue(mobile);
                                }

                                nearbyMobiles.Free();

                                while (m_Queue.Count > 0)
                                {
                                    Mobile mobile = (Mobile)m_Queue.Dequeue();

                                    int damage = DamageMin;

                                    if (mobile is BaseCreature)
                                    {
                                        damage *= 2;
                                    }

                                    DoHarmful(mobile);

                                    mobile.PlaySound(0x234);

                                    new Blood().MoveToWorld(mobile.Location, mobile.Map);
                                    AOS.Damage(mobile, this, damage, 100, 0, 0, 0, 0);
                                }
                            });
                        });
                    }
                });
            });
        }
コード例 #15
0
        public void FindCreature(Mobile from, int creatureLevel)
        {
            if (from == null)
            {
                return;
            }

            PlayerMobile player = from as PlayerMobile;

            if (player == null)
            {
                return;
            }

            int waterLocationChecks = 20;

            int minSpawnRadius = 3;
            int maxSpawnRadius = 6;

            bool foundWaterSpot   = false;
            bool spawnedCreatures = false;

            Point3D spawnLocation = Location;
            Point3D newLocation   = new Point3D();

            for (int a = 0; a < waterLocationChecks; a++)
            {
                int x = X;

                int xOffset = Utility.RandomMinMax(minSpawnRadius, maxSpawnRadius);
                if (Utility.RandomDouble() >= .5)
                {
                    xOffset *= -1;
                }

                x += xOffset;

                int y = Y;

                int yOffset = Utility.RandomMinMax(minSpawnRadius, maxSpawnRadius);
                if (Utility.RandomDouble() >= .5)
                {
                    yOffset *= -1;
                }

                y += yOffset;

                newLocation.X = x;
                newLocation.Y = y;
                newLocation.Z = -5;

                bool waterTile = BaseShip.IsWaterTile(newLocation, Map);

                if (waterTile)
                {
                    if (BaseShip.FindShipAt(newLocation, Map) != null)
                    {
                        continue;
                    }

                    SpellHelper.AdjustField(ref spawnLocation, Map, 12, false);

                    foundWaterSpot = true;
                    break;
                }
            }

            if (!foundWaterSpot)
            {
                return;
            }

            int count = 0;

            switch (creatureLevel)
            {
            case 1:
                count = Utility.RandomMinMax(1, 2);

                for (int a = 0; a < count; a++)
                {
                    BaseCreature bc_Creature = new Puddle();

                    bc_Creature.m_WasFishedUp = true;
                    bc_Creature.MoveToWorld(spawnLocation, from.Map);
                    spawnedCreatures = true;
                }

                if (spawnedCreatures)
                {
                    from.PublicOverheadMessage(MessageType.Regular, 0, false, "*something was hiding in the wreckage!*");
                }
                break;

            case 2:
                if (player.ShipOccupied != null)
                {
                    if (!player.ShipOccupied.Deleted && player.ShipOccupied.m_SinkTimer == null)
                    {
                        count = Utility.RandomMinMax(2, 4);

                        for (int a = 0; a < count; a++)
                        {
                            BaseCreature bc_Creature = new ColossusTermite();

                            bc_Creature.m_WasFishedUp = true;
                            bc_Creature.MoveToWorld(player.ShipOccupied.GetRandomEmbarkLocation(false), from.Map);
                            spawnedCreatures = true;
                        }
                    }
                }

                if (spawnedCreatures)
                {
                    from.PublicOverheadMessage(MessageType.Regular, 0, false, "*the wreckage was full of termites!*");
                }
                break;

            case 3:
                count = Utility.RandomMinMax(1, 2);

                for (int a = 0; a < count; a++)
                {
                    BaseCreature bc_Creature = new DeepSeaSerpent();

                    bc_Creature.m_WasFishedUp = true;
                    bc_Creature.MoveToWorld(spawnLocation, from.Map);
                    spawnedCreatures = true;
                }

                if (spawnedCreatures)
                {
                    from.PublicOverheadMessage(MessageType.Regular, 0, false, "*something was hiding in the wreckage!*");
                }
                break;

            case 4:
                count = Utility.RandomMinMax(1, 2);

                for (int a = 0; a < count; a++)
                {
                    BaseCreature bc_Creature = new Kraken();

                    bc_Creature.m_WasFishedUp = true;
                    bc_Creature.MoveToWorld(spawnLocation, from.Map);
                    spawnedCreatures = true;
                }

                if (spawnedCreatures)
                {
                    from.PublicOverheadMessage(MessageType.Regular, 0, false, "*something was hiding in the wreckage!*");
                }
                break;
            }
        }
コード例 #16
0
        public override void OnGaveMeleeAttack(Mobile defender)
        {
            base.OnGaveMeleeAttack(defender);

            if (Utility.RandomDouble() <= .15)
            {
                if (defender == null)
                {
                    return;
                }
                if (defender.Deleted || !defender.Alive)
                {
                    return;
                }

                Point3D location = defender.Location;
                Map     map      = defender.Map;

                double belowDuration = 15;

                double damage = 30;

                if (defender is BaseCreature)
                {
                    damage *= 2;
                }

                SpecialAbilities.BleedSpecialAbility(1.0, this, defender, damage, 30, -1, true, "", "", "-1");
                SpecialAbilities.HinderSpecialAbility(1.0, null, defender, 1.0, belowDuration, false, -1, false, "", "You have been 'taken below' and cannot move or speak!", "-1");

                Squelched = true;

                defender.Squelched = true;
                defender.Hidden    = true;

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

                    defender.Squelched = false;
                    defender.Hidden    = false;
                });

                Blessed = true;

                Effects.PlaySound(location, defender.Map, 0x246); //0x0FB

                PublicOverheadMessage(MessageType.Regular, 0, false, "*takes them down below...*");
                SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1.0, belowDuration, false, -1, false, "", "", "-1");

                Effects.SendLocationParticles(EffectItem.Create(location, defender.Map, TimeSpan.FromSeconds(0.25)), 0x3709, 10, 30, 2051, 0, 5029, 0);

                TimedStatic floorHole = new TimedStatic(7025, belowDuration + 1);
                floorHole.Name = "pit to below";
                floorHole.MoveToWorld(location, defender.Map);

                for (int a = 0; a < 6; a++)
                {
                    TimedStatic pitPlasm = new TimedStatic(Utility.RandomList(4650, 4651, 4653, 4654, 4655), belowDuration - 1);
                    pitPlasm.Name = "pit plasm";
                    pitPlasm.Hue  = 2052;

                    Point3D pitPlasmLocation = new Point3D(location.X + Utility.RandomList(-2, 2), location.Y + Utility.RandomList(-2, 2), location.Z);
                    SpellHelper.AdjustField(ref pitPlasmLocation, defender.Map, 12, false);

                    pitPlasm.MoveToWorld(pitPlasmLocation, defender.Map);
                }

                IEntity pitLocationEntity = new Entity(Serial.Zero, new Point3D(defender.X, defender.Y, defender.Z), defender.Map);
                Effects.SendLocationParticles(pitLocationEntity, 0x3709, 10, 60, 2053, 0, 5052, 0);

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

                    MoveToWorld(location, map);

                    for (int a = 0; a < 20; a++)
                    {
                        Timer.DelayCall(TimeSpan.FromSeconds(a * .1), delegate
                        {
                            if (this == null)
                            {
                                return;
                            }
                            if (Deleted || !Alive)
                            {
                                return;
                            }

                            Z--;
                        });
                    }

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

                        Blessed = false;
                        Delete();
                    });
                });
            }
        }
コード例 #17
0
ファイル: Food.cs プロジェクト: zerodowned/uo-shards-outlands
        public virtual bool Eat(Mobile from)
        {
            if (AttemptEat(from))
            {
                //Player Enhancement Customization: Mouthy
                bool mouthy = false; //PlayerEnhancementPersistance.IsCustomizationEntryActive(from, CustomizationType.Mouthy);

                if (from.Body.IsHuman && !from.Mounted)
                {
                    from.Animate(34, 5, 1, true, false, 0);
                }

                Point3D location = from.Location;
                Map     map      = from.Map;

                if (mouthy)
                {
                    //Chomp
                    from.PlaySound(Utility.RandomList(0x5DA));
                    from.PublicOverheadMessage(MessageType.Regular, 0, false, "*chomps*");

                    for (int a = 1; a < 3; a++)
                    {
                        Timer.DelayCall(TimeSpan.FromSeconds(a * 1), delegate
                        {
                            if (from == null)
                            {
                                return;
                            }
                            if (!from.Alive)
                            {
                                return;
                            }

                            if (from.Body.IsHuman && !from.Mounted)
                            {
                                from.Animate(34, 5, 1, true, false, 0);
                            }

                            //Chew
                            if (Utility.RandomDouble() <= .75)
                            {
                                from.PlaySound(Utility.RandomList(0x5A9, 0x5AB, 0x03A, 0x03B, 0x03C));
                                from.PublicOverheadMessage(MessageType.Regular, 0, false, "*chews noisily*");
                            }

                            //Spill
                            else
                            {
                                from.PlaySound(Utility.RandomList(0x5D8, 0x5D9, 0x5DB, 0x5A2, 0x580, 0x581));

                                TimedStatic droppedFood = new TimedStatic(2482, 5);

                                switch (Utility.RandomMinMax(1, 3))
                                {
                                case 1:
                                    droppedFood.Name   = "food mush";
                                    droppedFood.ItemID = 2484;
                                    droppedFood.Hue    = 2313;
                                    break;

                                case 2:
                                    droppedFood.Name   = "food mush";
                                    droppedFood.ItemID = 2485;
                                    droppedFood.Hue    = 2313;
                                    break;

                                case 3:
                                    droppedFood.Name   = "food mush";
                                    droppedFood.ItemID = 2486;
                                    droppedFood.Hue    = 2313;
                                    break;
                                }

                                from.PublicOverheadMessage(MessageType.Regular, 0, false, "*spills*");

                                Point3D foodLocation = new Point3D(location.X + Utility.RandomList(-1, 1), location.Y + Utility.RandomList(-1, 1), location.Z);
                                SpellHelper.AdjustField(ref foodLocation, map, 12, false);

                                droppedFood.MoveToWorld(foodLocation, map);
                            }
                        });
                    }
                }

                else
                {
                    from.PlaySound(Utility.Random(0x3A, 3));
                }

                if (m_Poison != null)
                {
                    from.ApplyPoison(m_Poisoner, m_Poison);
                }

                if (Stackable)
                {
                    Consume();
                }

                else if (m_Charges > 1)
                {
                    m_Charges--;
                }

                else
                {
                    Delete();
                }

                return(true);
            }

            return(false);
        }
コード例 #18
0
ファイル: UOACZVoidSlime.cs プロジェクト: Pumpk1ns/outlands
        public override void OnThink()
        {
            base.OnThink();

            //Prevent Melee Attacks
            LastSwingTime = DateTime.UtcNow + TimeSpan.FromSeconds(30);

            if (DateTime.UtcNow >= m_NextVoidAttackAllowed && AIObject.currentCombatRange != CombatRange.Withdraw && AIObject.Action != ActionType.Flee)
            {
                Mobile combatant = Combatant;

                if (combatant != null && !CantWalk && !Frozen && Alive && !IsDeadPet && !IsDeadBondedPet)
                {
                    if (combatant.Alive && InLOS(combatant) && GetDistanceToSqrt(combatant) <= 8)
                    {
                        RevealingAction();

                        SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1.0, 1.0, true, 0, false, "", "", "-1");

                        double entangleDuration = 3;
                        double pierceAmount     = .25;
                        double crippleAmount    = .20;

                        TimeSpan attackCooldown = NextPvMVoidAttackDelay;

                        double effectChance = .10;
                        double damageScalar = 1.0;

                        if (Controlled && ControlMaster != null)
                        {
                            if (ControlMaster is PlayerMobile)
                            {
                                if (combatant is PlayerMobile)
                                {
                                    effectChance = .01;
                                }

                                else
                                {
                                    effectChance = .25;
                                }
                            }
                        }

                        if (ControlMaster is PlayerMobile && combatant is PlayerMobile)
                        {
                            entangleDuration = 1;
                            attackCooldown   = NextPvPVoidAttackDelay;
                        }

                        m_NextVoidAttackAllowed = DateTime.UtcNow + attackCooldown;

                        Animate(4, 4, 1, true, false, 0);

                        BaseWeapon weapon = Weapon as BaseWeapon;

                        if (weapon == null)
                        {
                            return;
                        }

                        bool hitSuccessful = false;

                        if (weapon.CheckHit(this, combatant))
                        {
                            hitSuccessful = true;
                        }

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

                        MovingEffect(combatant, 0x573E, 8, 1, false, false, 2200, 0);

                        IEntity startLocation = new Entity(Serial.Zero, new Point3D(Location.X, Location.Y, Location.Z + 10), Map);

                        double distance         = Utility.GetDistanceToSqrt(Location, combatant.Location);
                        double destinationDelay = (double)distance * .08;

                        if (hitSuccessful)
                        {
                            Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate
                            {
                                if (Deleted || !Alive || IsDeadPet || IsDeadBondedPet)
                                {
                                    return;
                                }
                                if (!SpecialAbilities.IsDamagable(combatant))
                                {
                                    return;
                                }
                                if (Utility.GetDistance(Location, combatant.Location) >= 20)
                                {
                                    return;
                                }

                                TimedStatic voidResidue = new TimedStatic(Utility.RandomList(4650, 4651, 4652, 4653, 4654, 4655), 5);
                                voidResidue.Hue         = 2051;
                                voidResidue.Name        = "void residue";
                                voidResidue.MoveToWorld(new Point3D(combatant.X, combatant.Y, combatant.Z), Map);

                                if (Utility.RandomDouble() <= effectChance)
                                {
                                    Effects.PlaySound(combatant.Location, combatant.Map, 0x5DC);

                                    for (int a = 0; a < 3; a++)
                                    {
                                        voidResidue      = new TimedStatic(Utility.RandomList(4650, 4651, 4652, 4653, 4654, 4655), 5);
                                        voidResidue.Hue  = 2051;
                                        voidResidue.Name = "void residue";

                                        Point3D voidResidueLocation = new Point3D(combatant.X + Utility.RandomMinMax(-1, 1), combatant.Y + Utility.RandomMinMax(-1, 1), combatant.Z);
                                        SpellHelper.AdjustField(ref voidResidueLocation, combatant.Map, 12, false);

                                        voidResidue.MoveToWorld(voidResidueLocation, combatant.Map);
                                    }

                                    combatant.SendMessage("You have been covered in void residue!");
                                    combatant.FixedParticles(0x374A, 10, 15, 5021, 2051, 0, EffectLayer.Waist);

                                    SpecialAbilities.EntangleSpecialAbility(1.0, this, combatant, 1, entangleDuration, 0, false, "", "", "-1");
                                    SpecialAbilities.PierceSpecialAbility(1.0, this, combatant, pierceAmount, 50, 0, false, "", "", "-1");
                                    SpecialAbilities.CrippleSpecialAbility(1.0, this, combatant, crippleAmount, 10, 0, false, "", "", "-1");
                                }

                                weapon.OnHit(this, combatant, damageScalar);
                            });
                        }
                    }
                }
            }
        }
コード例 #19
0
        public override void OnThink()
        {
            base.OnThink();

            //Prevent Melee Attacks
            LastSwingTime = DateTime.UtcNow + TimeSpan.FromSeconds(30);

            Mobile combatant = Combatant;

            if (ControlMaster is PlayerMobile)
            {
                int minSeconds = 0;
                int maxSeconds = (int)(Math.Round(NextPvMVoidAttackDelay.TotalSeconds));

                if (combatant == null)
                {
                    m_NextVoidAttackAllowed = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(minSeconds, maxSeconds));
                }
            }

            if (DateTime.UtcNow >= m_NextVoidAttackAllowed && AIObject.currentCombatRange != CombatRange.Withdraw && AIObject.Action != ActionType.Flee)
            {
                if (combatant != null && !CantWalk && !Frozen && !IsHindered() && Alive && !IsDeadFollower && !IsDeadBondedFollower)
                {
                    if (combatant.Alive && InLOS(combatant) && GetDistanceToSqrt(combatant) <= 8)
                    {
                        RevealingAction();

                        SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1.0, 1.0, true, 0, false, "", "", "-1");

                        double entangleDuration = 3;
                        double pierceAmount     = .25;
                        double crippleAmount    = .20;

                        TimeSpan attackCooldown = NextPvMVoidAttackDelay;

                        double effectChance = .2;
                        double damageScalar = 1.0;

                        m_NextVoidAttackAllowed = DateTime.UtcNow + attackCooldown;

                        Animate(4, 4, 1, true, false, 0);

                        BaseWeapon weapon = Weapon as BaseWeapon;

                        if (weapon == null)
                        {
                            return;
                        }

                        bool hitSuccessful = false;

                        if (weapon.CheckHit(this, combatant))
                        {
                            hitSuccessful = true;
                        }

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

                        int itemID  = 0x573E; // Utility.RandomList(0x122A, 0x122B, 0x122C, 0x122D, 0x122E, 0x122F);
                        int itemHue = 38;

                        MovingEffect(combatant, itemID, 8, 1, false, false, itemHue, 0);

                        IEntity startLocation = new Entity(Serial.Zero, new Point3D(Location.X, Location.Y, Location.Z + 10), Map);

                        double distance         = Utility.GetDistanceToSqrt(Location, combatant.Location);
                        double destinationDelay = (double)distance * .08;

                        if (hitSuccessful)
                        {
                            Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate
                            {
                                if (this == null)
                                {
                                    return;
                                }
                                if (Deleted || !Alive || IsDeadFollower || IsDeadBondedFollower)
                                {
                                    return;
                                }
                                if (!SpecialAbilities.IsDamagable(combatant))
                                {
                                    return;
                                }
                                if (Utility.GetDistance(Location, combatant.Location) >= 20)
                                {
                                    return;
                                }

                                new Blood(TimeSpan.FromSeconds(10)).MoveToWorld(new Point3D(combatant.X, combatant.Y, combatant.Z), Map);

                                if (Utility.RandomDouble() <= effectChance)
                                {
                                    Effects.PlaySound(combatant.Location, combatant.Map, 0x5DC);

                                    for (int a = 0; a < 3; a++)
                                    {
                                        Point3D voidResidueLocation = new Point3D(combatant.X + Utility.RandomMinMax(-1, 1), combatant.Y + Utility.RandomMinMax(-1, 1), combatant.Z);
                                        SpellHelper.AdjustField(ref voidResidueLocation, combatant.Map, 12, false);

                                        new Blood(TimeSpan.FromSeconds(10)).MoveToWorld(voidResidueLocation, combatant.Map);
                                    }

                                    combatant.SendMessage("You have been covered in sticky blood!");
                                    combatant.FixedParticles(0x374A, 10, 15, 5021, 38, 0, EffectLayer.Waist);

                                    SpecialAbilities.EntangleSpecialAbility(1.0, this, combatant, 2, entangleDuration, 0, false, "", "", "-1");
                                }

                                weapon.OnHit(this, combatant, damageScalar);
                            });
                        }
                    }
                }
            }
        }
コード例 #20
0
ファイル: Beverage.cs プロジェクト: Pumpk1ns/outlands
        public virtual void OnDrink(Mobile from)
        {
            //Player Enhancement Customization: Mouthy
            bool mouthy = PlayerEnhancementPersistance.IsCustomizationEntryActive(from, CustomizationType.Mouthy);

            if (from.Body.IsHuman && !from.Mounted)
            {
                from.Animate(34, 5, 1, true, false, 0);
            }

            Point3D location = from.Location;
            Map     map      = from.Map;

            if (mouthy)
            {
                //Chomp
                from.PlaySound(Utility.RandomList(0x5AD));
                from.PublicOverheadMessage(MessageType.Regular, 0, false, "*opens a drink*");

                for (int a = 1; a < 3; a++)
                {
                    Timer.DelayCall(TimeSpan.FromSeconds(a * 1), delegate
                    {
                        if (from == null)
                        {
                            return;
                        }
                        if (!from.Alive)
                        {
                            return;
                        }

                        if (from.Body.IsHuman && !from.Mounted)
                        {
                            from.Animate(34, 5, 1, true, false, 0);
                        }

                        //Gargle
                        if (Utility.RandomDouble() <= .02)
                        {
                            from.PlaySound(Utility.RandomList(0x021));
                            from.PublicOverheadMessage(MessageType.Regular, 0, false, "*gargles*");
                        }

                        //Chug
                        else if (Utility.RandomDouble() <= .75)
                        {
                            from.PlaySound(Utility.RandomList(0x4CC, 0x4CD, 0x030, 0x031));
                            from.PublicOverheadMessage(MessageType.Regular, 0, false, "*drinks*");
                        }

                        //Spill
                        else
                        {
                            from.PlaySound(Utility.RandomList(0x5A4, 0x4D1, 0x2D7, 0x23F, 0x022));

                            TimedStatic splashedWater = new TimedStatic(2482, 5);

                            splashedWater.ItemID = Utility.RandomList(4651, 4652, 4653, 4654);
                            splashedWater.Hue    = 2592;

                            Point3D splashLocation = new Point3D(location.X + Utility.RandomList(-1, 1), location.Y + Utility.RandomList(-1, 1), location.Z);
                            SpellHelper.AdjustField(ref splashLocation, map, 12, false);

                            splashedWater.MoveToWorld(splashLocation, map);

                            from.PublicOverheadMessage(MessageType.Regular, 0, false, "*spills*");
                        }
                    });
                }
            }
        }
コード例 #21
0
        public void FlameMark()
        {
            if (!SpecialAbilities.Exists(this))
            {
                return;
            }

            IPooledEnumerable nearbyMobiles = Map.GetMobilesInRange(Location, FireBarrageRange);

            int mobileCount = 0;

            foreach (Mobile mobile in nearbyMobiles)
            {
                if (mobile == this)
                {
                    continue;
                }
                if (!SpecialAbilities.MonsterCanDamage(this, mobile))
                {
                    continue;
                }
                if (!Map.InLOS(Location, mobile.Location))
                {
                    continue;
                }
                if (mobile.Hidden)
                {
                    continue;
                }

                mobileCount++;
            }

            nearbyMobiles.Free();
            nearbyMobiles = Map.GetMobilesInRange(Location, FireBarrageRange);

            List <Mobile> m_NearbyMobiles = new List <Mobile>();

            foreach (Mobile mobile in nearbyMobiles)
            {
                if (mobile == this)
                {
                    continue;
                }
                if (!SpecialAbilities.MonsterCanDamage(this, mobile))
                {
                    continue;
                }
                if (!Map.InLOS(Location, mobile.Location))
                {
                    continue;
                }
                if (mobile.Hidden)
                {
                    continue;
                }
                if (Combatant != null)
                {
                    if (mobileCount > 1 && mobile == Combatant)
                    {
                        continue;
                    }
                }

                m_NearbyMobiles.Add(mobile);
            }

            nearbyMobiles.Free();

            if (m_NearbyMobiles.Count == 0)
            {
                return;
            }

            Mobile mobileTarget = m_NearbyMobiles[Utility.RandomMinMax(0, m_NearbyMobiles.Count - 1)];

            Point3D targetLocation = mobileTarget.Location;
            Map     targetMap      = mobileTarget.Map;

            double spawnPercent = (double)intervalCount / (double)totalIntervals;

            double directionDelay = .25;
            double initialDelay   = 2;
            double totalDelay     = 1 + directionDelay + initialDelay;

            int maxRadius = 4;
            int radius    = 2 + (int)(Math.Ceiling((double)maxRadius * spawnPercent));

            m_NextFlameMarkAllowed = DateTime.UtcNow + NextFlameMarkDelay + TimeSpan.FromSeconds(totalDelay);
            m_NextAbilityAllowed   = DateTime.UtcNow + NextAbilityDelay + TimeSpan.FromSeconds(totalDelay);

            AbilityInProgress = true;

            Timer.DelayCall(TimeSpan.FromSeconds(totalDelay), delegate
            {
                if (SpecialAbilities.Exists(this))
                {
                    AbilityInProgress = false;
                }
            });

            SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1.0, totalDelay, true, 0, false, "", "", "-1");

            Direction = Utility.GetDirection(Location, targetLocation);

            Timer.DelayCall(TimeSpan.FromSeconds(directionDelay), delegate
            {
                if (!SpecialAbilities.Exists(this))
                {
                    return;
                }
                if (DamageIntervalInProgress)
                {
                    return;
                }

                Animate(29, 22, 1, true, false, 0);
                PlaySound(GetAngerSound());

                PublicOverheadMessage(MessageType.Regular, 0, false, "*points a mighty claw*");

                TimedStatic flamemark = new TimedStatic(6571, initialDelay);
                flamemark.Hue         = 2591;
                flamemark.Name        = "flamemark";
                flamemark.MoveToWorld(targetLocation, targetMap);

                Timer.DelayCall(TimeSpan.FromSeconds(initialDelay), delegate
                {
                    if (!SpecialAbilities.Exists(this))
                    {
                        return;
                    }

                    int damage = DamageMin;

                    int minRange = radius * -1;
                    int maxRange = radius;

                    int effectHue = 2602;

                    Effects.PlaySound(targetLocation, targetMap, 0x306);

                    for (int a = minRange; a < maxRange + 1; a++)
                    {
                        for (int b = minRange; b < maxRange + 1; b++)
                        {
                            Point3D newPoint = new Point3D(targetLocation.X + a, targetLocation.Y + b, targetLocation.Z);
                            SpellHelper.AdjustField(ref newPoint, targetMap, 12, false);

                            int distance = Utility.GetDistance(targetLocation, newPoint);

                            double effectChance = 1.0 - ((double)distance * .05);

                            if (Utility.RandomDouble() > effectChance)
                            {
                                continue;
                            }

                            Timer.DelayCall(TimeSpan.FromSeconds(distance * .10), delegate
                            {
                                if (Utility.RandomDouble() <= .1)
                                {
                                    SingleFireField singleFireField = new SingleFireField(this, 0, 2, 30, 3, 5, false, false, true, -1, true);
                                    singleFireField.Hue             = 2603;
                                    singleFireField.MoveToWorld(newPoint, targetMap);
                                }

                                Effects.PlaySound(newPoint, targetMap, Utility.RandomList(0x4F1, 0x5D8, 0x5DA, 0x580));
                                Effects.SendLocationParticles(EffectItem.Create(newPoint, targetMap, TimeSpan.FromSeconds(0.25)), 0x3709, 10, 30, effectHue, 0, 5029, 0);

                                IPooledEnumerable mobilesOnTile = targetMap.GetMobilesInRange(newPoint, 0);

                                Queue m_Queue = new Queue();

                                foreach (Mobile mobile in mobilesOnTile)
                                {
                                    if (mobile == this)
                                    {
                                        continue;
                                    }
                                    if (!SpecialAbilities.MonsterCanDamage(this, mobile))
                                    {
                                        continue;
                                    }

                                    m_Queue.Enqueue(mobile);
                                }

                                mobilesOnTile.Free();

                                while (m_Queue.Count > 0)
                                {
                                    Mobile mobile = (Mobile)m_Queue.Dequeue();

                                    if (mobile is BaseCreature)
                                    {
                                        damage *= 3;
                                    }

                                    new Blood().MoveToWorld(mobile.Location, mobile.Map);
                                    AOS.Damage(mobile, this, damage, 100, 0, 0, 0, 0);
                                }
                            });
                        }
                    }
                });
            });
        }
コード例 #22
0
ファイル: EnergyField.cs プロジェクト: zerodowned/angelisland
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
            {
                SpellHelper.Turn(Caster, p);

                SpellHelper.GetSurfaceTop(ref p);

                int dx = Caster.Location.X - p.X;
                int dy = Caster.Location.Y - p.Y;
                int rx = (dx - dy) * 44;
                int ry = (dx + dy) * 44;

                bool eastToWest;

                if (rx >= 0 && ry >= 0)
                {
                    eastToWest = false;
                }
                else if (rx >= 0)
                {
                    eastToWest = true;
                }
                else if (ry >= 0)
                {
                    eastToWest = true;
                }
                else
                {
                    eastToWest = false;
                }

                Effects.PlaySound(p, Caster.Map, 0x20B);

                TimeSpan duration;

                if (Core.AOS)
                {
                    duration = TimeSpan.FromSeconds((15 + (Caster.Skills.Magery.Fixed / 5)) / 7);
                }
                else
                {
                    duration = TimeSpan.FromSeconds(Caster.Skills[SkillName.Magery].Value * 0.28 + 2.0);                       // (28% of magery) + 2.0 seconds
                }
                int itemID = eastToWest ? 0x3946 : 0x3956;

                for (int i = -2; i <= 2; ++i)
                {
                    Point3D loc    = new Point3D(eastToWest ? p.X + i : p.X, eastToWest ? p.Y : p.Y + i, p.Z);
                    bool    canFit = SpellHelper.AdjustField(ref loc, Caster.Map, 12, false);

                    if (!canFit)
                    {
                        continue;
                    }

                    Item item = new InternalItem(loc, Caster.Map, duration, itemID, Caster);

                    int hours, minutes;

                    Server.Items.Clock.GetTime(Caster.Map, loc.X, loc.Y, out hours, out minutes);

                    if (hours >= 6 && hours < 22 && item.Light != LightType.Empty && !SpellHelper.IsFeluccaDungeon(item.Map, item.Location))                    //its daytime disable light
                    {
                        item.Light = LightType.Empty;
                    }
                    else
                    {
                        item.Light = LightType.Circle300;
                    }

                    item.ProcessDelta();

                    Effects.SendLocationParticles(EffectItem.Create(loc, Caster.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 5051);
                }
            }

            FinishSequence();
        }
コード例 #23
0
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (!CheckLineOfSight(p))
            {
                this.DoFizzle();
                Caster.SendAsciiMessage("Target is not in line of sight");
            }
            else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
            {
                SpellHelper.Turn(Caster, p);

                SpellHelper.GetSurfaceTop(ref p);

                int dx = Caster.Location.X - p.X;
                int dy = Caster.Location.Y - p.Y;
                int rx = (dx - dy) * 44;
                int ry = (dx + dy) * 44;

                bool eastToWest;

                if (rx >= 0 && ry >= 0)
                {
                    eastToWest = false;
                }
                else if (rx >= 0)
                {
                    eastToWest = true;
                }
                else if (ry >= 0)
                {
                    eastToWest = true;
                }
                else
                {
                    eastToWest = false;
                }

                Effects.PlaySound(p, Caster.Map, 0x20B);

                TimeSpan duration;

                if (Core.AOS)
                {
                    duration = TimeSpan.FromSeconds((15 + (Caster.Skills.Magery.Fixed / 5)) / 7);
                }
                else
                {
                    duration = TimeSpan.FromSeconds(Caster.Skills[SkillName.Magery].Value * 0.28 + 2.0);                       // (28% of magery) + 2.0 seconds
                }
                int itemID = eastToWest ? 0x3946 : 0x3956;

                for (int i = -2; i <= 2; ++i)
                {
                    Point3D loc    = new Point3D(eastToWest ? p.X + i : p.X, eastToWest ? p.Y : p.Y + i, p.Z);
                    bool    canFit = SpellHelper.AdjustField(ref loc, Caster.Map, 12, false);

                    if (!canFit)
                    {
                        continue;
                    }

                    Item item = new InternalItem(loc, Caster.Map, duration, itemID, Caster);
                    item.ProcessDelta();

                    Effects.SendLocationParticles(EffectItem.Create(loc, Caster.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 5051);
                }
            }

            FinishSequence();
        }
コード例 #24
0
        public void FireCannon(ShipCannon shipCannon, Mobile from, Point3D targetLocation, Map map, bool hit, bool showSmoke)
        {
            if (shipCannon == null)
            {
                return;
            }

            int cannonballItemID = 0xE73;
            int cannonballHue    = 0;
            int smokeHue         = 0;

            bool fixedDirection = false;

            double shotDelay = .04;
            int    shotSpeed = 6;

            Point3D smokeLocation = shipCannon.Location;

            switch (shipCannon.Facing)
            {
            case Direction.North: { } break;

            case Direction.East: { smokeLocation.X++; } break;

            case Direction.South: { smokeLocation.Y++; } break;

            case Direction.West: { smokeLocation.X--; } break;
            }

            if (m_Boat != null)
            {
                double gunsPercent   = (double)((float)m_Boat.GunPoints / (float)m_Boat.MaxGunPoints);
                double misfireChance = BaseBoat.CannonMaxMisfireChance * (1 - gunsPercent);

                double chance = Utility.RandomDouble();

                double distance     = Utility.GetDistanceToSqrt(shipCannon.Location, targetLocation);
                double flatDistance = Utility.GetDistance(shipCannon.Location, targetLocation);

                //Misfire
                if (chance < misfireChance)
                {
                    List <Mobile> m_MobilesOnBoat = m_Boat.GetMobilesOnBoat(true, true);

                    foreach (Mobile mobile in m_MobilesOnBoat)
                    {
                        if (m_Boat.IsOwner(mobile) || m_Boat.IsCoOwner(mobile) || m_Boat.IsFriend(mobile))
                        {
                            mobile.SendMessage("Misfire!");
                        }
                    }

                    Effects.SendLocationEffect(shipCannon.Location, map, 0x3735, 10);
                    Effects.PlaySound(shipCannon.Location, map, 0x475);

                    return;
                }

                if (m_Boat.MobileFactionType == MobileFactionType.Undead)
                {
                    cannonballItemID = Utility.RandomList(6880, 6881, 6882, 6883, 6884);
                    smokeHue         = 2630;
                }

                //Hit
                if (hit)
                {
                    m_Boat.LastCombatTime = DateTime.UtcNow;

                    Effects.PlaySound(shipCannon.Location, map, 0x664);

                    if (showSmoke)
                    {
                        Effects.SendLocationEffect(smokeLocation, map, 0x36CB, 10, smokeHue, 0);
                    }

                    SpellHelper.AdjustField(ref targetLocation, map, 12, false);

                    IEntity startLocation = new Entity(Serial.Zero, new Point3D(shipCannon.Location.X, shipCannon.Location.Y, shipCannon.Location.Z + 10), map);
                    IEntity endLocation   = new Entity(Serial.Zero, new Point3D(targetLocation.X, targetLocation.Y, targetLocation.Z + 5), map);

                    Effects.SendMovingEffect(startLocation, endLocation, cannonballItemID, shotSpeed, 0, fixedDirection, false, cannonballHue, 0);
                    double effectDelay = distance * shotDelay;

                    Timer.DelayCall(TimeSpan.FromSeconds(effectDelay), delegate
                    {
                        ResolveCannon(shipCannon, from, targetLocation, map, hit);
                    });
                }

                //Miss
                else
                {
                    int xOffset = 0;
                    int yOffset = 0;

                    double effectiveDistance = distance;

                    int distanceOffset = (int)(Math.Floor(effectiveDistance / 2));

                    if (distance >= 2)
                    {
                        xOffset = Utility.RandomMinMax(0, distanceOffset);

                        if (Utility.RandomDouble() > .5)
                        {
                            xOffset *= -1;
                        }

                        yOffset = Utility.RandomMinMax(0, distanceOffset);

                        if (Utility.RandomDouble() > .5)
                        {
                            yOffset *= -1;
                        }
                    }

                    Effects.PlaySound(shipCannon.Location, map, 0x664);
                    Effects.SendLocationEffect(smokeLocation, map, 0x36CB, 10, smokeHue, 0);

                    IEntity startLocation = new Entity(Serial.Zero, new Point3D(shipCannon.Location.X, shipCannon.Location.Y, shipCannon.Location.Z + 10), map);
                    IEntity endLocation   = new Entity(Serial.Zero, new Point3D(targetLocation.X + xOffset, targetLocation.Y + yOffset, targetLocation.Z + 5), map);

                    Effects.SendMovingEffect(startLocation, endLocation, cannonballItemID, shotSpeed, 0, fixedDirection, false, cannonballHue, 0);

                    Point3D splashLocation = new Point3D(targetLocation.X + xOffset, targetLocation.Y + yOffset, +targetLocation.Z);

                    double newDistance = from.GetDistanceToSqrt(splashLocation);
                    double effectDelay = newDistance * shotDelay;

                    Timer.DelayCall(TimeSpan.FromSeconds(effectDelay), delegate
                    {
                        ResolveCannon(shipCannon, from, splashLocation, map, hit);
                    });
                }
            }
        }
コード例 #25
0
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else
            {
                SpellHelper.Turn(Caster, p);

                int dx = Caster.Location.X - p.X;
                int dy = Caster.Location.Y - p.Y;
                int rx = (dx - dy) * 44;
                int ry = (dx + dy) * 44;

                bool eastToWest;

                if (rx >= 0 && ry >= 0)
                {
                    eastToWest = false;
                }
                else if (rx >= 0)
                {
                    eastToWest = true;
                }
                else if (ry >= 0)
                {
                    eastToWest = true;
                }
                else
                {
                    eastToWest = false;
                }

                Effects.PlaySound(p, Caster.Map, 0x1EE);

                for (int i = -1; i <= 1; ++i)
                {
                    Point3D loc    = new Point3D(eastToWest ? p.X + i : p.X, eastToWest ? p.Y : p.Y + i, p.Z);
                    bool    canFit = SpellHelper.AdjustField(ref loc, Caster.Map, 22, true);

                    //Effects.SendLocationParticles( EffectItem.Create( loc, Caster.Map, EffectItem.DefaultDuration ), 0x376A, 9, 10, 5025 );

                    if (!canFit)
                    {
                        continue;
                    }

                    Item item = new InternalItem(loc, Caster.Map, Caster);
                    if (this.Scroll != null)
                    {
                        Scroll.Consume();
                    }
                    Effects.SendLocationParticles(item, 0x376A, 9, 10, 5025);

                    //new InternalItem( loc, Caster.Map, Caster );
                }
            }

            FinishSequence();
        }
コード例 #26
0
        public void ThrowNet(Mobile from, Point3D location, FishingSpot fishingSpot)
        {
            if (fishingSpot.FishingActionsRemaining > 0)
            {
                if (from.BeginAction((typeof(SpidersilkFishingNet))))
                {
                    from.RevealingAction();

                    Timer.DelayCall(TimeSpan.FromSeconds(6), delegate
                    {
                        if (from != null)
                        {
                            from.EndAction(typeof(SpidersilkFishingNet));
                        }
                    });

                    int itemId  = ItemID;
                    int itemHue = Hue - 1;

                    int throwSound = 0x5D3;

                    Point3D targetLocation = location;
                    Map     map            = from.Map;

                    m_Charges--;

                    if (m_Charges <= 0)
                    {
                        Delete();
                    }

                    if (from.Body.IsHuman && !from.Mounted)
                    {
                        from.Animate(31, 7, 1, true, false, 0);
                    }

                    Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate
                    {
                        if (!SpecialAbilities.Exists(from))
                        {
                            return;
                        }
                        if (!from.Alive)
                        {
                            return;
                        }

                        Effects.PlaySound(from.Location, map, throwSound);

                        SpellHelper.AdjustField(ref targetLocation, map, 12, false);

                        IEntity startLocation = new Entity(Serial.Zero, new Point3D(from.Location.X, from.Location.Y, from.Location.Z + 7), map);
                        IEntity endLocation   = new Entity(Serial.Zero, new Point3D(targetLocation.X, targetLocation.Y, targetLocation.Z), map);

                        Effects.SendMovingEffect(startLocation, endLocation, itemId, 5, 0, false, false, itemHue, 0);

                        double distance         = from.GetDistanceToSqrt(targetLocation);
                        double destinationDelay = (double)distance * .08;

                        Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate
                        {
                            Effects.PlaySound(targetLocation, map, 0x364);  //0x148
                            Effects.SendLocationEffect(endLocation, map, 0x352D, 7);

                            Timer.DelayCall(TimeSpan.FromSeconds(.25), delegate
                            {
                                for (int a = 0; a < 9; a++)
                                {
                                    Blood net           = new Blood();
                                    Point3D netLocation = targetLocation;

                                    #region NetLayout
                                    switch (a)
                                    {
                                    //Row 1
                                    case 0:
                                        net.ItemID  = 3538;
                                        netLocation = new Point3D(targetLocation.X - 1, targetLocation.Y - 1, targetLocation.Z);
                                        break;

                                    case 1:
                                        net.ItemID  = 3528;
                                        netLocation = new Point3D(targetLocation.X, targetLocation.Y - 1, targetLocation.Z);
                                        break;

                                    case 2:
                                        net.ItemID  = 3537;
                                        netLocation = new Point3D(targetLocation.X + 1, targetLocation.Y - 1, targetLocation.Z);
                                        break;

                                    //Row 2
                                    case 3:
                                        net.ItemID  = 3539;
                                        netLocation = new Point3D(targetLocation.X - 1, targetLocation.Y, targetLocation.Z);
                                        break;

                                    case 4:
                                        net.ItemID  = 3530;
                                        netLocation = new Point3D(targetLocation.X, targetLocation.Y, targetLocation.Z);
                                        break;

                                    case 5:
                                        net.ItemID  = 3531;
                                        netLocation = new Point3D(targetLocation.X + 1, targetLocation.Y, targetLocation.Z);
                                        break;

                                    //Row 3
                                    case 6:
                                        net.ItemID  = 3540;
                                        netLocation = new Point3D(targetLocation.X - 1, targetLocation.Y + 1, targetLocation.Z);
                                        break;

                                    case 7:
                                        net.ItemID  = 3529;
                                        netLocation = new Point3D(targetLocation.X, targetLocation.Y + 1, targetLocation.Z);
                                        break;

                                    case 8:
                                        net.ItemID  = 3541;
                                        netLocation = new Point3D(targetLocation.X + 1, targetLocation.Y + 1, targetLocation.Z);
                                        break;
                                    }

                                    #endregion

                                    net.Hue  = Hue;
                                    net.Name = "a spidersilk net";
                                    net.MoveToWorld(netLocation, map);
                                }

                                Timer.DelayCall(TimeSpan.FromSeconds(5.5), delegate
                                {
                                    if (from == null)
                                    {
                                        return;
                                    }
                                    if (from.Deleted)
                                    {
                                        return;
                                    }
                                    if (!from.Alive)
                                    {
                                        from.SendMessage("You died before you were able to finish your fishing action.");
                                        return;
                                    }

                                    if (Utility.GetDistanceToSqrt(from.Location, targetLocation) > 10)
                                    {
                                        from.SendMessage("You have moved too far away from your fishing spot to continue fishing.");
                                        return;
                                    }

                                    else
                                    {
                                        bool fishingSpotValid = true;

                                        if (fishingSpot == null)
                                        {
                                            fishingSpotValid = false;
                                        }

                                        else if (fishingSpot.Deleted)
                                        {
                                            fishingSpotValid = false;
                                        }

                                        if (fishingSpotValid)
                                        {
                                            fishingSpot.FishingAction(from, targetLocation, map);
                                            return;
                                        }

                                        else
                                        {
                                            from.SendMessage("That fishing spot has recently been exhausted.");
                                            return;
                                        }
                                    }
                                });
                            });
                        });
                    });
                }

                else
                {
                    from.SendMessage("You must wait a moment before performing another action.");
                    return;
                }
            }

            else
            {
                from.SendMessage("The water there appears to be exhausted.");
                return;
            }
        }
コード例 #27
0
        public void StartItemAction(PlayerMobile player)
        {
            Point3D location = Location;
            Map     map      = Map;

            Point3D targetLocation = Location;
            Map     targetMap      = Map;

            targetLocation.Z += 2;

            TimedStatic shit = new TimedStatic(2496, 30);

            shit.Name = "shitcode";
            shit.Hue  = 2110;
            shit.MoveToWorld(targetLocation, map);

            List <string> m_Messages = new List <string>();

            m_Messages.Add("COMPILING...");
            m_Messages.Add("COMPILING...");
            m_Messages.Add("COMPILING...");
            m_Messages.Add("Queue m_Queue = new Queue();");
            m_Messages.Add("if (item is UOACZSpawner || item is UOACZStatic ||");
            m_Messages.Add("item is UOACZBreakableStatic || item is UOACZWayPoint ||");
            m_Messages.Add("item is UOACZMoongate || item is UOACZDestination || item is Teleporter || item is LOSBlocker ||");
            m_Messages.Add("item is UOACZConstructionTile || item is UOACZConstructionObjectEffectTargeter || item is UOACZTunnel ||");
            m_Messages.Add("item is UOACZSpawnRedirector || item is UOACZSpawnAreaBlocker");
            m_Messages.Add("m_Queue.Enqueue(item);");
            m_Messages.Add("ERROR");
            m_Messages.Add("ERROR");
            m_Messages.Add("ERROR");
            m_Messages.Add("ERROR");
            m_Messages.Add("ERROR");
            m_Messages.Add("ERROR");

            for (int a = 0; a < m_Messages.Count; a++)
            {
                string nextMessage = m_Messages[a];

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

                    if (Location != location)
                    {
                        if (shit != null)
                        {
                            if (!shit.Deleted)
                            {
                                shit.Delete();
                            }
                        }

                        return;
                    }

                    Effects.PlaySound(Location, Map, 0x428);
                    PublicOverheadMessage(Network.MessageType.Emote, Hue, false, nextMessage);

                    Point3D newLocation = new Point3D(location.X + Utility.RandomList(-1, 1), location.Y + Utility.RandomList(-1, 1), location.Z);
                    SpellHelper.AdjustField(ref newLocation, map, 12, false);

                    TimedStatic shitcodeResidue = new TimedStatic(Utility.RandomList(4651, 4652, 4653, 4654), 30);
                    shitcodeResidue.Name        = "shitcode error";
                    shitcodeResidue.Hue         = 1190;
                    shitcodeResidue.MoveToWorld(newLocation, map);
                });
            }
        }
コード例 #28
0
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
            {
                SpellHelper.Turn(Caster, p);

                SpellHelper.GetSurfaceTop(ref p);

                int dx = Caster.Location.X - p.X;
                int dy = Caster.Location.Y - p.Y;
                int rx = (dx - dy) * 44;
                int ry = (dx + dy) * 44;

                bool eastToWest;

                if (rx >= 0 && ry >= 0)
                {
                    eastToWest = false;
                }
                else if (rx >= 0)
                {
                    eastToWest = true;
                }
                else if (ry >= 0)
                {
                    eastToWest = true;
                }
                else
                {
                    eastToWest = false;
                }

                Effects.PlaySound(p, Caster.Map, 0x651);
                Server.Misc.Research.ConsumeScroll(Caster, true, spellIndex, false);

                int itemID = eastToWest ? 0x376A : 0x376A;

                TimeSpan duration = TimeSpan.FromSeconds(3.0 + ((DamagingSkill(Caster) / 2) / 3.0));

                for (int i = -2; i <= 2; ++i)
                {
                    Point3D loc    = new Point3D(eastToWest ? p.X + i : p.X, eastToWest ? p.Y : p.Y + i, p.Z);
                    bool    canFit = SpellHelper.AdjustField(ref loc, Caster.Map, 12, false);

                    if (!canFit)
                    {
                        continue;
                    }

                    Item item = new InternalItem(Caster, itemID, loc, Caster.Map, duration);
                    item.ProcessDelta();

                    Effects.SendLocationParticles(EffectItem.Create(loc, Caster.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0), 0, 5048, 0);
                }
            }

            FinishSequence();
        }
コード例 #29
0
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237);                 // Target can not be seen.
            }
            else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
            {
                SpellHelper.Turn(Caster, p);

                SpellHelper.GetSurfaceTop(ref p);

                int dx = Caster.Location.X - p.X;
                int dy = Caster.Location.Y - p.Y;
                int rx = (dx - dy) * 44;
                int ry = (dx + dy) * 44;

                bool eastToWest;

                if (rx >= 0 && ry >= 0)
                {
                    eastToWest = false;
                }
                else if (rx >= 0)
                {
                    eastToWest = true;
                }
                else if (ry >= 0)
                {
                    eastToWest = true;
                }
                else
                {
                    eastToWest = false;
                }

                Effects.PlaySound(p, Caster.Map, 0x20B);

                int itemID = eastToWest ? 0x3967 : 0x3979;

                TimeSpan duration = TimeSpan.FromSeconds(3.0 + (Caster.Skills[SkillName.Magery].Value / 3.0));

                for (int i = -2; i <= 2; ++i)
                {
                    var  loc    = new Point3D(eastToWest ? p.X + i : p.X, eastToWest ? p.Y : p.Y + i, p.Z);
                    bool canFit = SpellHelper.AdjustField(ref loc, Caster.Map, 12, false);

                    if (!canFit)
                    {
                        continue;
                    }

                    Item item = new InternalItem(Caster, itemID, loc, Caster.Map, duration);
                    item.ProcessDelta();

                    Effects.SendLocationParticles(EffectItem.Create(loc, Caster.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 5048);
                }
            }

            FinishSequence();
        }
コード例 #30
0
ファイル: OrbFromTheDeep.cs プロジェクト: Pumpk1ns/outlands
        public void WaveBlast(Mobile from)
        {
            if (this == null)
            {
                return;
            }
            if (Deleted)
            {
                return;
            }
            if (from == null)
            {
                return;
            }

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

            int radius = 10;

            int minRange = -1 * radius;
            int maxRange = radius + 1;

            for (int a = minRange; a < maxRange; a++)
            {
                for (int b = minRange; b < maxRange; b++)
                {
                    Point3D location = Location;
                    Map     map      = Map;

                    Point3D newLocation = new Point3D(location.X + a, location.Y + b, location.Z);
                    SpellHelper.AdjustField(ref newLocation, map, 12, false);

                    if (!map.InLOS(location, newLocation))
                    {
                        continue;
                    }

                    double distance      = Utility.GetDistanceToSqrt(location, newLocation);
                    double distanceDelay = (distance * .125);

                    Timer.DelayCall(TimeSpan.FromSeconds(distanceDelay), delegate
                    {
                        if (Utility.RandomDouble() <= .66)
                        {
                            Effects.SendLocationParticles(EffectItem.Create(newLocation, map, TimeSpan.FromSeconds(0.25)), 0x3709, 10, 30, 2121, 0, 5029, 0);
                        }
                    });

                    Timer.DelayCall(TimeSpan.FromSeconds(distanceDelay + 1.25), delegate
                    {
                        if (Utility.RandomDouble() <= .25)
                        {
                            return;
                        }

                        TimedStatic water = new TimedStatic(Utility.RandomList(4650, 4651, 4653, 4654, 4655), 10);
                        water.Name        = "water";
                        water.Hue         = 2120;

                        SpellHelper.AdjustField(ref newLocation, map, 12, false);

                        Effects.PlaySound(newLocation, map, 0x027);
                        water.MoveToWorld(newLocation, map);
                    });
                }
            }

            m_NextUseAllowed = DateTime.UtcNow + UsageCooldown;
        }