public async Task OnTargetAsync(ITargetResponse <IPoint3D> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var point = SpellHelper.GetSurfaceTop(response.Target);

            var range = Caster.Skills[SkillName.Magery].Value / 15.0;

            Caster.FireHook(h => h.OnModifyWithMagicEfficiency(Caster, ref range));

            var eable = Caster.Map.GetMobilesInRange(point, (int)range);

            foreach (var target in eable)
            {
                if (!SpellHelper.ValidIndirectTarget(Caster, target) ||
                    !Caster.CanBeHarmful(target, false) ||
                    !Caster.InLOS(target)
                    )
                {
                    continue;
                }

                var damage = SpellHelper.CalcSpellDamage(Caster, target, this, true);
                target.BoltEffect(0);
                SpellHelper.Damage(damage, target, Caster, this);
            }
            eable.Free();

            Caster.PlaySound(0x29);
        }
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            SpellHelper.Turn(Caster, target);

            var damage = SpellHelper.CalcSpellDamage(Caster, target, this);

            target.FixedParticles(0x3789, 10, 10, 5028, EffectLayer.Waist);
            target.PlaySound(0x020D);

            SpellHelper.Damage(damage, target, Caster, this);

            if (!Caster.CanBuff(target, true, BuffIcon.Clumsy, BuffIcon.Agility))
            {
                return;
            }

            target.TryAddBuff(new StatBuff(StatType.Dex)
            {
                Value    = SpellHelper.GetModAmount(Caster, target, StatType.Dex) * -1,
                Duration = SpellHelper.GetDuration(Caster, target),
            });
        }
Пример #3
0
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            SpellHelper.Turn(Caster, target);

            var damage = SpellHelper.CalcSpellDamage(Caster, target, this);

            target.FixedParticles(0x37CC, 30, 30, 5028, EffectLayer.Waist);
            target.PlaySound(0x0107);
            target.PlaySound(0x0108);

            SpellHelper.Damage(damage, target, Caster, this);

            var magery = Caster.Skills[SkillName.Magery].Value / 10;

            // TODO: Check for cursed to amplify magery?

            var kickbackX = Utility.Random((int)magery) - (int)(magery / 2);
            var kickbackY = Utility.Random((int)magery) - (int)(magery / 2);

            var newTargetLocation = new Point3D(target.Location.X + kickbackX, target.Location.Y + kickbackY,
                                                target.Location.Z);
            var map = target.Map;

            if (map.LineOfSight(Caster, newTargetLocation) && map.CanSpawnMobile(newTargetLocation))
            {
                target.Location = newTargetLocation;
            }
        }
Пример #4
0
        private void DealDamage(Mobile target)
        {
            var damage = SpellHelper.CalcSpellDamage(Caster, target, this, true);

            SpellHelper.Damage(damage, target, Caster, this);
            Effects.PlaySound(Caster.Location, Caster.Map, 0x160);

            Caster.MovingParticles(target, 0x36D4, 7, 0, false, true, 9501, 1, 0, 0x100);
        }
