DoHarmful() public method

public DoHarmful ( Mobile target, bool indirect ) : void
target Mobile
indirect bool
return void
Ejemplo n.º 1
0
        public override void DoEffect(BaseCreature creature, Mobile m)
        {
            AuraDefinition def = AuraDefinition.GetDefinition(creature);

            if (def.Damage > 0)
            {
                AOS.Damage(
                    m,
                    creature,
                    def.Damage,
                    def.Physical,
                    def.Fire,
                    def.Cold,
                    def.Poison,
                    def.Energy,
                    def.Chaos,
                    def.Direct,
                    DamageType.SpellAOE);

                creature.DoHarmful(m); // Need to re-look at this.
                m.RevealingAction();
            }

            if (creature is IAuraCreature auraCreature)
            {
                auraCreature.AuraEffect(m);
            }
        }
Ejemplo n.º 2
0
        public override void DoEffects(BaseCreature creature, Mobile defender, ref int damage)
        {
            if (creature.Map == null)
            {
                return;
            }

            List <Mobile>     list  = new List <Mobile>();
            IPooledEnumerable eable = creature.GetMobilesInRange(8);

            foreach (Mobile m in eable)
            {
                if (AreaEffect.ValidTarget(creature, m))
                {
                    list.Add(m);
                }
            }

            eable.Free();

            foreach (Mobile m in list)
            {
                creature.DoHarmful(m, false);

                m.FixedParticles(0x374A, 10, 15, 5013, 0x496, 0, EffectLayer.Waist);
                m.PlaySound(0x231);

                m.SendMessage("You feel the mana drain out of you!");

                int toDrain = Utility.RandomMinMax(40, 60);

                creature.Mana += toDrain;
                m.Mana        -= toDrain;
            }
        }
Ejemplo n.º 3
0
        public override void DoEffect(BaseCreature creature, Mobile defender)
        {
            AOS.Damage(defender, creature, Utility.RandomMinMax(20, 30), 100, 0, 0, 0, 0);

            creature.DoHarmful(defender);
            defender.FixedParticles(0x374A, 10, 30, 5052, 1836, 0, EffectLayer.Waist);
            defender.PlaySound(0x22C);
        }
Ejemplo n.º 4
0
        public override void DoEffect(BaseCreature creature, Mobile defender)
        {
            AOS.Damage(defender, creature, Utility.RandomMinMax(20, 30), 0, 0, 0, 100, 0);

            defender.SendLocalizedMessage(1072074, false, creature.Name);
            creature.DoHarmful(defender);
            defender.FixedParticles(0x374A, 10, 30, 5052, 1272, 0, EffectLayer.Waist);
            defender.PlaySound(0x476);
        }
Ejemplo n.º 5
0
        public override void DoEffect(BaseCreature creature, Mobile defender)
        {
            AOS.Damage(defender, creature, Utility.RandomMinMax(20, 30), 0, 0, 0, 0, 100);

            defender.SendLocalizedMessage(1072073, false, creature.Name); //  : The creature's aura of energy is damaging you!
            creature.DoHarmful(defender);
            defender.FixedParticles(0x374A, 10, 30, 5052, 1278, 0, EffectLayer.Waist);
            defender.PlaySound(0x51D);
        }
Ejemplo n.º 6
0
        public override void DoEffect(BaseCreature creature, Mobile m)
        {
            m.ApplyPoison(creature, creature.HitAreaPoison);

            Server.Effects.SendLocationParticles(
                EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x36B0, 1, 14, 63, 7, 9915, 0);

            Server.Effects.PlaySound(m.Location, m.Map, 0x229);

            if (creature.AreaPoisonDamage > 0)
            {
                creature.DoHarmful(m);
                AOS.Damage(m, creature, creature.AreaPoisonDamage, 0, 0, 0, 100, 0);
            }
        }
