Exemple #1
0
        public override void OnGaveMeleeAttack(Mobile defender)
        {
            base.OnGaveMeleeAttack(defender);

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

                for (int a = 0; a < 4; a++)
                {
                    ichor      = new TimedStatic(Utility.RandomList(4650, 4651, 4652, 4653, 4654, 4655), 5);
                    ichor.Hue  = 2051;
                    ichor.Name = "ichor";
                    ichor.MoveToWorld(new Point3D(defender.X + Utility.RandomMinMax(-1, 1), defender.Y + Utility.RandomMinMax(-1, 1), defender.Z), Map);
                }

                Effects.PlaySound(defender.Location, defender.Map, 0x580);
                defender.FixedParticles(0x374A, 10, 20, 5021, 1107, 0, EffectLayer.Head);

                defender.SendMessage("You have been covered in an evil ichor!");

                SpecialAbilities.EntangleSpecialAbility(1.0, this, defender, 1.0, 3, -1, false, "", "", "-1");
                SpecialAbilities.PierceSpecialAbility(1.0, this, defender, 50, 15, -1, false, "", "", "-1");
                SpecialAbilities.CrippleSpecialAbility(1.0, this, defender, .2, 15, -1, false, "", "", "-1");
                SpecialAbilities.DisorientSpecialAbility(1.0, this, defender, .10, 15, -1, false, "", "", "-1");
            }
        }
Exemple #2
0
        public override void OnGaveMeleeAttack(Mobile defender)
        {
            base.OnGaveMeleeAttack(defender);

            if (Utility.RandomDouble() < .25)
            {
                SpecialAbilities.EntangleSpecialAbility(1.0, this, defender, 1.0, 3, -1, false, "", "The titan's massive strike stuns you!", "-1");
                SpecialAbilities.CrippleSpecialAbility(1.0, this, defender, .20, 10, -1, false, "", "", "-1");
                SpecialAbilities.DisorientSpecialAbility(1.0, this, defender, .10, 10, -1, true, "", "", "-1");
            }
        }
Exemple #3
0
        public override void OnGaveMeleeAttack(Mobile defender)
        {
            base.OnGaveMeleeAttack(defender);

            double effectChance = .25;

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

            SpecialAbilities.EntangleSpecialAbility(effectChance, this, defender, 5.0, 1, -1, true, "", "The creature grasps you with its jaws, holding you in place!", "-1");
        }
Exemple #4
0
        public override void OnGaveMeleeAttack(Mobile defender)
        {
            base.OnGaveMeleeAttack(defender);

            if (Utility.RandomDouble() <= .10 && Body != 317)
            {
                SpecialAbilities.FrenzySpecialAbility(1.0, this, defender, 0.5, 20, -1, true, "", "", "*begins to strike with unnatural quickness*");
            }

            if (Utility.RandomDouble() <= .10 && m_NextFeedAllowed <= DateTime.UtcNow && Body != 317)
            {
                IsFeeding = true;

                m_NextFeedAllowed = DateTime.UtcNow + NextFeedDelay;
                m_FeedExpiration  = DateTime.UtcNow + FeedDuration;

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

                FixedParticles(0x376A, 9, 32, 5030, EffectLayer.Waist);

                Blood blood = new Blood();
                blood.MoveToWorld(new Point3D(defender.X + Utility.RandomMinMax(-1, 1), defender.Y + Utility.RandomMinMax(-1, 1), defender.Z + 1), Map);

                double damage = DamageMax * 6;

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

                PublicOverheadMessage(MessageType.Regular, 0, false, "*begins to feed*");

                Animate(34, 5, 1, true, false, 0);

                SpecialAbilities.EntangleSpecialAbility(1.0, this, defender, 1.0, 10, -1, true, "", "", "-1");
                SpecialAbilities.BleedSpecialAbility(1.0, this, defender, damage, 10.0, 0x44D, true, "", "The creature sinks its fangs into you, ensnaring and feeding upon your blood!", "-1");
            }
        }
Exemple #5
0
        public override bool OnMoveOver(Mobile mobile)
        {
            if (!mobile.CanBeDamaged() || !mobile.Alive || mobile.AccessLevel > AccessLevel.Player)
            {
                return(true);
            }

            bool validTarget = false;

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

            if (pm_Target != null)
            {
                validTarget = true;
            }

            if (bc_Target != null)
            {
                if (bc_Target.Controlled && bc_Target.ControlMaster is PlayerMobile)
                {
                    validTarget = true;
                }
            }

            if (!validTarget)
            {
                return(true);
            }

            Effects.PlaySound(mobile.Location, mobile.Map, 0x62A);
            mobile.FixedParticles(0x374A, 10, 20, 5021, 2596, 0, EffectLayer.LeftFoot);

            SpecialAbilities.EntangleSpecialAbility(1.0, null, mobile, 1.0, 1.0, 0x5D9, false, "", "", "-1");
            mobile.SendMessage("Your feet sink into the creep...");

            return(true);
        }
Exemple #6
0
        public override void OnThink()
        {
            base.OnThink();

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

            Mobile combatant = Combatant;

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

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

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

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

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

                        TimeSpan attackCooldown = NextPvMVoidAttackDelay;

                        double effectChance = .2;
                        double damageScalar = 1.0;

                        m_NextVoidAttackAllowed = DateTime.UtcNow + attackCooldown;

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

                        BaseWeapon weapon = Weapon as BaseWeapon;

                        if (weapon == null)
                        {
                            return;
                        }

                        bool hitSuccessful = false;

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

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

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

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

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

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

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

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

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

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

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

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

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

                                weapon.OnHit(this, combatant, damageScalar);
                            });
                        }
                    }
                }
            }
        }
Exemple #7
0
        public override void OnGaveMeleeAttack(Mobile defender)
        {
            base.OnGaveMeleeAttack(defender);

            SpecialAbilities.EntangleSpecialAbility(0.05, this, defender, 1.0, 5, -1, true, "", "Their arrow pins you in place!", "-1");
        }
