示例#1
0
        public override bool OnMoveOver(Mobile mobile)
        {
            if (mobile == null)
            {
                return(true);
            }
            if (mobile.Deleted || !mobile.Alive)
            {
                return(true);
            }

            if (m_TrapSprung)
            {
                return(true);
            }

            if (m_Owner == null)
            {
                return(true);
            }

            if (m_Owner == mobile)
            {
                return(true);
            }

            if (SpecialAbilities.MonsterCanDamage(m_Owner, mobile))
            {
                m_TrapSprung = true;

                mobile.PublicOverheadMessage(Network.MessageType.Regular, 0, false, "*springs a trap*");
                Effects.PlaySound(Location, Map, 0x3E5);

                TriggerTrap();
            }

            return(true);
        }
示例#2
0
        public void WingBuffet()
        {
            if (!SpecialAbilities.Exists(this))
            {
                return;
            }

            int    wingFlaps    = 3;
            double flapDuration = 0.5;

            double minRange = 10;
            double maxRange = 30;

            double spawnPercent = (double)intervalCount / (double)totalIntervals;
            int    range        = (int)(minRange + ((maxRange - minRange) * spawnPercent));

            double totalDelay = 3;

            Combatant = null;

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

            AbilityInProgress        = true;
            DamageIntervalInProgress = true;
            m_NextAbilityAllowed     = DateTime.UtcNow + NextAbilityDelay + TimeSpan.FromSeconds(.5);

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

                AbilityInProgress        = false;
                DamageIntervalInProgress = false;
                m_NextAbilityAllowed     = DateTime.UtcNow + NextAbilityDelay;
            });

            PublicOverheadMessage(MessageType.Regular, 0, false, "*furiously beats wings*");

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

                    Effects.PlaySound(Location, Map, GetAngerSound());

                    Animate(19, 10, 2, true, false, 0);
                });
            }

            Timer.DelayCall(TimeSpan.FromSeconds((double)wingFlaps * flapDuration), delegate
            {
                if (!SpecialAbilities.Exists(this))
                {
                    return;
                }

                Point3D location = Location;
                Map map          = Map;

                Queue m_Queue = new Queue();

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

                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 distance = range - Utility.GetDistance(location, mobile.Location);

                    if (distance < 1)
                    {
                        distance = 1;
                    }

                    double damage = (double)(Utility.RandomMinMax(DamageMin, DamageMax)) * 2;

                    SpecialAbilities.KnockbackSpecialAbility(1.0, location, this, mobile, damage, distance, -1, "", "The beast buffets you with its wings!");
                }
            });
        }
示例#3
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);
                                }
                            });
                        }
                    }
                });
            });
        }
示例#4
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);
                                }
                            });
                        });
                    }
                });
            });
        }
示例#5
0
        public void Knockback()
        {
            if (!SpecialAbilities.Exists(Combatant))
            {
                return;
            }
            if (!SpecialAbilities.MonsterCanDamage(this, Combatant))
            {
                return;
            }

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

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

            double initialDelay = 1;
            double totalDelay   = 1 + initialDelay;

            Animate(14, 12, 1, true, false, 0);
            PlaySound(GetAngerSound());

            PublicOverheadMessage(MessageType.Regular, 0, false, "*lashes out violently*");

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

            m_NextKnockbackAllowed = DateTime.UtcNow + NextKnockbackDelay + 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;
                    Combatant         = null;
                }
            });

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

                double damage = (double)(Utility.RandomMinMax(DamageMin, DamageMax)) * 2;

                Queue m_Queue = new Queue();

                IPooledEnumerable nearbyMobiles = Map.GetMobilesInRange(targetLocation, 1);

                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();

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

                    SpecialAbilities.KnockbackSpecialAbility(1.0, Location, this, mobile, damage, 15, -1, "", "The beast flings you aside!");
                }
            });
        }