Пример #5
0
        public async Task CastAsync()
        {
            var range = Caster.Skills[SkillName.Magery].Value / 20.0;

            Caster.FireHook(h => h.OnModifyWithMagicEfficiency(Caster, ref range));

            var mobiles = Caster.GetMobilesInRange((int)range);

            var casterHouse = BaseHouse.FindHouseAt(Caster);

            Caster.PlaySound(544);

            foreach (var target in mobiles)
            {
                if (target == Caster ||
                    !SpellHelper.ValidIndirectTarget(Caster, target) ||
                    !Caster.CanBeHarmful(target, false)
                    )
                {
                    continue;
                }

                if (BaseHouse.FindHouseAt(target) is { } targetHouse&&
                    casterHouse == targetHouse &&
                    Caster.Location.Z != target.Location.Z &&
                    target.Location.Z >= Caster.Location.Z + 10
                    )
                {
                    continue;
                }

                SpellHelper.Damage(SpellHelper.CalcSpellDamage(Caster, target, this, true), target, Caster, this);
                target.PrivateOverheadMessage(
                    MessageType.Regular,
                    0x3B2,
                    true,
                    "You are tossed about as the earth trembles below your feet!",
                    target.NetState
                    );
            }
            mobiles.Free();

            await Timer.Pause(2000);

            Caster.PlaySound(546);

            // Wall destroyer
            var eable = Caster.GetItemsInRange((int)range);

            foreach (var item in eable)
            {
                if (item is not IDispellable {
                    Dispellable: true
                })
Пример #6
0
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            SpellHelper.Turn(Caster, target);

            var multiplier = target is BaseCreature ? 2.0 : 1.0;

            Caster.FireHook(h => h.OnModifyWithMagicEfficiency(Caster, ref multiplier));

            var damage      = SpellHelper.CalcSpellDamage(Caster, target, this);
            var protection  = (int)GetProtectionLevelForResist(target.GetResist(Info.DamageType));
            var instantKill = (int)(Caster.Skills.Magery.Value * multiplier / 3);

            if (protection > 0)
            {
                instantKill -= (int)(instantKill * protection * 0.25);
                if (instantKill < 1)
                {
                    instantKill = 1;
                }
            }

            target.FixedParticles(0x375B, 1, 16, 5044, EffectLayer.Waist);
            target.PlaySound(0x201);

            if (target.Hits <= instantKill)
            {
                target.Damage(target.HitsMax); // Raw damage
            }
            else if (target.Hits <= instantKill * 1.5)
            {
                var victimSkill  = target.Skills.MagicResist.Value;
                var resistChance = (int)(victimSkill / multiplier) - (Caster.Skills.EvalInt.Value / 3);
                if (Utility.RandomMinMax(1, 100) <= resistChance)
                {
                    SpellHelper.Damage(damage, target, Caster, this);
                }
                else
                {
                    target.Damage(target.HitsMax); // Raw damage
                }
            }
            else
            {
                SpellHelper.Damage(damage, target, Caster, this);
            }
        }
Пример #7
0
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            SpellHelper.Turn(Caster, target);
            Caster.MovingParticles(target, 0x36D4, 7, 0, false, true, 9502, 4019, 0x160);
            Caster.PlaySound(0x44B);

            SpellHelper.Damage(SpellHelper.CalcSpellDamage(Caster, target, this), target, Caster, this);
        }
Пример #8
0
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            SpellHelper.Turn(Caster, target);

            var damage = SpellHelper.CalcSpellDamage(Caster, target, this);

            target.BoltEffect(0);

            SpellHelper.Damage(damage, target, Caster, this);
        }
Пример #9
0
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            SpellHelper.Turn(Caster, target);


            var damage = SpellHelper.CalcSpellDamage(Caster, target, this);
            var magery = Caster.Skills.Magery.Value;
            var plvl   = magery / 40.0 + 1.0;

            Caster.FireHook(h => h.OnModifyWithMagicEfficiency(Caster, ref plvl));
            var max = 4.0;

            Caster.FireHook(h => h.OnModifyWithMagicEfficiency(Caster, ref max));

            plvl = SpellHelper.TryResistDamage(Caster, target, Circle, (int)plvl);

            if (plvl > max)
            {
                plvl = max;
            }

            var protection = target.GetResist(Info.DamageType);

            if (protection > 0)
            {
                plvl -= (int)(plvl * protection);
                if (plvl < 1)
                {
                    plvl = 0;
                }
            }

            SpellHelper.Damage(damage, target, Caster, this);
            if (plvl > 0)
            {
                target.ApplyPoison(Caster, Poison.GetPoison(Math.Min((int)plvl, Poison.Poisons.Count - 1)));
            }
        }