Exemple #8
0
        public virtual void ResolveTrap(Mobile from)
        {
            switch (m_TrapType)
            {
            case ScavengeTrapType.Undead:
                PublicOverheadMessage(MessageType.Regular, UOACZSystem.yellowTextHue, false, ScavengeUndeadTrapText);

                int creatures = Utility.RandomMinMax(3, 5);

                for (int a = 0; a < creatures; a++)
                {
                    UOACZSystem.SpawnRandomCreature(from, Location, Map, UOACZPersistance.m_ThreatLevel - 50, 0, 3, false);
                }
                break;

            case ScavengeTrapType.Explosion:
                PublicOverheadMessage(MessageType.Regular, UOACZSystem.yellowTextHue, false, "*a trap is sprung*");

                from.FixedParticles(0x36BD, 20, 10, 5044, 0, 0, EffectLayer.Head);
                from.PlaySound(0x307);

                int damageMin = (int)(Math.Round((double)TrapDifficulty / 4));
                int damageMax = (int)(Math.Round((double)TrapDifficulty / 2));

                int damage = Utility.RandomMinMax(damageMin, damageMax);

                from.SendMessage("You have been hit by an explosive trap!");

                new Blood().MoveToWorld(from.Location, from.Map);
                AOS.Damage(from, damage, 0, 100, 0, 0, 0);
                break;

            case ScavengeTrapType.Hinder:
                PublicOverheadMessage(MessageType.Regular, UOACZSystem.yellowTextHue, false, "*a trap is sprung*");

                from.FixedEffect(0x376A, 10, 30, 0, 0);
                from.PlaySound(0x204);

                int duration = Utility.RandomMinMax(15, 30);

                from.SendMessage("You are trapped in place!");

                SpecialAbilities.EntangleSpecialAbility(1.0, null, from, 1.0, duration, -1, true, "", "", "-1");
                break;

            case ScavengeTrapType.Poison:
                PublicOverheadMessage(MessageType.Regular, UOACZSystem.yellowTextHue, false, "*a trap is sprung*");

                int poisonLevel = 0;

                double poisonChance = Utility.RandomDouble();

                if (poisonChance <= .25)
                {
                    poisonLevel = 0;
                }

                else if (poisonChance <= .70)
                {
                    poisonLevel = 1;
                }

                else if (poisonChance <= .95)
                {
                    poisonLevel = 2;
                }

                else
                {
                    poisonLevel = 3;
                }

                Poison poison = Poison.GetPoison(poisonLevel);

                from.SendMessage("You have been poisoned!");

                from.FixedEffect(0x372A, 10, 30, 2208, 0);
                Effects.PlaySound(from.Location, from.Map, 0x22F);

                from.ApplyPoison(from, poison);
                break;
            }

            m_TrapType = ScavengeTrapType.None;

            PlayerMobile player = from as PlayerMobile;

            if (player == null)
            {
                return;
            }

            UOACZPersistance.CheckAndCreateUOACZAccountEntry(player);
            player.m_UOACZAccountEntry.TrapsSprung++;
        }
Exemple #9
0
        public void SetTimedEgg(Point3D location, Map map, EggType eggType)
        {
            int eggHue = Hue = Utility.RandomMinMax(2, 362);

            DecoyEasterEgg decoyEasterEgg = new DecoyEasterEgg();

            decoyEasterEgg.Hue = eggHue;
            decoyEasterEgg.MoveToWorld(location, map);

            int delayTime = Utility.RandomMinMax(1, 10);

            Effects.SendLocationParticles(EffectItem.Create(location, map, TimeSpan.FromSeconds(0.25)), 0x9B5, 10, delayTime * 25, eggHue, 0, 5029, 0);

            Timer.DelayCall(TimeSpan.FromSeconds(delayTime), delegate
            {
                if (decoyEasterEgg != null)
                {
                    if (!decoyEasterEgg.Deleted)
                    {
                        if (decoyEasterEgg.ParentEntity is PlayerMobile)
                        {
                            PlayerMobile pm_Owner = decoyEasterEgg.ParentEntity as PlayerMobile;

                            pm_Owner.SendMessage("The eggs you gathered appear to be some sort of decoy, and they crumble in your backpack...");
                            pm_Owner.SendSound(0x134);
                        }

                        decoyEasterEgg.Delete();
                    }
                }

                int radius = 2;

                int effectSound = 0;

                switch (eggType)
                {
                case EggType.Explosive: effectSound = 0x359; break;

                case EggType.Entangle: effectSound = 0x211; break;

                case EggType.Poison: effectSound = 0x22F; break;

                case EggType.Ice: effectSound = 0x64F; break;

                case EggType.Banish: effectSound = 0x655; break;

                case EggType.Gust: effectSound = 0x64C; break;

                case EggType.Bloody: effectSound = 0x62B; break;
                }

                Effects.PlaySound(location, map, effectSound);

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

                m_ExplosionLocations.Add(location, 0);

                for (int a = 1; a < radius + 1; a++)
                {
                    m_ExplosionLocations.Add(new Point3D(location.X - a, location.Y - a, location.Z), a);
                    m_ExplosionLocations.Add(new Point3D(location.X, location.Y - a, location.Z), a);
                    m_ExplosionLocations.Add(new Point3D(location.X + a, location.Y - a, location.Z), a);
                    m_ExplosionLocations.Add(new Point3D(location.X + a, location.Y, location.Z), a);
                    m_ExplosionLocations.Add(new Point3D(location.X + a, location.Y + a, location.Z), a);
                    m_ExplosionLocations.Add(new Point3D(location.X, location.Y + a, location.Z), a);
                    m_ExplosionLocations.Add(new Point3D(location.X - a, location.Y + a, location.Z), a);
                    m_ExplosionLocations.Add(new Point3D(location.X - a, location.Y, location.Z), a);
                }

                foreach (KeyValuePair <Point3D, double> pair in m_ExplosionLocations)
                {
                    Timer.DelayCall(TimeSpan.FromSeconds(pair.Value * .25), delegate
                    {
                        switch (eggType)
                        {
                        case EggType.Explosive:
                            Effects.SendLocationParticles(EffectItem.Create(pair.Key, map, TimeSpan.FromSeconds(0.5)), 0x36BD, 20, 10, 5044);
                            break;

                        case EggType.Entangle:
                            radius = 3;
                            Effects.SendLocationParticles(EffectItem.Create(pair.Key, map, TimeSpan.FromSeconds(.5)), 0x3973, 10, 50, 5029);
                            break;

                        case EggType.Poison:
                            Effects.SendLocationParticles(EffectItem.Create(pair.Key, map, TimeSpan.FromSeconds(0.5)), 0x372A, 10, 20, 59, 0, 5029, 0);
                            break;

                        case EggType.Ice:
                            radius = 3;
                            Effects.SendLocationParticles(EffectItem.Create(pair.Key, map, TimeSpan.FromSeconds(0.25)), 0x3779, 10, 20, 1153, 0, 5029, 0);
                            break;

                        case EggType.Banish:
                            radius = 3;
                            Effects.SendLocationParticles(EffectItem.Create(pair.Key, map, TimeSpan.FromSeconds(.25)), 0x3763, 10, 20, 2199, 0, 5029, 0);
                            break;

                        case EggType.Gust:
                            radius = 4;
                            Effects.SendLocationParticles(EffectItem.Create(pair.Key, map, TimeSpan.FromSeconds(.25)), 0x1FB2, 10, 20, 0, 0, 5029, 0);
                            break;

                        case EggType.Bloody:
                            Effects.SendLocationParticles(EffectItem.Create(pair.Key, map, TimeSpan.FromSeconds(.25)), Utility.RandomList(0x1645, 0x122A, 0x122B, 0x122C, 0x122D, 0x122E, 0x122F), 10, 20, 0, 0, 5029, 0);
                            break;
                        }
                    });
                }

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

                IPooledEnumerable eable = map.GetMobilesInRange(location, radius);

                foreach (Mobile mobile in eable)
                {
                    if (mobile is EasterBunny)
                    {
                        continue;
                    }

                    if (!mobile.CanBeDamaged())
                    {
                        continue;
                    }

                    m_TargetsHit.Add(mobile);
                }

                eable.Free();

                int targets = m_TargetsHit.Count;

                for (int a = 0; a < targets; a++)
                {
                    double damage = 0;

                    Mobile mobile = m_TargetsHit[a];

                    if (mobile == null)
                    {
                        continue;
                    }
                    if (!mobile.Alive || mobile.Deleted)
                    {
                        continue;
                    }

                    switch (eggType)
                    {
                    case EggType.Explosive:
                        damage = (double)(Utility.RandomMinMax(20, 40));

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

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

                    case EggType.Entangle:
                        if (mobile != null)
                        {
                            SpecialAbilities.EntangleSpecialAbility(1.0, null, mobile, 1, 10, -1, true, "", "You are held in place!", "-1");
                        }
                        break;

                    case EggType.Poison:
                        Poison poison = Poison.GetPoison(Utility.RandomMinMax(2, 4));
                        mobile.ApplyPoison(mobile, poison);
                        break;

                    case EggType.Ice:
                        damage = (double)(Utility.RandomMinMax(10, 20));

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

                        SpecialAbilities.CrippleSpecialAbility(1.0, null, mobile, .5, 10, -1, true, "", "A blast of ice has slowed your actions!", "-1");

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

                    case EggType.Gust:
                        SpecialAbilities.KnockbackSpecialAbility(1.0, Location, null, mobile, 40, 8, -1, "", "A gust of wind knocks you off your feet!");
                        break;

                    case EggType.Banish:
                        SpecialAbilities.HinderSpecialAbility(1.0, null, mobile, 1.0, 5, false, -1, false, "", "You cannot move or speak!", "-1");

                        mobile.Squelched = true;
                        mobile.Hidden    = true;

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

                            mobile.Squelched = false;
                            mobile.Hidden    = false;
                        });
                        break;

                    case EggType.Bloody:
                        SpecialAbilities.BleedSpecialAbility(1.0, null, mobile, 40, 8.0, 0x44D, true, "", "You begin to bleed!", "-1");
                        break;
                    }
                }
            });
        }