示例#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) && CheckSequence())
            {
                bool    enhancedSpellcast = false;
                Boolean chargedSpellcast  = false;

                int radius = 2;

                if (Caster is BaseCreature)
                {
                    radius += (int)(Math.Floor((Caster.Skills[SkillName.Magery].Value - 75) / 25));
                }

                SpellHelper.Turn(Caster, p);

                if (p is Item)
                {
                    p = ((Item)p).GetWorldLocation();
                }

                Map map = Caster.Map;

                IPooledEnumerable nearbyMobiles = map.GetMobilesInRange(new Point3D(p), radius);

                Queue m_Queue = new Queue();

                int targetCount = 0;

                bool playerVsCreatureOccurred = false;

                if (targetCount > 0)
                {
                    Effects.PlaySound(p, Caster.Map, 0x29);
                }

                foreach (Mobile mobile in nearbyMobiles)
                {
                    if (mobile == Caster)
                    {
                        continue;
                    }

                    if (Caster is BaseCreature)
                    {
                        if (!SpecialAbilities.MonsterCanDamage(Caster, mobile))
                        {
                            continue;
                        }
                    }

                    if (!Caster.CanBeHarmful(mobile, false))
                    {
                        continue;
                    }

                    if (Caster is PlayerMobile && mobile is BaseCreature)
                    {
                        playerVsCreatureOccurred = true;
                    }

                    targetCount++;
                    m_Queue.Enqueue(mobile);
                }

                nearbyMobiles.Free();

                if (playerVsCreatureOccurred)
                {
                    enhancedSpellcast = SpellHelper.IsEnhancedSpell(Caster, null, EnhancedSpellbookType.Energy, false, true);
                    chargedSpellcast  = SpellHelper.IsChargedSpell(Caster, null, false, Scroll != null);
                }

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

                    double damage      = (double)Utility.RandomMinMax(20, 25);
                    double damageBonus = 0;

                    CheckMagicResist(mobile);

                    Boolean isTamedTarget = SpellHelper.IsTamedTarget(Caster, mobile);

                    if (enhancedSpellcast && mobile is BaseCreature)
                    {
                        if (isTamedTarget)
                        {
                            damageBonus += SpellHelper.EnhancedSpellTamedCreatureBonus;
                        }

                        else
                        {
                            damageBonus += SpellHelper.EnhancedSpellBonus;
                        }
                    }

                    if (chargedSpellcast && mobile is BaseCreature)
                    {
                        if (isTamedTarget)
                        {
                            damageBonus += SpellHelper.ChargedSpellTamedCreatureBonus;
                        }

                        else
                        {
                            damageBonus += SpellHelper.ChargedSpellBonus;
                        }

                        mobile.BoltEffect(0);
                    }

                    else
                    {
                        mobile.BoltEffect(0);
                    }

                    BaseCreature bc_Target = mobile as BaseCreature;
                    PlayerMobile pm_Target = mobile as PlayerMobile;

                    if (bc_Target != null)
                    {
                        if (bc_Target.BoatOccupied != null)
                        {
                            damage *= BaseBoat.shipBasedAoESpellDamageToCreatureScalar;
                        }
                    }

                    if (pm_Target != null)
                    {
                        if (pm_Target.BoatOccupied != null)
                        {
                            damage *= BaseBoat.shipBasedAoESpellDamageToPlayerScalar;
                        }
                    }

                    damage *= GetDamageScalar(mobile, damageBonus);

                    SpellHelper.Damage(this, Caster, mobile, damage);
                }
            }

            FinishSequence();
        }