Ejemplo n.º 7
0
        public static void DetonateShipBomb(BaseCreature creature, BaseShip targetShip, Point3D location)
        {
            IEntity explosionLocation = new Entity(Serial.Zero, new Point3D(location.X, location.Y, location.Z - 1), targetShip.Map);

            Effects.SendLocationParticles(explosionLocation, Utility.RandomList(0x36BD, 0x36BF, 0x36CB, 0x36BC), 30, 7, 5044);
            Effects.PlaySound(explosionLocation, targetShip.Map, 0x11D);

            BaseShip shipAtLocation = BaseShip.FindShipAt(location, targetShip.Map);

            if (shipAtLocation != null)
            {
                int shipDamage = Utility.RandomMinMax(10, 20);

                shipAtLocation.ReceiveDamage(null, null, shipDamage, DamageType.Hull);

                int mobileDamage = Utility.RandomMinMax(10, 20);

                IPooledEnumerable eable = targetShip.Map.GetObjectsInRange(location, 1);

                foreach (object obj in eable)
                {
                    if (obj is Mobile)
                    {
                        Mobile mobile = obj as Mobile;

                        if (creature.CanBeHarmful(mobile))
                        {
                            int finalDamage = mobileDamage;

                            PlayerMobile pm_Target = mobile as PlayerMobile;

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

                eable.Free();
            }
        }
Ejemplo n.º 8
0
        public override void DoEffect(BaseCreature creature, Mobile defender)
        {
            Timer.DelayCall <Mobile>(TimeSpan.FromMilliseconds(Utility.RandomMinMax(10, 1000)), m =>
            {
                if (m.Alive && !m.Deleted && m.Map != null)
                {
                    Point3D p = m.Location;
                    for (int x = -1; x <= 1; x++)
                    {
                        for (int y = -1; y <= 1; y++)
                        {
                            Server.Effects.SendLocationEffect(new Point3D(p.X + x, p.Y + y, p.Z), m.Map, 0x3728, 13, 1921, 3);
                        }
                    }

                    creature.DoHarmful(defender);
                    AOS.Damage(m, creature, Utility.RandomMinMax(30, 40), 0, 100, 0, 0, 0);
                    m.SendLocalizedMessage(1112366); // The flammable goo covering you bursts into flame!
                }
            }, defender);
        }
Ejemplo n.º 9
0
        public static void DoBreathAttack(BreathAttackType breathType, BaseCreature creature, Mobile target)
        {
            if (!SpecialAbilities.Exists(creature))
            {
                return;
            }
            if (!SpecialAbilities.Exists(target))
            {
                return;
            }
            if (!creature.CanBeHarmful(target))
            {
                return;
            }

            creature.DoHarmful(target);
            creature.Direction = creature.GetDirectionTo(target);

            if (creature.IsHighSeasBodyType)
            {
                creature.Animate(Utility.RandomList(27), 5, 1, true, false, 0);
            }
            else
            {
                creature.Animate(12, 5, 1, true, false, 0);
            }

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

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

                switch (breathType)
                {
                case BreathAttackType.Fire:
                    Effects.PlaySound(creature.Location, creature.Map, 0x227);
                    Effects.SendMovingEffect(creature, target, 0x36D4, 5, 0, false, false, 0, 0);
                    break;

                case BreathAttackType.Ice:
                    Effects.PlaySound(creature.Location, creature.Map, 0x64F);
                    Effects.SendMovingEffect(creature, target, 0x36D4, 5, 0, false, false, 1153, 0);
                    break;

                case BreathAttackType.Poison:
                    Effects.PlaySound(creature.Location, creature.Map, 0x22F);
                    Effects.SendMovingEffect(creature, target, 0x372A, 10, 0, false, false, 2208, 0);
                    break;
                }

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

                    if (creature.CanBeHarmful(target))
                    {
                        double baseDamage = (double)creature.DamageMax;

                        if (creature.Controlled && creature.ControlMaster is PlayerMobile)
                        {
                            if (target is PlayerMobile)
                            {
                                baseDamage *= BaseCreature.BreathDamageToPlayerScalar * creature.PvPAbilityDamageScalar;
                            }

                            if (target is BaseCreature)
                            {
                                baseDamage *= BaseCreature.BreathDamageToCreatureScalar;
                            }
                        }

                        switch (breathType)
                        {
                        case BreathAttackType.Fire:
                            Effects.PlaySound(target.Location, target.Map, 0x208);
                            Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, TimeSpan.FromSeconds(0.5)), 0x3996, 10, 20, 5029);
                            break;

                        case BreathAttackType.Ice:
                            baseDamage = (double)creature.DamageMax * .75;

                            if (target is PlayerMobile)
                            {
                                SpecialAbilities.CrippleSpecialAbility(1.0, creature, target, .05, 10, -1, true, "", "The blast of ice has slowed your actions!", "-1");
                            }
                            else
                            {
                                SpecialAbilities.CrippleSpecialAbility(1.0, creature, target, .10, 10, -1, true, "", "The blast of ice has slowed your actions!", "-1");
                            }

                            Effects.PlaySound(target.Location, target.Map, 0x208);
                            Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, TimeSpan.FromSeconds(0.25)), 0x3779, 10, 20, 1153, 0, 5029, 0);
                            break;

                        case BreathAttackType.Poison:
                            baseDamage = (double)creature.DamageMax * .5;

                            int poisonLevel = 0;

                            if (creature.HitPoison != null)
                            {
                                poisonLevel = creature.HitPoison.Level;
                            }

                            double poisonChance = 1.0;

                            if (creature.IsControlledCreature())
                            {
                                if (target is PlayerMobile)
                                {
                                    poisonChance = .5;
                                    poisonLevel--;
                                }

                                if (target is BaseCreature)
                                {
                                    BaseCreature bc_Target = target as BaseCreature;

                                    if (bc_Target.IsControlledCreature())
                                    {
                                        poisonChance = .5;
                                        poisonLevel--;
                                    }
                                }
                            }

                            if (poisonLevel < 0)
                            {
                                poisonLevel = 0;
                            }

                            int poisonHue = 2208;

                            poisonHue += poisonLevel;

                            if (Utility.RandomDouble() <= poisonChance)
                            {
                                Poison poison = Poison.GetPoison(poisonLevel);
                                target.ApplyPoison(target, poison);
                            }

                            Effects.PlaySound(target.Location, target.Map, 0x22F);
                            Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, TimeSpan.FromSeconds(0.25)), 0x372A, 10, 20, poisonHue, 0, 5029, 0);
                            break;
                        }

                        int finalDamage = (int)baseDamage;

                        if (target != null)
                        {
                            AOS.Damage(target, creature, finalDamage, 100, 0, 0, 0, 0);
                        }
                    }
                });
            });
        }
