예제 #1
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);
                            });
                        }
                    }
                }
            }
        }
예제 #2
0
        public void ThrowSkull(BaseCreature creature)
        {
            if (creature == null)
            {
                return;
            }
            if (creature.Deleted || !creature.Alive)
            {
                return;
            }

            if (creature.Combatant != null)
            {
                Mobile  combatant = creature.Combatant;
                Point3D location  = creature.Location;
                Map     map       = creature.Map;

                if (combatant.Alive && creature.InLOS(combatant) && creature.GetDistanceToSqrt(combatant) <= 12)
                {
                    Animate(4, 4, 1, true, false, 0);

                    double stationaryDuration = 3;

                    creature.CantWalk = true;
                    creature.Frozen   = true;

                    creature.AIObject.NextMove              = creature.AIObject.NextMove + TimeSpan.FromSeconds(stationaryDuration);
                    creature.LastSwingTime                  = creature.LastSwingTime + TimeSpan.FromSeconds(stationaryDuration);
                    creature.NextSpellTime                  = creature.NextSpellTime + TimeSpan.FromSeconds(stationaryDuration);
                    creature.NextCombatHealActionAllowed    = creature.NextCombatHealActionAllowed + TimeSpan.FromSeconds(stationaryDuration);
                    creature.NextCombatSpecialActionAllowed = creature.NextCombatSpecialActionAllowed + TimeSpan.FromSeconds(stationaryDuration);
                    creature.NextCombatEpicActionAllowed    = creature.NextCombatEpicActionAllowed + TimeSpan.FromSeconds(stationaryDuration);

                    IEntity startLocation = new Entity(Serial.Zero, new Point3D(creature.Location.X, creature.Location.Y, creature.Location.Z + 8), map);

                    int attackSound = 0x5D3;
                    int hitSound    = 0x653;

                    Effects.PlaySound(location, map, attackSound);
                    creature.MovingEffect(combatant, 8707, 8, 1, false, false, 2612, 0);

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

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

                        creature.CantWalk = false;
                        creature.Frozen   = false;

                        m_NextThrownSkullAllowed = DateTime.UtcNow + NextThrownSkullDelay;

                        if (!SpecialAbilities.IsDamagable(combatant))
                        {
                            return;
                        }

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

                        Effects.SendLocationParticles(EffectItem.Create(combatant.Location, map, TimeSpan.FromSeconds(0.25)), 0x3709, 10, 20, 2613, 0, 5029, 0);
                        Effects.SendLocationParticles(EffectItem.Create(combatant.Location, map, TimeSpan.FromSeconds(0.25)), 0x3779, 10, 60, 2613, 0, 5029, 0);
                        Effects.SendLocationParticles(EffectItem.Create(combatant.Location, map, TimeSpan.FromSeconds(0.5)), 0x3996, 10, 60, 2613, 0, 5029, 0);

                        BaseCreature monsterToSpawn = null;

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

                        int creatureCount = 1 + (int)(Math.Ceiling(3 * spawnPercent));

                        for (int a = 0; a < creatureCount; a++)
                        {
                            switch (Utility.RandomMinMax(1, 10))
                            {
                            case 1: monsterToSpawn = new Skeleton(); break;

                            case 2: monsterToSpawn = new Skeleton(); break;

                            case 3: monsterToSpawn = new Skeleton(); break;

                            case 4: monsterToSpawn = new PatchworkSkeleton(); break;

                            case 5: monsterToSpawn = new PatchworkSkeleton(); break;

                            case 6: monsterToSpawn = new SkeletalKnight(); break;

                            case 7: monsterToSpawn = new UndeadKnight(); break;

                            case 8: monsterToSpawn = new RisenKnight(); break;

                            case 9: monsterToSpawn = new RisenNoble(); break;

                            case 10: monsterToSpawn = new SkeletalDrake(); break;
                            }

                            if (monsterToSpawn != null)
                            {
                                monsterToSpawn.BossMinion = true;
                                monsterToSpawn.MoveToWorld(combatant.Location, combatant.Map);
                                monsterToSpawn.BossMinion = true;

                                m_Creatures.Add(monsterToSpawn);
                            }
                        }

                        for (int a = 0; a < 5; a++)
                        {
                            Blood bones           = new Blood();
                            bones.Name            = "bones";
                            bones.ItemID          = Utility.RandomList(6929, 6930, 6937, 6938, 6933, 6934, 6935, 6936, 6939, 6940, 6880, 6881, 6882, 6883);
                            Point3D bonesLocation = new Point3D(combatant.Location.X + Utility.RandomList(-1, 1), combatant.Location.Y + Utility.RandomList(-1, 1), combatant.Location.Z);
                            bones.MoveToWorld(bonesLocation, map);
                        }

                        int damage = creature.DamageMin;

                        if (combatant is BaseCreature)
                        {
                            damage = (int)((double)damage * 1.5);
                        }

                        new Blood().MoveToWorld(combatant.Location, combatant.Map);
                        AOS.Damage(combatant, creature, damage, 0, 100, 0, 0, 0);
                    });
                }
            }
        }
예제 #3
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);
                            });
                        }
                    }
                }
            }
        }