示例#7
0
        public void HeartyWingBuffet()
        {
            double spawnPercent = (double)intervalCount / (double)totalIntervals;

            int    wings      = 50 + (int)(Math.Ceiling(150 * spawnPercent));
            int    loops      = (int)(Math.Ceiling((double)wings / 10));
            double totalDelay = loops + 2.5;

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

            m_NextHeartyWingBuffetAllowed = DateTime.UtcNow + NextHeartyWingBuffetDelay;
            m_NextAbilityAllowed          = DateTime.UtcNow + NextAbilityDelay + TimeSpan.FromSeconds(totalDelay);

            AbilityInProgress = true;

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

                AbilityInProgress = false;
            });

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

            PublicOverheadMessage(MessageType.Regular, 0, false, "*prepares hearty wing buffet*");

            Point3D location = Location;
            Map     map      = Map;

            PlaySound(GetAngerSound());
            Animate(16, 8, 1, true, false, 0);

            int radius = 10;

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

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

                        Animate(16, 8, 1, true, false, 0);

                        PlaySound(GetAngerSound());
                        Effects.PlaySound(location, map, 0x5CF);
                    });
                }

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

                        Point3D wingLocation = new Point3D(location.X + Utility.RandomMinMax(radius * -1, radius), location.Y + Utility.RandomMinMax(radius * -1, radius), location.Z);

                        IEntity startLocation = new Entity(Serial.Zero, new Point3D(wingLocation.X - 1, wingLocation.Y - 1, wingLocation.Z + 100), map);
                        IEntity endLocation   = new Entity(Serial.Zero, new Point3D(wingLocation.X, wingLocation.Y, wingLocation.Z + 5), map);

                        int particleSpeed = 8 + (int)(Math.Round(8 * (double)spawnPercent));

                        int itemId = Utility.RandomList(5641, 2489, 5639);

                        Effects.SendMovingParticles(startLocation, endLocation, itemId, particleSpeed, 0, false, false, 0, 0, 9501, 0, 0, 0x100);

                        double impactDelay = .75 - (.375 * spawnPercent);

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

                            Effects.PlaySound(endLocation, map, Utility.RandomList(0x357, 0x359));
                            Effects.SendLocationParticles(endLocation, 0x3709, 10, 20, 0, 0, 5029, 0);

                            Item item = null;

                            switch (itemId)
                            {
                                //case 5641: item = new LambLeg(); item.Name = "chicken drumstick"; break;
                                //case 2489: item = new CookedBird();  break;
                                //case 5639: item = new ChickenLeg(); break;
                            }

                            Point3D foodLocation = new Point3D(wingLocation.X, wingLocation.Y, wingLocation.Z);

                            item.MoveToWorld(foodLocation, map);

                            double firefieldChance = .15 + (.15 * spawnPercent);

                            if (Utility.RandomDouble() <= firefieldChance)
                            {
                                Timer.DelayCall(TimeSpan.FromSeconds(.25), delegate
                                {
                                    SingleFireField singleFireField = new SingleFireField(null, 0, 1, 30, 3, 5, false, false, true, -1, true);
                                    singleFireField.MoveToWorld(foodLocation, map);
                                });
                            }

                            IPooledEnumerable mobilesOnTile = map.GetMobilesInRange(wingLocation, 1);

                            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();

                                double damage = DamageMax;

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

                                new Blood().MoveToWorld(mobile.Location, mobile.Map);
                                AOS.Damage(mobile, (int)damage, 0, 100, 0, 0, 0);
                            }
                        });
                    });
                }
            });
        }
示例#8
0
            protected override void OnTick()
            {
                if (m_ForebiddenLoreStatue == null)
                {
                    Stop();
                    return;
                }

                if (m_ForebiddenLoreStatue.Deleted)
                {
                    Stop();
                    return;
                }

                if (m_ForebiddenLoreStatue.EffectCount >= m_ForebiddenLoreStatue.EffectMaxCount)
                {
                    m_ForebiddenLoreStatue.Delete();
                    Stop();

                    return;
                }

                m_ForebiddenLoreStatue.EffectCount++;

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

                int effectHue = m_ForebiddenLoreStatue.Hue - 1;

                int minDamage = m_ForebiddenLoreStatue.MinDamage;
                int maxDamage = m_ForebiddenLoreStatue.MaxDamage;

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

                IPooledEnumerable mobileInRange = m_ForebiddenLoreStatue.Map.GetMobilesInRange(location, m_ForebiddenLoreStatue.Range);

                foreach (Mobile mobile in mobileInRange)
                {
                    if (!SpecialAbilities.MonsterCanDamage(null, mobile))
                    {
                        continue;
                    }
                }

                mobileInRange.Free();

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

                Mobile  target         = m_ValidMobiles[Utility.RandomMinMax(0, m_ValidMobiles.Count - 1)];
                Point3D targetLocation = target.Location;

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

                int particleSpeed = 5;

                Effects.PlaySound(location, map, 0x227);
                Effects.SendMovingParticles(startLocation, endLocation, 0x36D4, particleSpeed, 0, false, false, effectHue, 0, 9501, 0, 0, 0x100);

                Point3D newLocation = new Point3D(location.X, location.Y, location.Z + 14);

                TimedStatic timedStatic = new TimedStatic(0x3779, .5);

                timedStatic.Hue  = effectHue;
                timedStatic.Name = "dissipated energy";
                timedStatic.MoveToWorld(newLocation, map);

                double distance         = Utility.GetDistanceToSqrt(location, targetLocation);
                double destinationDelay = (double)distance * .08;

                Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate
                {
                    if (m_ForebiddenLoreStatue.Deleted)
                    {
                        return;
                    }
                    if (target == null)
                    {
                        return;
                    }
                    if (target.Deleted || !target.Alive)
                    {
                        return;
                    }
                    if (Utility.GetDistanceToSqrt(m_ForebiddenLoreStatue.Location, targetLocation) >= 30)
                    {
                        return;
                    }

                    int damage = Utility.RandomMinMax(minDamage, maxDamage);

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

                    Effects.PlaySound(location, map, 0x208);

                    target.FixedParticles(0x36BD, 20, 20, 5044, effectHue, 0, EffectLayer.Head);
                    //Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, TimeSpan.FromSeconds(0.5)), 0x3996, 10, 20, effectHue, 0, 5029, 0);

                    new Blood().MoveToWorld(targetLocation, map);
                    AOS.Damage(target, damage, 0, 100, 0, 0, 0);
                });
            }