Ejemplo n.º 10
0
        public static bool DoMeleeBleedAoE(BaseCreature creature)
        {
            if (creature == null)
            {
                return(false);
            }

            double swingCount    = 12;
            double swingInterval = .3;
            double preSwingDelay = .1;

            double hitChance = .25;

            double actionsCooldown = (swingCount * swingInterval) + (swingCount * preSwingDelay) + 1;

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

            for (int a = 0; a < swingCount; a++)
            {
                double delay = (a * swingInterval) + (a * preSwingDelay);

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

                    if (!creature.Alive || creature.Paralyzed || creature.Frozen)
                    {
                        return;
                    }

                    Effects.PlaySound(creature.Location, creature.Map, 0x51F);

                    int newDirectionValue = (int)creature.Direction;
                    newDirectionValue    += Utility.RandomList(-3, -4, -5, 3, 4, 5);

                    if (newDirectionValue > 7)
                    {
                        newDirectionValue = 0 + (newDirectionValue - 8);
                    }
                    else if (newDirectionValue < 0)
                    {
                        newDirectionValue = 8 + newDirectionValue;
                    }

                    creature.Direction = (Direction)(newDirectionValue);

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

                        if (!creature.Alive || creature.Paralyzed || creature.Frozen)
                        {
                            return;
                        }

                        BaseWeapon weapon = creature.Weapon as BaseWeapon;

                        if (weapon != null)
                        {
                            weapon.PlaySwingAnimation(creature);

                            IPooledEnumerable eable = creature.Map.GetObjectsInRange(creature.Location, 1);

                            foreach (object obj in eable)
                            {
                                if (obj is Mobile)
                                {
                                    Mobile mobile = obj as Mobile;

                                    if (creature == null || mobile == null)
                                    {
                                        continue;
                                    }

                                    if (!creature.Alive || !mobile.Alive)
                                    {
                                        continue;
                                    }

                                    if (creature == mobile)
                                    {
                                        continue;
                                    }

                                    if (creature.CanBeHarmful(mobile))
                                    {
                                        BaseCreature bc_CreatureTarget = mobile as BaseCreature;

                                        bool validCreatureTarget = false;

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

                                        //Valid Targets
                                        if (mobile == creature.Combatant || mobile is PlayerMobile || validCreatureTarget)
                                        {
                                            if (a == 0 || Utility.RandomDouble() < hitChance)
                                            {
                                                int damage = Utility.RandomMinMax(creature.DamageMin, creature.DamageMax);

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

                                                creature.DoHarmful(mobile);

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

                                                double bleedValue = bc_Mobile.GetSpecialAbilityEntryValue(SpecialAbilityEffect.Bleed);

                                                if (bleedValue == 0)
                                                {
                                                    SpecialAbilities.BleedSpecialAbility(1.0, creature, mobile, creature.DamageMax, 8.0, -1, true, "", "Their attack causes you to bleed!", "-1");
                                                }

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

                            eable.Free();
                        }
                    });
                });
            }

            return(true);
        }