Exemple #10
0
        public override void OnThink()
        {
            base.OnThink();

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

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

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

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

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

                        TimeSpan attackCooldown = NextPvMVoidAttackDelay;

                        double effectChance = .10;
                        double damageScalar = 1.0;

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

                                else
                                {
                                    effectChance = .25;
                                }
                            }
                        }

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

                        m_NextVoidAttackAllowed = DateTime.UtcNow + attackCooldown;

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

                        BaseWeapon weapon = Weapon as BaseWeapon;

                        if (weapon == null)
                        {
                            return;
                        }

                        bool hitSuccessful = false;

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

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

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

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

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

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

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

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

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

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

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

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

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

                                weapon.OnHit(this, combatant, damageScalar);
                            });
                        }
                    }
                }
            }
        }
Exemple #11
0
        public override void OnGaveMeleeAttack(Mobile defender)
        {
            base.OnGaveMeleeAttack(defender);

            SpecialAbilities.EntangleSpecialAbility(.33, this, defender, 1.0, 4.0, -1, false, "", "The creature entangles you with its branches!", "-1");
        }
Exemple #12
0
        public override void OnThink()
        {
            base.OnThink();

            Point3D location = Location;
            Map     map      = Map;

            //Outside of Guard Area
            if (GuardsHome && !(ControlMaster is PlayerMobile))
            {
                if (Utility.GetDistance(Home, location) > MaxDistanceAllowedFromHome)
                {
                    TimedStatic dirt = new TimedStatic(Utility.RandomList(7681, 7682), 5);
                    dirt.Name = "dirt";
                    dirt.MoveToWorld(location, map);

                    dirt.PublicOverheadMessage(MessageType.Regular, 0, false, ReturnHomeString);

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

                    int projectiles   = 6;
                    int particleSpeed = 4;

                    for (int a = 0; a < projectiles; a++)
                    {
                        Point3D newLocation = new Point3D(location.X + Utility.RandomList(-5, -4, -3, -2, -1, 1, 2, 3, 4, 5), location.Y + Utility.RandomList(-5, -4, -3, -2, -1, 1, 2, 3, 4, 5), location.Z);
                        SpellHelper.AdjustField(ref newLocation, map, 12, false);

                        IEntity effectStartLocation = new Entity(Serial.Zero, new Point3D(location.X, location.Y, location.Z + 5), map);
                        IEntity effectEndLocation   = new Entity(Serial.Zero, new Point3D(newLocation.X, newLocation.Y, newLocation.Z + 5), map);

                        Effects.SendMovingEffect(effectStartLocation, effectEndLocation, Utility.RandomList(0x3728), particleSpeed, 0, false, false, 0, 0);
                    }

                    Location  = Home;
                    Combatant = null;

                    return;
                }
            }

            if (m_NeedWaypoint && m_CanTeleportToBaseNode && !(ControlMaster is PlayerMobile))
            {
                Dictionary <UOACZWayPoint, int> DictWaypoints = new Dictionary <UOACZWayPoint, int>();

                foreach (UOACZWayPoint waypoint in UOACZWayPoint.m_UOACZWaypoints)
                {
                    if (!UOACZRegion.ContainsItem(waypoint))
                    {
                        continue;
                    }
                    if (!waypoint.IsBaseNode)
                    {
                        continue;
                    }

                    int distanceToWaypoint = (Utility.GetDistance(Location, waypoint.Location));

                    if (distanceToWaypoint >= UOACZSystem.UndeadMaxDynamicWaypointRange)
                    {
                        continue;
                    }

                    int distanceWeight = (int)(Math.Round(((double)UOACZSystem.UndeadMaxDynamicWaypointRange - (double)distanceToWaypoint) * .05));

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

                    DictWaypoints.Add(waypoint, distanceWeight);
                }

                if (DictWaypoints.Count > 0)
                {
                    int TotalValues = 0;

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

                    double ItemCheck = Utility.RandomDouble();

                    double CumulativeAmount = 0.0;
                    double AdditionalAmount = 0.0;

                    foreach (KeyValuePair <UOACZWayPoint, int> pair in DictWaypoints)
                    {
                        AdditionalAmount = (double)pair.Value / (double)TotalValues;

                        if (ItemCheck >= CumulativeAmount && ItemCheck < (CumulativeAmount + AdditionalAmount))
                        {
                            UOACZWayPoint waypoint = pair.Key;

                            if (waypoint != null)
                            {
                                if (!waypoint.Deleted)
                                {
                                    CurrentWaypoint = pair.Key;
                                    m_NeedWaypoint  = false;

                                    return;
                                }
                            }

                            break;
                        }

                        CumulativeAmount += AdditionalAmount;
                    }
                }

                else
                {
                    m_NeedWaypoint = false;
                }
            }

            if ((DateTime.UtcNow >= m_LastActivity + InactivityThreshold) && !(ControlMaster is PlayerMobile))
            {
                //Send to Random Town Waypoint BaseNode
                if (m_CanTeleportToBaseNode)
                {
                    List <UOACZWayPoint> m_ValidBaseNodes = new List <UOACZWayPoint>();

                    foreach (UOACZWayPoint waypoint in UOACZWayPoint.m_UOACZWaypoints)
                    {
                        if (waypoint == null)
                        {
                            continue;
                        }
                        if (waypoint.Deleted)
                        {
                            continue;
                        }
                        if (!UOACZRegion.ContainsItem(waypoint))
                        {
                            continue;
                        }
                        if (!waypoint.IsBaseNode)
                        {
                            continue;
                        }
                        if (waypoint.WaypointType == UOACZWayPoint.UOACZWaypointType.UndeadWilderness)
                        {
                            continue;
                        }

                        m_ValidBaseNodes.Add(waypoint);
                    }

                    if (m_ValidBaseNodes.Count > 0)
                    {
                        UOACZWayPoint targetWaypoint = m_ValidBaseNodes[Utility.RandomMinMax(0, m_ValidBaseNodes.Count - 1)];

                        MoveToWorld(targetWaypoint.Location, targetWaypoint.Map);
                        CurrentWaypoint = targetWaypoint;
                        m_LastActivity  = DateTime.UtcNow;

                        m_NeedWaypoint = false;
                        return;
                    }
                }

                m_NeedWaypoint = true;
                return;
            }

            if (Utility.RandomDouble() < 0.005)
            {
                if (Combatant == null)
                {
                    Say(idleSpeech[Utility.Random(idleSpeech.Length - 1)]);
                }

                else
                {
                    Say(combatSpeech[Utility.Random(combatSpeech.Length - 1)]);
                }
            }

            bool ignoreBreakableStatics = false;

            if (Hidden && ControlMaster is PlayerMobile)
            {
                ignoreBreakableStatics = true;
            }

            if (DateTime.UtcNow >= m_NextBreakableStaticCheckAllowed && DateTime.UtcNow >= m_NextBreakableStaticAttackAllowed && !ignoreBreakableStatics)
            {
                m_NextBreakableStaticCheckAllowed = DateTime.UtcNow + BreakableStaticCheckDelay;

                BreakableStatic targetBreakableStatic = null;
                Dictionary <BreakableStatic, int> DictBreakableStatics = new Dictionary <BreakableStatic, int>();

                IPooledEnumerable nearbyItems = Map.GetItemsInRange(Location, 1);

                foreach (Item item in nearbyItems)
                {
                    if (item.Deleted)
                    {
                        continue;
                    }

                    if (item is BreakableStatic)
                    {
                        if (!Map.InLOS(Location, item.Location))
                        {
                            continue;
                        }

                        BreakableStatic breakableStatic = item as BreakableStatic;

                        if (breakableStatic is UOACZBreakableStatic)
                        {
                            UOACZBreakableStatic uoaczBreakableStatic = breakableStatic as UOACZBreakableStatic;

                            if (uoaczBreakableStatic.AllowHumanDamage)
                            {
                                continue;
                            }
                        }

                        if (breakableStatic.DamageState == BreakableStatic.DamageStateType.Broken)
                        {
                            continue;
                        }

                        int weight = 5;

                        if (breakableStatic == m_LastBreakableStaticAttacked)
                        {
                            weight += 10;
                        }

                        int damageBonus = (int)Math.Round((10 * (1 - (double)breakableStatic.HitPoints / (double)breakableStatic.MaxHitPoints)));

                        weight += damageBonus;

                        DictBreakableStatics.Add(breakableStatic, weight);
                    }
                }

                nearbyItems.Free();

                int TotalValues = 0;

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

                double ItemCheck = Utility.RandomDouble();

                double CumulativeAmount = 0.0;
                double AdditionalAmount = 0.0;

                foreach (KeyValuePair <BreakableStatic, int> pair in DictBreakableStatics)
                {
                    AdditionalAmount = (double)pair.Value / (double)TotalValues;

                    if (ItemCheck >= CumulativeAmount && ItemCheck < (CumulativeAmount + AdditionalAmount))
                    {
                        targetBreakableStatic = pair.Key;
                        break;
                    }

                    CumulativeAmount += AdditionalAmount;
                }

                if (targetBreakableStatic != null)
                {
                    double minHinder = 1;
                    double maxHinder = 1;

                    double weaponUsageDelay = 3;

                    BaseWeapon weapon = Weapon as BaseWeapon;

                    if (weapon != null)
                    {
                        weaponUsageDelay = weapon.GetDelay(this, false).TotalSeconds;
                    }

                    bool stockpileNearby = false;

                    if (targetBreakableStatic is UOACZStockpile)
                    {
                        stockpileNearby = true;
                    }

                    else
                    {
                        switch (targetBreakableStatic.DamageState)
                        {
                        case BreakableStatic.DamageStateType.Normal:
                            minHinder = weaponUsageDelay * .5;
                            maxHinder = weaponUsageDelay;
                            break;

                        case BreakableStatic.DamageStateType.LightlyDamaged:
                            minHinder = weaponUsageDelay * .65;
                            maxHinder = weaponUsageDelay;
                            break;

                        case BreakableStatic.DamageStateType.HeavilyDamaged:
                            minHinder = weaponUsageDelay * .8;
                            maxHinder = weaponUsageDelay;
                            break;
                        }
                    }

                    double delay = minHinder + ((maxHinder - minHinder) * Utility.RandomDouble());

                    if (ControlMaster is PlayerMobile)
                    {
                        delay = 1;
                        SpecialAbilities.EntangleSpecialAbility(1.0, null, this, 1, delay, 0, false, "", "", "-1");
                    }

                    else
                    {
                        if (stockpileNearby)
                        {
                            delay = 10;

                            SpecialAbilities.EntangleSpecialAbility(1.0, null, this, 1, delay, 0, false, "", "", "-1");
                            m_NextBreakableStaticAttackAllowed = DateTime.UtcNow + BreakableStaticAttackDelay;
                        }

                        else
                        {
                            if (Utility.RandomDouble() <= .5)
                            {
                                SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1, delay, true, 0, false, "", "", "-1");
                            }

                            else
                            {
                                SpecialAbilities.EntangleSpecialAbility(1.0, null, this, 1, delay, 0, false, "", "", "-1");
                            }

                            m_NextBreakableStaticAttackAllowed = DateTime.UtcNow + BreakableStaticAttackDelay;
                        }
                    }

                    targetBreakableStatic.Interact(this, BreakableStatic.InteractionType.Weapon);
                }
            }
        }