Пример #10
0
        private async void RaiseFire(Mobile target)
        {
            target.FixedParticles(0x3709, 10, 30, 5052, EffectLayer.LeftFoot);

            await Timer.Pause(250);

            target.FixedParticles(0x3709, 10, 30, 5052, EffectLayer.LeftFoot);
            target.PlaySound(0x208);

            await Timer.Pause(250);

            target.FixedParticles(0x3709, 10, 30, 5052, EffectLayer.LeftFoot);
            target.PlaySound(0x208);

            var damage = SpellHelper.CalcSpellDamage(Caster, target, this);

            SpellHelper.Damage(damage / 2, target, Caster, this);
        }
Пример #11
0
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            SpellHelper.Turn(Caster, target);

            target.FixedParticles(0x37C4, 10, 15, 5013, EffectLayer.Waist);
            target.PlaySound(0x1F1);

            var damage = SpellHelper.CalcSpellDamage(Caster, target, this);

            SpellHelper.Damage(damage, target, Caster, this);
        }
Пример #12
0
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var mobile = response.Target;

            SpellHelper.Turn(Caster, mobile);

            Caster.MovingParticles(mobile, 0x36E4, 5, 0, false, false, 3006, 0, 0);
            Caster.PlaySound(0x1E5);

            var damage = SpellHelper.CalcSpellDamage(Caster, mobile, this);

            SpellHelper.Damage(damage, mobile, Caster, this);
        }
Пример #13
0
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            SpellHelper.Turn(Caster, target);

            // Do the effects
            Caster.MovingParticles(target, 0x379F, 7, 0, false, true, 3043, 4043, 0x211);
            Caster.PlaySound(0x20A);

            var damage = SpellHelper.CalcSpellDamage(Caster, target, this);

            SpellHelper.Damage(damage, target, Caster, this);
        }
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            SpellHelper.Turn(Caster, target);

            Caster.MovingEffect(target, 0x36D5, 5, 0, false, false);
            var damage = SpellHelper.CalcSpellDamage(Caster, target, this);

            SpellHelper.Damage(damage, target, Caster, this);

            await Timer.Pause(500);

            var range = Caster.Skills[CastSkill].Value / 15.0;

            Caster.FireHook(h => h.OnModifyWithMagicEfficiency(Caster, ref range));

            var eable = Caster.GetMobilesInRange((int)range);

            foreach (var mobile in eable)
            {
                if (Caster == mobile ||
                    !SpellHelper.ValidIndirectTarget(Caster, mobile) ||
                    !Caster.CanBeHarmful(mobile, false) ||
                    !Caster.InLOS(mobile))
                {
                    continue;
                }

                SpellHelper.Damage(damage / 2, mobile, Caster, this);
                mobile.FixedParticles(0x36BD, 20, 10, 5030, EffectLayer.Head);
                mobile.PlaySound(0x307);
            }
            eable.Free();
        }
        private static async void Cast(Mobile caster, Mobile defender)
        {
            var damage = SpellHelper.CalcSpellDamage(caster, defender, SpellCircle.Third);

            caster.MovingParticles(defender, 0x36D4, 7, 0, false, true, 9502, 4019, 0x160);
            caster.PlaySound(0x44B);

            await Timer.Pause(250);

            damage += SpellHelper.CalcSpellDamage(caster, defender, SpellCircle.Third);

            defender.BoltEffect(0);

            await Timer.Pause(250);

            damage += SpellHelper.CalcSpellDamage(caster, defender, SpellCircle.Third);

            defender.FixedParticles(0x3789, 30, 30, 5028, EffectLayer.Waist);
            defender.PlaySound(0x0116);
            defender.PlaySound(0x0117);

            SpellHelper.Damage(damage, defender, caster, null, TimeSpan.Zero, ElementalType.None);
        }
        public async Task OnTargetAsync(ITargetResponse <IPoint3D> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var point = SpellHelper.GetSurfaceTop(response.Target);

            SpellHelper.Turn(Caster, point);

            var range = Caster.Skills.Magery.Value / 30.0;

            Caster.FireHook(h => h.OnModifyWithMagicEfficiency(Caster, ref range));

            var eable = Caster.Map.GetMobilesInRange(point, (int)range);

            foreach (var mobile in eable)
            {
                if (Caster == mobile ||
                    !SpellHelper.ValidIndirectTarget(Caster, mobile) ||
                    !Caster.CanBeHarmful(mobile, false) ||
                    !Caster.InLOS(mobile))
                {
                    continue;
                }

                var damage = SpellHelper.CalcSpellDamage(Caster, mobile, this, true);

                SpellHelper.Damage(damage, mobile, Caster, this);
                mobile.FixedParticles(0x37C4, 10, 15, 5013, EffectLayer.Waist);
                mobile.PlaySound(0x1F1);
            }

            eable.Free();
        }