示例#9
0
        protected override bool OnMove(Direction d)
        {
            if (m_ChargeInProgress)
            {
                if (Utility.RandomDouble() <= .15)
                {
                    Effects.PlaySound(Location, Map, 0x2F4);

                    int effectHue = 0;

                    DeDOSElectricField electricField = new DeDOSElectricField(this, effectHue, 1, 20, 3, 5, false, false, true, -1, true);
                    electricField.MoveToWorld(Location, Map);
                }

                m_NextChargeAllowed = DateTime.UtcNow + NextChargeDelay;

                Queue m_Queue = new Queue();

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

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

                    m_Queue.Enqueue(mobile);
                }

                nearbyMobiles.Free();

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

                    m_Trampled.Add(mobile);

                    Effects.PlaySound(Location, Map, Utility.RandomList(0x3BB, 0x3BA, 0x3B9));
                    Effects.PlaySound(mobile.Location, mobile.Map, mobile.GetHurtSound());

                    double damage = DamageMin;

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

                    new Blood().MoveToWorld(mobile.Location, mobile.Map);

                    AOS.Damage(mobile, (int)damage, 100, 0, 0, 0, 0);

                    if (mobile is PlayerMobile)
                    {
                        mobile.Animate(21, 6, 1, true, false, 0);
                    }

                    else if (mobile is BaseCreature)
                    {
                        BaseCreature bc_Creature = mobile as BaseCreature;

                        if (bc_Creature.IsHighSeasBodyType)
                        {
                            bc_Creature.Animate(2, 14, 1, true, false, 0);
                        }

                        else if (bc_Creature.Body != null)
                        {
                            if (bc_Creature.Body.IsHuman)
                            {
                                bc_Creature.Animate(21, 6, 1, true, false, 0);
                            }

                            else
                            {
                                bc_Creature.Animate(2, 4, 1, true, false, 0);
                            }
                        }
                    }

                    SpecialAbilities.HinderSpecialAbility(1.0, this, mobile, 1.0, 1, false, -1, false, "", "You have been trampled and can't move!", "-1");
                }

                CheckChargeResolved();
            }

            Effects.PlaySound(Location, Map, Utility.RandomList(0x12E, 0x12D));

            return(base.OnMove(d));
        }
示例#10
0
        public void StartCharge()
        {
            if (!SpecialAbilities.Exists(this))
            {
                return;
            }

            int chargeRange       = 20;
            int minChangeDistance = 5;

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

            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;
                }
                if (Utility.GetDistance(Location, mobile.Location) < minChangeDistance)
                {
                    continue;
                }

                mobileCount++;
            }

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

            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 (Utility.GetDistance(Location, mobile.Location) < minChangeDistance)
                {
                    continue;
                }
                if (Combatant != null)
                {
                    if (mobileCount > 1 && mobile == Combatant)
                    {
                        continue;
                    }
                }

                m_NearbyMobiles.Add(mobile);
            }

            nearbyMobiles.Free();

            if (m_NearbyMobiles.Count == 0)
            {
                m_NextChargeAllowed = DateTime.UtcNow + TimeSpan.FromSeconds(5);
                return;
            }

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

            Combatant = mobileTarget;

            LastSwingTime = LastSwingTime + TimeSpan.FromSeconds(NextChargeDelay.TotalSeconds);

            m_NextChargeAllowed = DateTime.UtcNow + NextChargeDelay;
            m_ChargeTimeout     = DateTime.UtcNow + MaxChargeDuration;

            m_ChargeInProgress = true;

            DictCombatTargetingWeight[CombatTargetingWeight.CurrentCombatant] = 500;

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

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

            m_Trampled.Clear();

            ActiveSpeed  = .25;
            PassiveSpeed = .25;
            CurrentSpeed = .25;

            Paralyzed = false;
            CantWalk  = false;
            Frozen    = false;
        }
