Beispiel #1
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);
                        }
                    }
                });
            });
        }