Exemplo n.º 1
0
        public static void DrunkardVomit(Mobile from)
        {
            if (from == null)
            {
                return;
            }

            from.Animate(33, 5, 1, true, false, 0); //Touch Stomach
            from.PublicOverheadMessage(MessageType.Regular, 0, false, "*looks quite ill*");

            if (from.Female)
            {
                from.PlaySound(Utility.RandomList(0x30E, 0x310, 0x311, 0x312, 0x32D));
            }
            else
            {
                from.PlaySound(Utility.RandomList(0x41D, 0x420, 0x421, 0x43F));
            }

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

                from.PlaySound(0x5D8);

                Point3D newPoint = SpecialAbilities.GetPointByDirection(from.Location, from.Direction);
                SpellHelper.AdjustField(ref newPoint, from.Map, 12, false);

                TimedStatic vomit = new TimedStatic(Utility.RandomList(0x122A, 0x122B, 0x122C, 0x122D, 0x122E, 0x122F), 10);
                vomit.Name        = "vomit";
                vomit.Hue         = Utility.RandomList(2207, 2208, 2209, 2210, 2211, 2212);
                vomit.MoveToWorld(newPoint, from.Map);
            });
        }
Exemplo n.º 2
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;
            }
        }
Exemplo n.º 3
0
        public override void OnDoubleClick(Mobile from)
        {
            PlayerMobile player = from as PlayerMobile;

            if (player == null)
            {
                return;
            }

            UOACZPersistance.CheckAndCreateUOACZAccountEntry(player);

            if (player.IsUOACZHuman && DamageState != DamageStateType.Broken)
            {
                if (Utility.GetDistance(player.Location, Location) > InteractionRange)
                {
                    player.SendMessage("You are too far away to use that.");
                    return;
                }

                if (!from.CanBeginAction(typeof(UOACZBreakableDoor)))
                {
                    from.SendMessage("You must wait a few moments before you may enter or exit again.");
                    return;
                }

                if (player.m_UOACZAccountEntry.HumanProfile.HonorPoints <= UOACZSystem.HonorAggressionThreshold)
                {
                    from.SendMessage("You are an outcast and not allowed to use this.");
                    return;
                }

                Direction directionToDoor = Utility.GetDirection(Location, player.Location);
                Direction exitDirection   = Server.Direction.Down;

                if (DoorFacing == DoorFacingType.EastWest)
                {
                    switch (directionToDoor)
                    {
                    case Direction.Up: exitDirection = Direction.South; break;

                    case Direction.North: exitDirection = Direction.South; break;

                    case Direction.Right: exitDirection = Direction.South; break;

                    case Direction.East: exitDirection = Direction.South; break;

                    case Direction.Left: exitDirection = Direction.North; break;

                    case Direction.South: exitDirection = Direction.North; break;

                    case Direction.Down: exitDirection = Direction.North; break;

                    case Direction.West: exitDirection = Direction.North; break;
                    }
                }

                else
                {
                    switch (directionToDoor)
                    {
                    case Direction.Left: exitDirection = Direction.East; break;

                    case Direction.West: exitDirection = Direction.East; break;

                    case Direction.Up: exitDirection = Direction.East; break;

                    case Direction.North: exitDirection = Direction.East; break;

                    case Direction.Right: exitDirection = Direction.West; break;

                    case Direction.East: exitDirection = Direction.West; break;

                    case Direction.Down: exitDirection = Direction.West; break;

                    case Direction.South: exitDirection = Direction.West; break;
                    }
                }

                Point3D newLocation = SpecialAbilities.GetPointByDirection(Location, exitDirection);

                player.Location = newLocation;
                player.PlaySound(InteractSound);
                player.RevealingAction();

                from.BeginAction(typeof(UOACZBreakableDoor));

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

            else
            {
                base.OnDoubleClick(from);
            }
        }
Exemplo n.º 4
0
        public void Target(IPoint3D p)
        {
            IPoint3D orig = p;
            Map      map  = Caster.Map;

            SpellHelper.GetSurfaceTop(ref p);
            Point3D pP = new Point3D(p);

            WarpBlockerTotem recallBlocker = WarpBlockerTotem.RecallBlockerTriggered(Caster, WarpBlockerTotem.MovementMode.TeleportIn, pP, Caster.Map);

            if (recallBlocker != null)
            {
                if (recallBlocker.PreventTeleportInResponse != "")
                {
                    Caster.SendMessage(recallBlocker.PreventTeleportInResponse);
                }
                else
                {
                    Caster.SendMessage(WarpBlockerTotem.DefaultTeleportInResponse);
                }
            }

            else if (Server.Misc.WeightOverloading.IsOverloaded(Caster))
            {
                Caster.SendLocalizedMessage(502359, "", 0x22);                   // Thou art too encumbered to move.
            }

            else if (!SpellHelper.CheckTravel(Caster, TravelCheckType.TeleportFrom))
            {
                Caster.SendLocalizedMessage(501942); // That location is blocked.
            }

            else if (!SpellHelper.CheckTravel(Caster, map, pP, TravelCheckType.TeleportTo))
            {
                Caster.SendLocalizedMessage(501942); // That location is blocked.
            }

            else if (map == null || !map.CanSpawnMobile(p.X, p.Y, p.Z))
            {
                Caster.SendLocalizedMessage(501942);                   // That location is blocked.
            }

            else if (SpellHelper.CheckMulti(pP, map))
            {
                Caster.SendLocalizedMessage(501942);                   // That location is blocked.
            }

            else
            {
                if (CheckSequence())
                {
                    SpellHelper.Turn(Caster, orig);

                    Mobile m = Caster;

                    Point3D from = m.Location;
                    Point3D to   = pP;

                    m.Location = to;
                    m.ProcessDelta();

                    int spellHue = Enhancements.GetMobileSpellHue(Caster, Enhancements.SpellType.Teleport);

                    if (m.Player)
                    {
                        Effects.SendLocationParticles(EffectItem.Create(from, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, spellHue, 0, 2023, 0);

                        //Player Enhancement Customization: Blink
                        bool blink = false; //PlayerEnhancementPersistance.IsCustomizationEntryActive(Caster, CustomizationType.Blink);

                        if (blink)
                        {
                            int distance = Utility.GetDistance(from, to);

                            Point3D effectStep = from;

                            for (int a = 0; a < distance + 1; a++)
                            {
                                Timer.DelayCall(TimeSpan.FromSeconds(a * .05), delegate
                                {
                                    if (m == null)
                                    {
                                        return;
                                    }

                                    Direction direction = Utility.GetDirection(effectStep, to);
                                    effectStep          = SpecialAbilities.GetPointByDirection(effectStep, direction);

                                    Effects.SendLocationParticles(EffectItem.Create(effectStep, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, spellHue, 0, 2023, 0);
                                    m.PlaySound(0x5C6);
                                });
                            }
                        }

                        else
                        {
                            Effects.SendLocationParticles(EffectItem.Create(to, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, spellHue, 0, 2023, 0);
                            m.PlaySound(0x1FE);
                        }
                    }

                    else
                    {
                        m.FixedParticles(0x376A, 9, 32, 0x13AF, spellHue, 0, EffectLayer.Waist);
                        m.PlaySound(0x1FE);
                    }

                    IPooledEnumerable eable = m.GetItemsInRange(0);

                    foreach (Item item in eable)
                    {
                        if (item is Server.Spells.Sixth.ParalyzeFieldSpell.ParalyzeFieldItem || item is Server.Spells.Fifth.PoisonFieldSpell.PoisonFieldItem || item is Server.Spells.Fourth.FireFieldSpell.FireFieldItem)
                        {
                            item.OnMoveOver(m);
                        }
                    }

                    eable.Free();

                    m.BeginAction(typeof(TeleportSpell));
                    Timer.DelayCall(TimeSpan.FromSeconds(6), delegate { m.EndAction(typeof(TeleportSpell)); });
                }
            }

            FinishSequence();
        }
Exemplo n.º 5
0
        public void Charge()
        {
            if (!SpecialAbilities.Exists(this))
            {
                return;
            }

            m_NextChargeAllowed = DateTime.UtcNow + NextChargeDelay;

            int range = 18;

            Dictionary <Mobile, int> DictPossibleNewCombatants = new Dictionary <Mobile, int>();

            IPooledEnumerable m_NearbyMobiles = Map.GetMobilesInRange(Location, range);

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

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

                if (mobile == Combatant && distance <= 4)
                {
                    continue;
                }

                DictPossibleNewCombatants.Add(mobile, distance);
            }

            m_NearbyMobiles.Free();

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

            int TotalValues = 0;

            foreach (KeyValuePair <Mobile, int> pair in DictPossibleNewCombatants)
            {
                TotalValues += pair.Value;
            }

            double ItemCheck = Utility.RandomDouble();

            double CumulativeAmount = 0.0;
            double AdditionalAmount = 0.0;

            bool foundNewCombatant = false;

            //Determine Combatant
            foreach (KeyValuePair <Mobile, int> pair in DictPossibleNewCombatants)
            {
                AdditionalAmount = (double)pair.Value / (double)TotalValues;

                if (ItemCheck >= CumulativeAmount && ItemCheck < (CumulativeAmount + AdditionalAmount))
                {
                    Combatant         = pair.Key;
                    foundNewCombatant = true;

                    break;
                }

                CumulativeAmount += AdditionalAmount;
            }

            if (Combatant != null && foundNewCombatant)
            {
                double directionDelay = .25;
                double initialDelay   = .5;
                double totalDelay     = directionDelay + initialDelay;

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

                Point3D location = Location;
                Map     map      = Map;

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

                Direction = Utility.GetDirection(Location, targetLocation);

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

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

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

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

                        bool validCombatant = true;

                        if (Combatant == null)
                        {
                            validCombatant = false;
                        }

                        else
                        {
                            if (!SpecialAbilities.MonsterCanDamage(this, Combatant))
                            {
                                validCombatant = false;
                            }
                            if (Combatant.Hidden)
                            {
                                validCombatant = false;
                            }
                            if (!Map.InLOS(Location, Combatant.Location))
                            {
                                validCombatant = false;
                            }
                            if (Utility.GetDistance(Location, Combatant.Location) > range + 10)
                            {
                                validCombatant = false;
                            }
                        }

                        if (validCombatant)
                        {
                            targetLocation = Combatant.Location;
                        }

                        Point3D effectStep = Location;

                        int distance     = Utility.GetDistance(effectStep, targetLocation);
                        double stepDelay = .04;

                        Queue m_Queue;

                        IPooledEnumerable nearbyMobiles;

                        for (int a = 0; a < distance; a++)
                        {
                            if (!SpecialAbilities.Exists(this))
                            {
                                return;
                            }

                            Direction direction = Utility.GetDirection(effectStep, targetLocation);
                            effectStep          = SpecialAbilities.GetPointByDirection(effectStep, direction);

                            Point3D effectLocation = effectStep;
                            int index = a;

                            Timer.DelayCall(TimeSpan.FromSeconds(index * stepDelay), delegate
                            {
                                Effects.SendLocationParticles(EffectItem.Create(effectLocation, map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2117, 0, 2023, 0);
                                Effects.PlaySound(effectLocation, map, 0x5C6);

                                Point3D adjustedLocation = effectLocation;
                                adjustedLocation.Z++;

                                new Blood().MoveToWorld(adjustedLocation, map);
                            });

                            m_Queue = new Queue();

                            nearbyMobiles = map.GetMobilesInRange(effectStep, 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();

                                double damage = (double)DamageMin;

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

                                int finalDamage = (int)(Math.Ceiling(damage));

                                DoHarmful(mobile);

                                mobile.PlaySound(mobile.GetHurtSound());

                                new Blood().MoveToWorld(mobile.Location, mobile.Map);
                                AOS.Damage(mobile, this, finalDamage, 100, 0, 0, 0, 0);
                            }
                        }

                        Location = targetLocation;

                        m_Queue       = new Queue();
                        nearbyMobiles = map.GetMobilesInRange(targetLocation, 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();

                            double damage = (double)DamageMin;

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

                            int finalDamage        = (int)(Math.Ceiling(damage));
                            double knockbackDamage = 25;

                            DoHarmful(mobile);

                            mobile.PlaySound(mobile.GetHurtSound());

                            SpecialAbilities.KnockbackSpecialAbility(1.0, location, this, mobile, knockbackDamage, 2, -1, "", "You are knocked back by their charge!");

                            new Blood().MoveToWorld(mobile.Location, mobile.Map);
                            AOS.Damage(mobile, this, finalDamage, 100, 0, 0, 0, 0);
                        }
                    });
                });
            }
        }