示例#11
0
        public void Detonate()
        {
            Point3D location = Location;
            Map     map      = Map;

            if (!SpecialAbilities.Exists(m_Owner))
            {
                return;
            }

            Mobile owner = m_Owner;

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

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

            int minDamage = m_MinDamage;
            int maxDamage = m_MaxDamage;

            for (int a = minRange; a < maxRange + 1; a++)
            {
                for (int b = minRange; b < maxRange + 1; b++)
                {
                    Point3D newPoint = new Point3D(location.X + a, location.Y + b, location.Z);
                    newPoint.Z = map.GetSurfaceZ(newPoint, 30);

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

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

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

                    Timer.DelayCall(TimeSpan.FromSeconds(distance * .10), delegate
                    {
                        int impactItemId = 0x3709;
                        int impactHue    = 2074;

                        if (Utility.RandomDouble() <= .75)
                        {
                            LavaField lavaField = new LavaField(null, 0, 1, m_LavaDuration, m_LavaMinDamage, m_LavaMaxDamage, false, false, true, -1, true);
                            lavaField.MoveToWorld(newPoint, map);
                        }

                        else
                        {
                            Effects.PlaySound(newPoint, map, 0x5CF);
                            Effects.SendLocationParticles(EffectItem.Create(newPoint, map, EffectItem.DefaultDuration), impactItemId, 20, 20, impactHue, 0, 0, 0);

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

                            if (!SpecialAbilities.Exists(owner))
                            {
                                return;
                            }

                            Queue m_Queue = new Queue();

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

                                m_Queue.Enqueue(mobile);
                            }

                            mobilesOnTile.Free();

                            while (m_Queue.Count > 0)
                            {
                                double damage = Utility.RandomMinMax(minDamage, maxDamage);

                                Mobile mobile = (Mobile)m_Queue.Dequeue();

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

                                int finalDamage = (int)(Math.Round((double)damage));

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

            Delete();
        }
示例#12
0
        public override void OnThink()
        {
            base.OnThink();

            if (Utility.RandomDouble() < 0.01 && !Hidden && DateTime.UtcNow > m_NextSpeechAllowed)
            {
                if (Combatant == null)
                {
                    Say(idleSpeech[Utility.Random(idleSpeech.Length - 1)]);
                }
                else
                {
                    Say(combatSpeech[Utility.Random(combatSpeech.Length - 1)]);
                }

                m_NextSpeechAllowed = DateTime.UtcNow + NextSpeechDelay;
            }

            if (Combatant != null)
            {
                if (DateTime.UtcNow >= m_NextThrowingNetAllowed)
                {
                    m_NextThrowingNetAllowed = DateTime.UtcNow + NextThrowingNetDelay;

                    int effectRange = 10;

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

                    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, effectRange);

                    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 location = Location;
                    Map     map      = Map;

                    Point3D mobileLocation = mobileTarget.Location;
                    Map     mobileMap      = mobileTarget.Map;

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

                    IEntity startLocation = new Entity(Serial.Zero, new Point3D(location.X, location.Y, location.Z + 7), map);
                    IEntity endLocation   = new Entity(Serial.Zero, new Point3D(mobileTarget.X, mobileTarget.Y, mobileTarget.Z), mobileMap);

                    int itemId  = 3530;
                    int itemHue = 2587;

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

                    double distance         = Utility.GetDistance(location, mobileLocation);
                    double destinationDelay = (double)distance * .08;

                    double duration = Utility.RandomMinMax(3, 5);

                    if (mobileTarget is BaseCreature)
                    {
                        duration *= 1.5;
                    }

                    PublicOverheadMessage(MessageType.Regular, 2586, false, "* .net *");

                    SpecialAbilities.EntangleSpecialAbility(1.0, null, mobileTarget, 1, duration, 0, true, "", "You have been ensnared in a net!", "-1");

                    Effects.PlaySound(location, map, Utility.RandomList(0x5D2, 0x5D3));

                    Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate
                    {
                        if (mobileTarget == null)
                        {
                            return;
                        }
                        if (mobileTarget.Deleted || !mobileTarget.Alive)
                        {
                            return;
                        }
                        if (Utility.GetDistance(location, mobileTarget.Location) >= 30)
                        {
                            return;
                        }

                        for (int a = 0; a < 9; a++)
                        {
                            TimedStatic net     = new TimedStatic(3538, duration - destinationDelay);
                            Point3D netLocation = mobileTarget.Location;

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

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

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

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

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

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

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

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

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

                            net.Hue  = itemHue;
                            net.Name = "the net";
                            net.MoveToWorld(netLocation, mobileMap);
                        }
                    });
                }
            }
        }
示例#13
0
        public override void OnThink()
        {
            base.OnThink();

            if (Utility.RandomDouble() < 0.01 && !Hidden && DateTime.UtcNow > m_NextSpeechAllowed)
            {
                if (Combatant == null)
                {
                    Say(idleSpeech[Utility.Random(idleSpeech.Length - 1)]);
                }

                m_NextSpeechAllowed = DateTime.UtcNow + NextSpeechDelay;
            }

            if (SpecialAbilities.MonsterCanDamage(this, Combatant) && DateTime.UtcNow >= m_NextAbilityAllowed && !Frozen && !AbilityInProgress && !DamageIntervalInProgress)
            {
                switch (Utility.RandomMinMax(1, 2))
                {
                case 1:
                    if (DateTime.UtcNow >= m_NextSwallowAllowed && Utility.GetDistance(Location, Combatant.Location) <= AttackRange)
                    {
                        Swallow();
                        return;
                    }
                    break;

                case 2:
                    //if (DateTime.UtcNow >= m_NextMassiveBreathAllowed)
                    //{
                    //MassiveBoneBreath();
                    //return;
                    //}
                    break;
                }
            }

            if (Utility.RandomDouble() < .01 && DateTime.UtcNow > m_NextAIChangeAllowed && CantWalk == false)
            {
                Effects.PlaySound(Location, Map, GetAngerSound());

                switch (Utility.RandomMinMax(1, 5))
                {
                case 1:
                    PublicOverheadMessage(MessageType.Regular, 0, false, "*groans*");

                    DictCombatTargetingWeight[CombatTargetingWeight.Player]       = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.WeakToPoison] = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.Closest]      = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.EasiestToHit] = 0;
                    break;

                case 2:
                    PublicOverheadMessage(MessageType.Regular, 0, false, "*gurgle*");

                    DictCombatTargetingWeight[CombatTargetingWeight.Player]       = 10;
                    DictCombatTargetingWeight[CombatTargetingWeight.WeakToPoison] = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.Closest]      = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.EasiestToHit] = 0;
                    break;

                case 3:
                    PublicOverheadMessage(MessageType.Regular, 0, false, "*grumble*");

                    DictCombatTargetingWeight[CombatTargetingWeight.Player]       = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.WeakToPoison] = 10;
                    DictCombatTargetingWeight[CombatTargetingWeight.Closest]      = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.EasiestToHit] = 0;
                    break;

                case 4:
                    PublicOverheadMessage(MessageType.Regular, 0, false, "*gulp*");

                    DictCombatTargetingWeight[CombatTargetingWeight.Player]       = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.WeakToPoison] = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.Closest]      = 10;
                    DictCombatTargetingWeight[CombatTargetingWeight.EasiestToHit] = 0;
                    break;

                case 5:
                    PublicOverheadMessage(MessageType.Regular, 0, false, "*grimaces*");

                    DictCombatTargetingWeight[CombatTargetingWeight.Player]       = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.WeakToPoison] = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.Closest]      = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.EasiestToHit] = 10;
                    break;
                }

                m_NextAIChangeAllowed = DateTime.UtcNow + NextAIChangeDelay;
            }
        }