Exemple #13
0
        public override void OnThink()
        {
            base.OnThink();

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

                switch (Utility.RandomMinMax(1, 5))
                {
                case 1:
                    DictCombatTargetingWeight[CombatTargetingWeight.Player]           = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.Closest]          = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.HighestHitPoints] = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.LowestHitPoints]  = 0;
                    break;

                case 2:
                    DictCombatTargetingWeight[CombatTargetingWeight.Player]           = 10;
                    DictCombatTargetingWeight[CombatTargetingWeight.Closest]          = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.HighestHitPoints] = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.LowestHitPoints]  = 0;
                    break;

                case 3:
                    DictCombatTargetingWeight[CombatTargetingWeight.Player]           = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.Closest]          = 10;
                    DictCombatTargetingWeight[CombatTargetingWeight.HighestHitPoints] = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.LowestHitPoints]  = 0;
                    break;

                case 4:
                    DictCombatTargetingWeight[CombatTargetingWeight.Player]           = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.Closest]          = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.HighestHitPoints] = 10;
                    DictCombatTargetingWeight[CombatTargetingWeight.LowestHitPoints]  = 0;
                    break;

                case 5:
                    DictCombatTargetingWeight[CombatTargetingWeight.Player]           = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.Closest]          = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.HighestHitPoints] = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.LowestHitPoints]  = 10;
                    break;
                }

                m_NextAIChangeAllowed = DateTime.UtcNow + NextAIChangeDelay;
            }

            if (m_NextSnakesAllowed < DateTime.UtcNow && snakeEvents < maxSnakeEvents)
            {
                snakeEvents++;

                PlaySound(GetAngerSound());
                PublicOverheadMessage(MessageType.Regular, 0, false, "*snakes emerge from hair*");

                for (int a = 0; a < 3; a++)
                {
                    BaseCreature bc_Creature = null;

                    double creatureResult = Utility.RandomDouble();

                    if (creatureResult < .01)
                    {
                        bc_Creature = new SilverSerpent();
                    }

                    else if (creatureResult < .03)
                    {
                        bc_Creature = new IceSerpent();
                    }

                    else if (creatureResult < .5)
                    {
                        bc_Creature = new LavaSerpent();
                    }

                    else if (creatureResult < .10)
                    {
                        bc_Creature = new GiantSerpent();
                    }

                    else if (creatureResult < .25)
                    {
                        bc_Creature = new GiantCoralSnake();
                    }

                    else if (creatureResult < .50)
                    {
                        bc_Creature = new CoralSnake();
                    }

                    else
                    {
                        bc_Creature = new Snake();
                    }

                    if (bc_Creature != null)
                    {
                        bc_Creature.MoveToWorld(Location, Map);
                        bc_Creature.PlaySound(bc_Creature.GetAngerSound());

                        m_Mobiles.Add(bc_Creature);
                    }
                }

                m_NextSnakesAllowed = DateTime.UtcNow + NextSnakeDelay;

                return;
            }

            if (m_NextArrowAllowed < DateTime.UtcNow && AIObject != null && Combatant != null)
            {
                if (m_NextArrowStormAllowed < DateTime.UtcNow && !Hidden && AIObject.currentCombatRange != CombatRange.Withdraw)
                {
                    int attacks = Utility.RandomMinMax(5, 10);

                    double preAttackDelay = .1;
                    double attackInterval = .4;

                    double hitChance = .8;

                    double actionsCooldown = attacks * (preAttackDelay + attackInterval);

                    m_NextArrowAllowed      = DateTime.UtcNow + TimeSpan.FromSeconds(actionsCooldown) + NextArrowDelay;
                    m_NextArrowStormAllowed = m_NextArrowAllowed + NextArrowStormDelay;

                    if (AIObject != null)
                    {
                        AIObject.NextMove              = DateTime.UtcNow + TimeSpan.FromSeconds(actionsCooldown);
                        LastSwingTime                  = LastSwingTime + TimeSpan.FromSeconds(actionsCooldown);
                        NextSpellTime                  = NextSpellTime + TimeSpan.FromSeconds(actionsCooldown);
                        NextCombatHealActionAllowed    = NextCombatHealActionAllowed + TimeSpan.FromSeconds(actionsCooldown);
                        NextCombatSpecialActionAllowed = NextCombatSpecialActionAllowed + TimeSpan.FromSeconds(actionsCooldown);
                        NextCombatEpicActionAllowed    = NextCombatEpicActionAllowed + TimeSpan.FromSeconds(actionsCooldown);
                    }

                    Point3D location = Location;
                    Map     map      = Map;

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

                            var mobilesNearby = map.GetMobilesInRange(location, 14);

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

                            foreach (Mobile mobile in mobilesNearby)
                            {
                                if (mobile == null)
                                {
                                    continue;
                                }
                                if (mobile.Deleted || !mobile.Alive)
                                {
                                    continue;
                                }
                                if (mobile.AccessLevel > AccessLevel.Player)
                                {
                                    continue;
                                }

                                bool validTarget = false;

                                PlayerMobile pm_Mobile = mobile as PlayerMobile;
                                BaseCreature bc_Mobile = mobile as BaseCreature;

                                if (pm_Mobile != null)
                                {
                                    validTarget = true;
                                }

                                if (bc_Mobile != null)
                                {
                                    if (bc_Mobile.Controlled && bc_Mobile.ControlMaster is PlayerMobile)
                                    {
                                        validTarget = true;
                                    }
                                }

                                if (validTarget)
                                {
                                    m_MobilesToTarget.Add(mobile);
                                }
                            }

                            mobilesNearby.Free();

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

                            Mobile target = m_MobilesToTarget[Utility.RandomMinMax(0, m_MobilesToTarget.Count - 1)];

                            Direction = GetDirectionTo(target);

                            Effects.PlaySound(location, map, GetAttackSound());

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

                                Animate(Utility.RandomList(4), 5, 1, true, false, 0);

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

                                    MovingEffect(target, 0xF42, 18, 1, false, false, 2576, 0);

                                    double distance         = GetDistanceToSqrt(target.Location);
                                    double destinationDelay = (double)distance * .08;

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

                                        if (Utility.RandomDouble() < hitChance)
                                        {
                                            Effects.PlaySound(location, map, 0x234);

                                            int damage = Utility.RandomMinMax(DamageMin, DamageMax);

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

                                            //Manual Parry Handling
                                            BaseShield shield = target.FindItemOnLayer(Layer.TwoHanded) as BaseShield;

                                            if (shield != null)
                                            {
                                                damage = shield.OnHit(Weapon as BaseWeapon, damage, this);
                                            }

                                            BaseWeapon weapon = target.FindItemOnLayer(Layer.TwoHanded) as BaseWeapon;

                                            if (!(weapon is BaseRanged) && weapon != null)
                                            {
                                                damage = weapon.WeaponParry(weapon, damage, target);
                                            }

                                            DoHarmful(target);

                                            List <Point3D> m_ExplosionLocations = new List <Point3D>();
                                            Point3D destination = target.Location;

                                            m_ExplosionLocations.Add(target.Location);

                                            int radius = 1;

                                            for (int b = 1; b < radius + 1; b++)
                                            {
                                                m_ExplosionLocations.Add(new Point3D(destination.X - b, destination.Y - b, destination.Z));
                                                m_ExplosionLocations.Add(new Point3D(destination.X, destination.Y - b, destination.Z));
                                                m_ExplosionLocations.Add(new Point3D(destination.X + b, destination.Y - b, destination.Z));
                                                m_ExplosionLocations.Add(new Point3D(destination.X + b, destination.Y, destination.Z));
                                                m_ExplosionLocations.Add(new Point3D(destination.X + b, destination.Y + b, destination.Z));
                                                m_ExplosionLocations.Add(new Point3D(destination.X, destination.Y + b, destination.Z));
                                                m_ExplosionLocations.Add(new Point3D(destination.X - b, destination.Y + b, destination.Z));
                                                m_ExplosionLocations.Add(new Point3D(destination.X - b, destination.Y, destination.Z));
                                            }

                                            foreach (Point3D explosionLocation in m_ExplosionLocations)
                                            {
                                                Effects.SendLocationParticles(EffectItem.Create(explosionLocation, target.Map, TimeSpan.FromSeconds(0.25)), 0x3779, 10, 15, 1153, 0, 5029, 0);
                                            }

                                            SpecialAbilities.CrippleSpecialAbility(1.0, this, target, .25, 10, 0x64F, false, "", "The medusa's arrow has slowed your actions!", "-1");

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

                                        else
                                        {
                                            Effects.PlaySound(location, map, 0x238);
                                        }
                                    });
                                });
                            });
                        });
                    }
                }

                else
                {
                    double hitChance = .66;

                    int minDamage = DamageMin;
                    int maxDamage = DamageMax;

                    AIObject.NextMove = DateTime.UtcNow + TimeSpan.FromSeconds(1.5);
                    LastSwingTime     = LastSwingTime + TimeSpan.FromSeconds(3);

                    m_NextArrowAllowed = DateTime.UtcNow + NextArrowDelay;

                    Animate(Utility.RandomList(4), 5, 1, true, false, 0);
                    Effects.PlaySound(Location, Map, this.GetAttackSound());

                    Point3D location = Location;
                    Map     map      = Map;

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

                        MovingEffect(Combatant, 0xF42, 18, 1, false, false, 2576, 0);

                        double distance         = GetDistanceToSqrt(Combatant.Location);
                        double destinationDelay = (double)distance * .08;

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

                            if (Utility.RandomDouble() < hitChance)
                            {
                                Effects.PlaySound(location, map, 0x234);

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

                                //Manual Parry Handling
                                BaseShield shield = Combatant.FindItemOnLayer(Layer.TwoHanded) as BaseShield;

                                if (shield != null)
                                {
                                    damage = shield.OnHit(Weapon as BaseWeapon, damage, this);
                                }

                                BaseWeapon weapon = Combatant.FindItemOnLayer(Layer.TwoHanded) as BaseWeapon;

                                if (!(weapon is BaseRanged) && weapon != null)
                                {
                                    damage = weapon.WeaponParry(weapon, damage, Combatant);
                                }

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

                                DoHarmful(Combatant);

                                SpecialAbilities.EntangleSpecialAbility(0.33, this, Combatant, 1.0, 5, -1, true, "", "Their arrow pins you in place!", "-1");

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

                            else
                            {
                                Effects.PlaySound(Location, Map, 0x238);
                            }
                        });
                    });
                }
            }
        }