Пример #17
0
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            SpellHelper.Turn(Caster, target);

            var casterInt = (double)Caster.Int;

            Caster.FireHook(h => h.OnModifyWithMagicEfficiency(Caster, ref casterInt));

            var targetInt = (double)target.Int;

            target.FireHook(h => h.OnModifyWithMagicEfficiency(target, ref targetInt));

            if (targetInt > casterInt)
            {
                target.FixedEffect(0x374B, 10, 10);
                target.PlaySound(0x1E7);
            }
            else if (Math.Abs(targetInt - casterInt) < 1.0)
            {
                Caster.SendMessage("You are of equal intellect!");
                return;
            }

            Caster.FixedParticles(0x374A, 10, 15, 2038, EffectLayer.Head);
            target.FixedParticles(0x374A, 10, 15, 5038, EffectLayer.Head);
            target.PlaySound(0x213);

            SpellHelper.Damage(SpellHelper.CalcSpellDamage(Caster, target, this), target, Caster, this);
        }
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            SpellHelper.Turn(Caster, target);

            target.PlaySound(0x11);

            var point = SpellHelper.GetSurfaceTop(target.Location);
            var map   = target.Map;

            target.FixedParticles(0x3709, 10, 30, 5052, EffectLayer.LeftFoot);
            target.PlaySound(0x208);

            var manaStolen = (double)target.Mana;

            Caster.FireHook(h => h.OnModifyWithMagicEfficiency(Caster, ref manaStolen));
            manaStolen = SpellHelper.TryResistDamage(Caster, target, Circle, (int)manaStolen);

            if (manaStolen > target.Mana)
            {
                manaStolen = target.Mana;
            }

            // Note: Slight deviation from ZH3 here; Making this work more like Mana drain/vampire instead of using an explicit class check
            var amount = SpellHelper.TryResistDamage(Caster, target, SpellCircle.Seventh, (int)manaStolen);

            if (amount > target.Mana)
            {
                amount = target.Mana;
            }

            target.Mana -= amount;
            Caster.Mana += amount;

            var damage = SpellHelper.CalcSpellDamage(Caster, target, this);

            SpellHelper.Damage(damage / 2, target, Caster, this);

            await Timer.Pause(500);

            Caster.PlaySound(0x217);

            // Water column
            for (var z = 10; z >= 0; z--)
            {
                var loc = new Point3D(point.X, point.Y, point.Z + z * 10);

                EffectItem.Create(loc, map, TimeSpan.FromSeconds(5)).ItemID = WaterfallEw;
                EffectItem.Create(loc, map, TimeSpan.FromSeconds(5)).ItemID = WaterfallNs;
                await Timer.Pause(50);
            }

            // Water pool
            var poolNum = 0;

            for (var y = -1; y <= 1; y++)
            {
                for (var x = -1; x <= 1; x++)
                {
                    var loc = new Point3D(point.X + x, point.Y + y, point.Z);
                    EffectItem.Create(loc, map, TimeSpan.FromSeconds(10)).ItemID = Pool[poolNum];
                    poolNum++;
                }
            }

            Effects.PlaySound(point, map, 0x10);

            if (!target.Deleted && target.Alive)
            {
                SpellHelper.Damage(damage / 2, target, Caster, this);
            }
        }