示例#14
0
        public void TriggerTrap()
        {
            if (!SpecialAbilities.Exists(m_Owner))
            {
                return;
            }

            Point3D location = Location;
            Map     map      = Map;
            Mobile  owner    = m_Owner;

            double effectInterval = .5;
            int    loops          = 20;

            Timer.DelayCall(TimeSpan.FromSeconds((effectInterval * loops) + .1), delegate
            {
                if (this == null)
                {
                    return;
                }

                Delete();
            });

            switch (m_TrapType)
            {
            case TrapType.Spikes:
                TimedStatic trap = new TimedStatic(4513, effectInterval * (double)loops);
                trap.Name = "spike trap";
                trap.Hue  = 0;
                trap.MoveToWorld(location, map);

                trap      = new TimedStatic(4507, effectInterval * (double)loops);
                trap.Name = "spike trap";
                trap.Hue  = 0;
                trap.MoveToWorld(location, map);

                Effects.PlaySound(location, map, 0x524);

                for (int a = 0; a < loops; a++)
                {
                    Timer.DelayCall(TimeSpan.FromSeconds(a * effectInterval), delegate
                    {
                        if (this == null)
                        {
                            return;
                        }
                        if (Deleted)
                        {
                            return;
                        }
                        if (!SpecialAbilities.Exists(owner))
                        {
                            return;
                        }

                        bool hitMobile = false;

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

                        Queue m_Queue = new Queue();

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

                            m_Queue.Enqueue(mobile);
                            hitMobile = true;
                        }

                        nearbyMobiles.Free();

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

                            double bleedDamage = 8;

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

                            SpecialAbilities.BleedSpecialAbility(1.0, null, mobile, bleedDamage, 8.0, -1, true, "", "The trap cuts into you deeply, causing you to bleed.", "-1");
                        }

                        if (hitMobile)
                        {
                            Effects.PlaySound(location, map, 0x524);
                        }
                    });
                }
                break;

            case TrapType.Saw:
                Point3D adjustedLocation = location;

                trap      = new TimedStatic(4525, effectInterval * (double)loops);
                trap.Name = "saw trap";
                trap.Hue  = 2118;
                trap.MoveToWorld(adjustedLocation, map);

                trap      = new TimedStatic(4530, effectInterval * (double)loops);
                trap.Name = "saw trap";
                trap.Hue  = 2118;
                trap.MoveToWorld(adjustedLocation, map);

                adjustedLocation.Y++;

                trap      = new TimedStatic(4530, effectInterval * (double)loops);
                trap.Name = "saw trap";
                trap.Hue  = 2118;
                trap.MoveToWorld(adjustedLocation, map);

                adjustedLocation.Y--;
                adjustedLocation.X++;

                trap      = new TimedStatic(4525, effectInterval * (double)loops);
                trap.Name = "saw trap";
                trap.Hue  = 2118;
                trap.MoveToWorld(adjustedLocation, map);

                Effects.PlaySound(location, map, 0x21C);

                for (int a = 0; a < loops; a++)
                {
                    Timer.DelayCall(TimeSpan.FromSeconds(a * effectInterval), delegate
                    {
                        if (this == null)
                        {
                            return;
                        }
                        if (Deleted)
                        {
                            return;
                        }
                        if (!SpecialAbilities.Exists(owner))
                        {
                            return;
                        }

                        bool hitMobile = false;

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

                        Queue m_Queue = new Queue();

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

                            m_Queue.Enqueue(mobile);
                            hitMobile = true;
                        }

                        nearbyMobiles.Free();

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

                            SpecialAbilities.PierceSpecialAbility(1.0, null, mobile, 15, 60, -1, true, "", "The trap pierces your armor, temporarily weakening it!", "-1");

                            double damage = (double)Utility.RandomMinMax(4, 8);

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

                            new Blood().MoveToWorld(mobile.Location, mobile.Map);
                            AOS.Damage(mobile, null, (int)damage, 100, 0, 0, 0, 0);
                        }

                        if (hitMobile)
                        {
                            Effects.PlaySound(location, map, 0x21C);
                        }
                    });
                }
                break;
            }
        }
示例#15
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);
                        }
                    });
                });
            }
        }