Exemple #14
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);
                        }
                    });
                }
            }
        }
Exemple #15
0
        public override void OnThink()
        {
            base.OnThink();

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

                switch (Utility.RandomMinMax(1, 5))
                {
                case 1:
                    DictCombatTargetingWeight[CombatTargetingWeight.Player]           = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.Closest]          = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.HighestHitPoints] = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.LowestHitPoints]  = 0;
                    break;

                case 2:
                    DictCombatTargetingWeight[CombatTargetingWeight.Player]           = 10;
                    DictCombatTargetingWeight[CombatTargetingWeight.Closest]          = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.HighestHitPoints] = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.LowestHitPoints]  = 0;
                    break;

                case 3:
                    DictCombatTargetingWeight[CombatTargetingWeight.Player]           = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.Closest]          = 10;
                    DictCombatTargetingWeight[CombatTargetingWeight.HighestHitPoints] = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.LowestHitPoints]  = 0;
                    break;

                case 4:
                    DictCombatTargetingWeight[CombatTargetingWeight.Player]           = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.Closest]          = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.HighestHitPoints] = 10;
                    DictCombatTargetingWeight[CombatTargetingWeight.LowestHitPoints]  = 0;
                    break;

                case 5:
                    DictCombatTargetingWeight[CombatTargetingWeight.Player]           = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.Closest]          = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.HighestHitPoints] = 0;
                    DictCombatTargetingWeight[CombatTargetingWeight.LowestHitPoints]  = 10;
                    break;
                }

                m_NextAIChangeAllowed = DateTime.UtcNow + NextAIChangeDelay;
            }

            if (Utility.RandomDouble() < 1 && DateTime.UtcNow > m_NextArrowAllowed && AIObject.currentCombatRange != CombatRange.Withdraw && AIObject.Action != ActionType.Flee)
            {
                Mobile combatant = this.Combatant;

                if (combatant != null)
                {
                    if (combatant.Alive && this.InLOS(combatant) && this.GetDistanceToSqrt(combatant) <= 14)
                    {
                        int minDamage = DamageMin;
                        int maxDamage = DamageMax;

                        //Backstab
                        if (Hidden)
                        {
                            minDamage = (int)((double)DamageMin * 1.5);
                            maxDamage = (int)((double)DamageMax * 1.5);

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

                                if (this.Hidden)
                                {
                                    Effects.PlaySound(Location, Map, 0x51D);
                                    RevealingAction();
                                }
                            });
                        }

                        AIObject.NextMove = DateTime.UtcNow + TimeSpan.FromSeconds(1.5);
                        LastSwingTime     = LastSwingTime + TimeSpan.FromSeconds(3);

                        m_NextArrowAllowed = DateTime.UtcNow + NextArrowDelay;

                        Animate(Utility.RandomList(4), 6, 1, true, false, 0);
                        Effects.PlaySound(Location, Map, this.GetAttackSound());

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

                            this.MovingEffect(combatant, 0xF42, 18, 1, false, false);

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

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

                                if (Utility.RandomDouble() < .80)
                                {
                                    Effects.PlaySound(Location, Map, 0x234);

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

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

                                    this.DoHarmful(combatant);

                                    SpecialAbilities.EntangleSpecialAbility(0.25, this, combatant, 1.0, 5, -1, true, "", "Their arrow pins you in place!", "-1");

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

                                else
                                {
                                    Effects.PlaySound(Location, Map, 0x238);
                                }
                            });
                        });
                    }
                }
            }
        }
        public static void Trick(BaseCreature creature, PlayerMobile player)
        {
            if (creature == null || player == null)
            {
                return;
            }

            int trickTextHue = 0x22;

            creature.PublicOverheadMessage(MessageType.Regular, trickTextHue, false, "Trick it is then!");
            creature.PlaySound(0x246);

            double damageAmount = 0;
            int    duration     = 0;

            switch (Utility.RandomMinMax(1, 15))
            {
            case 1:
                SpecialAbilities.BacklashSpecialAbility(1.0, null, player, .75, 60, -1, true, "", "");

                if (player.NetState != null)
                {
                    player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Ack! A curse! Causing your spellcasting proficiency to suffer!", player.NetState);
                }
                break;

            case 2:
                double bleedAmount = (double)player.HitsMax * .66;

                for (int a = 0; a < 5; a++)
                {
                    Point3D newLocation = new Point3D(player.Location.X + Utility.RandomList(-1, 1), player.Location.Y + Utility.RandomList(-1, 1), player.Location.Z);

                    new Blood().MoveToWorld(newLocation, player.Map);
                }

                SpecialAbilities.BleedSpecialAbility(1.0, null, player, bleedAmount, 8, -1, true, "", "", "-1");

                if (player.NetState != null)
                {
                    player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Curses! A dagger hidden in an apple!", player.NetState);
                }
                break;

            case 3:
                Point3D creatureLocation = creature.Location;
                Point3D playerLocation   = player.Location;

                int projectiles   = 15;
                int particleSpeed = 8;

                for (int a = 0; a < projectiles; a++)
                {
                    Point3D newLocation = new Point3D(player.X + Utility.RandomList(-5, -4, -3, -2, -1, 1, 2, 3, 4, 5), player.Y + Utility.RandomList(-5, -4, -3, -2, -1, 1, 2, 3, 4, 5), player.Z);
                    SpellHelper.AdjustField(ref newLocation, player.Map, 12, false);

                    IEntity effectStartLocation = new Entity(Serial.Zero, new Point3D(newLocation.X, newLocation.Y, newLocation.Z + 10), player.Map);
                    IEntity effectEndLocation   = new Entity(Serial.Zero, new Point3D(player.X, player.Y, player.Z + 10), player.Map);

                    Effects.SendMovingParticles(effectStartLocation, effectEndLocation, 0x3818, particleSpeed, 0, false, false, 2603, 0, 9501, 0, 0, 0x100);
                }

                player.FixedParticles(0x3967, 10, 40, 5036, 2603, 0, EffectLayer.CenterFeet);

                int damage = (int)(Math.Round((double)player.HitsMax * .33));

                duration = 5;

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

                new Blood().MoveToWorld(player.Location, player.Map);
                AOS.Damage(player, damage, 0, 100, 0, 0, 0);

                if (player.NetState != null)
                {
                    player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Electric candy! What an age we live in!", player.NetState);
                }
                break;

            case 4:
                SpecialAbilities.DiseaseSpecialAbility(1.0, null, player, 3, 60, -1, true, "", "");

                if (player.NetState != null)
                {
                    player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Blast! Expired candy!", player.NetState);
                }
                break;

            case 5:
                TimedStatic glue = new TimedStatic(4650, 30);
                glue.Name = "glue";
                glue.Hue  = 2067;
                glue.MoveToWorld(player.Location, player.Map);

                SpecialAbilities.EntangleSpecialAbility(1.0, null, player, 1.0, 30, -1, true, "", "", "-1");

                if (player.NetState != null)
                {
                    player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Your feet have been glued to the floor!", player.NetState);
                }
                break;

            case 6:
                damageAmount = (double)player.HitsMax * .5;
                SpecialAbilities.FlamestrikeSpecialAbility(1.0, null, player, damageAmount, 1, -1, true, "", "Spicy candy! So hot!");

                if (player.NetState != null)
                {
                    player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Spicy candy! So hot!", player.NetState);
                }
                break;

            case 7:
                damageAmount = (double)player.HitsMax * .5;

                Direction direction = Utility.GetDirection(creature.Location, player.Location);

                int windItemId = 8099;

                switch (direction)
                {
                case Direction.North: windItemId = 8099; break;

                case Direction.Right: windItemId = 8099; break;

                case Direction.West: windItemId = 8104; break;

                case Direction.Up: windItemId = 8104; break;

                case Direction.East: windItemId = 8109; break;

                case Direction.Down: windItemId = 8109; break;

                case Direction.South: windItemId = 8114; break;

                case Direction.Left: windItemId = 8114; break;
                }

                creature.MovingEffect(player, windItemId, 5, 1, false, false, 0, 0);
                player.PlaySound(0x64C);

                if (player.NetState != null)
                {
                    player.PrivateOverheadMessage(MessageType.Regular, 0, false, "This candy totally blows...", player.NetState);
                }

                SpecialAbilities.KnockbackSpecialAbility(1.0, creature.Location, null, player, damageAmount, 20, -1, "", "");
                break;

            case 8:
                SpecialAbilities.PetrifySpecialAbility(1.0, null, player, 1.0, 15, -1, true, "", "", "-1");

                if (player.NetState != null)
                {
                    player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Rock candy!", player.NetState);
                }
                break;

            case 9:
                if (player.Poison == null)
                {
                    Poison poison = Poison.GetPoison(2);
                    player.ApplyPoison(null, poison);
                }

                player.FixedEffect(0x372A, 10, 30, 2208, 0);
                Effects.PlaySound(player.Location, player.Map, 0x22F);

                int residueCount = Utility.RandomMinMax(3, 4);

                for (int a = 0; a < residueCount; a++)
                {
                    Point3D poisonPoint = new Point3D(player.Location.X + Utility.RandomList(-1, 1), player.Location.Y + Utility.RandomList(-1, 1), player.Location.Z);
                    SpellHelper.AdjustField(ref poisonPoint, player.Map, 12, false);

                    TimedStatic poisonResidue = new TimedStatic(Utility.RandomList(0x1645, 0x122A, 0x122B, 0x122C, 0x122D, 0x122E, 0x122F), 5);
                    poisonResidue.Hue  = 2208;
                    poisonResidue.Name = "poison residue";
                    poisonResidue.MoveToWorld(poisonPoint, player.Map);
                }

                if (player.NetState != null)
                {
                    player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Poisoned candy! Who would do such a thing!", player.NetState);
                }
                break;

            case 10:
                bool canPolymorph = true;

                if (!player.CanBeginAction(typeof(PolymorphSpell)))
                {
                    canPolymorph = false;
                }

                if (!player.CanBeginAction(typeof(PolymorphPotion)))
                {
                    canPolymorph = false;
                }

                if (!player.CanBeginAction(typeof(IncognitoSpell)) || player.IsBodyMod)
                {
                    canPolymorph = false;
                }

                if (DisguiseTimers.IsDisguised(player))
                {
                    canPolymorph = false;
                }

                if (KinPaint.IsWearingKinPaint(player))
                {
                    canPolymorph = false;
                }

                if (!canPolymorph)
                {
                    player.SendMessage("Hmm...Nothing seems to have happened. Or did it?");
                    return;
                }

                player.FixedParticles(0x373A, 10, 15, 5036, EffectLayer.Head);

                List <int> m_PossibleBodyValues = new List <int>();

                m_PossibleBodyValues.Add(3);     //Zombie
                m_PossibleBodyValues.Add(50);    //Skeleton
                m_PossibleBodyValues.Add(56);    //Skeleton
                m_PossibleBodyValues.Add(153);   //Ghoul
                m_PossibleBodyValues.Add(302);   //Skeletal Critter
                m_PossibleBodyValues.Add(309);   //Patchwork Skeleton
                m_PossibleBodyValues.Add(148);   //Necromancer
                m_PossibleBodyValues.Add(793);   //Skeletal Horse
                m_PossibleBodyValues.Add(317);   //Giant Bat
                m_PossibleBodyValues.Add(252);   //Corpse Bride
                m_PossibleBodyValues.Add(57);    //Skeletal Knight
                m_PossibleBodyValues.Add(116);   //Nightmare
                m_PossibleBodyValues.Add(24);    //Lich
                m_PossibleBodyValues.Add(154);   //Mummy
                m_PossibleBodyValues.Add(104);   //Skeletal Drake
                m_PossibleBodyValues.Add(740);   //Skeletal Drake
                m_PossibleBodyValues.Add(308);   //Giant Skeleton

                player.BodyMod = m_PossibleBodyValues[Utility.RandomMinMax(0, m_PossibleBodyValues.Count - 1)];
                player.HueMod  = 0;

                player.PlaySound(0x3BD);

                BaseArmor.ValidateMobile(player);

                duration = 120;

                player.BeginAction(typeof(PolymorphPotion));
                Timer.DelayCall(TimeSpan.FromSeconds(duration), delegate
                {
                    if (player == null)
                    {
                        return;
                    }

                    player.EndAction(typeof(PolymorphPotion));
                });

                player.BeginAction(typeof(PolymorphSpell));
                Timer.DelayCall(TimeSpan.FromSeconds(duration), delegate
                {
                    if (player == null)
                    {
                        return;
                    }

                    player.BodyMod = 0;
                    player.HueMod  = -1;
                    player.EndAction(typeof(PolymorphSpell));

                    BaseArmor.ValidateMobile(player);
                });

                if (player.NetState != null)
                {
                    player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Hmm, something tastes odd about this candy.", player.NetState);
                }
                break;

            case 11:
                Item innerLegs = player.FindItemOnLayer(Layer.InnerLegs);
                Item outerLegs = player.FindItemOnLayer(Layer.OuterLegs);
                Item pants     = player.FindItemOnLayer(Layer.Pants);

                int layersFound = 0;

                if (innerLegs != null)
                {
                    player.Backpack.DropItem(innerLegs);
                    layersFound++;
                }

                if (outerLegs != null)
                {
                    player.Backpack.DropItem(outerLegs);
                    layersFound++;
                }

                if (pants != null)
                {
                    player.Backpack.DropItem(pants);
                    layersFound++;
                }

                if (layersFound > 0)
                {
                    player.PlaySound(0x503);

                    if (player.NetState != null)
                    {
                        player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Your pants appear to have fallen down. How embarrassing!", player.NetState);
                    }
                }

                else
                {
                    player.SendMessage("Nothing seems to have happened. Or did it?...");
                }
                break;

            case 12:

                player.FixedParticles(0x374A, 10, 15, 5028, 2604, 0, EffectLayer.Waist);
                player.PlaySound(0x5DA);

                player.Animate(22, 6, 1, true, false, 0);     //Fall Forward

                player.Stam = 0;

                if (player.NetState != null)
                {
                    player.PrivateOverheadMessage(MessageType.Regular, 0, false, "You feel drowsy and fall on your face!", player.NetState);
                }
                break;

            case 13:
                player.BAC = 60;
                player.PlaySound(0x5A9);

                BaseBeverage.CheckHeaveTimer(player);

                player.Animate(34, 5, 1, true, false, 0);

                if (player.NetState != null)
                {
                    player.PrivateOverheadMessage(MessageType.Regular, 0, false, "What was in that candy??? *hic*", player.NetState);
                }
                break;

            case 14:
                Warp(creature, player);
                break;

            case 15:
                Warp(creature, player);
                break;
            }
        }