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

            var target = response.Target;

            if (!Caster.CanBuff(target, true, BuffIcon.Protection, BuffIcon.ArchProtection, BuffIcon.Resilience))
            {
                return;
            }

            target.TryAddBuff(new ArmorBuff
            {
                ArmorMod = (int)(SpellHelper.GetModAmount(Caster, target) / 2.0),
                Duration = SpellHelper.GetDuration(Caster, target),
            });

            SpellHelper.Turn(Caster, target);

            target.FixedParticles(0x373B, 9, 20, 5027, EffectLayer.Waist);
            target.PlaySound(0x1ED);
        }
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            SpellHelper.Turn(Caster, target);

            if (!Caster.CanBuff(target, true, BuffIcon.NightSight, BuffIcon.Shadow))
            {
                return;
            }

            target.TryAddBuff(new NightSight
            {
                Value    = LightCycle.DayLevel,
                Duration = TimeSpan.FromSeconds(Caster.Skills.Magery.Value * 60),
            });

            target.FixedParticles(0x376A, 9, 32, 5007, EffectLayer.Waist);
            target.PlaySound(0x1E3);
        }
Beispiel #3
0
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            if (!Caster.CanBuff(target, icons: BuffIcon.Cunning))
            {
                return;
            }

            target.TryAddBuff(new StatBuff(StatType.Int)
            {
                Value    = SpellHelper.GetModAmount(Caster, target, StatType.Int),
                Duration = SpellHelper.GetDuration(Caster, target),
            });

            SpellHelper.Turn(Caster, target);

            target.FixedParticles(0x375A, 10, 15, 5011, EffectLayer.Head);
            target.PlaySound(0x1EB);
        }
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            if (!Caster.CanBuff(target, icons: BuffIcon.ReactiveArmor))
            {
                return;
            }

            var charges  = Caster.Skills[SkillName.Magery].Value / 15;
            var duration = Caster.Skills[SkillName.Magery].Value / 5;

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

            target.TryAddBuff(new ReactiveArmor
            {
                Value    = (int)charges,
                Duration = TimeSpan.FromSeconds(duration),
            });

            target.FixedParticles(0x376A, 9, 32, 5008, EffectLayer.Waist);
            target.PlaySound(0x1E9);
        }
        public async Task CastAsync()
        {
            if (!Caster.CanBuff(Caster, true, BuffIcon.Curse, BuffIcon.Bless, BuffIcon.GiftOfRenewal))
            {
                return;
            }

            var modAmount = (int)(SpellHelper.GetModAmount(Caster, Caster, StatType.All) * 1.5);
            var duration  = SpellHelper.GetDuration(Caster, Caster) * 1.5;

            Caster.TryAddBuff(new StatBuff(StatType.All)
            {
                Title    = "Earth's Blessing",
                Icon     = BuffIcon.GiftOfRenewal,
                Value    = modAmount,
                Duration = duration
            });

            Caster.FixedParticles(0x373A, 10, 15, 5018, EffectLayer.Waist);
            Caster.PlaySound(0x1EA);

            if (!Caster.CanBuff(Caster, true, BuffIcon.Protection, BuffIcon.ArchProtection, BuffIcon.Resilience))
            {
                return;
            }

            Caster.TryAddBuff(new ArmorBuff
            {
                Title    = "Earth's Blessing Armor",
                Icon     = BuffIcon.Resilience,
                ArmorMod = (int)(modAmount * 0.75 + 1),
                Duration = duration
            });
        }
Beispiel #6
0
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            if (!Caster.CanBuff(target, icons: BuffIcon.Weaken))
            {
                return;
            }

            target.TryAddBuff(new StatBuff(StatType.Str)
            {
                Value    = SpellHelper.GetModAmount(Caster, target, StatType.Str) * -1,
                Duration = SpellHelper.GetDuration(Caster, target),
            });

            SpellHelper.Turn(Caster, target);

            target.Spell?.OnCasterHurt();
            target.Paralyzed = false;

            target.FixedParticles(0x3779, 10, 15, 5009, EffectLayer.Waist);
            target.PlaySound(0x1E6);
        }
        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),
            });
        }
Beispiel #8
0
        public async Task OnTargetAsync(ITargetResponse <IPoint3D> response)
        {
            if (!response.HasValue)
            {
                return;
            }

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

            var range = 4.0;

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

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

            foreach (var mobile in eable)
            {
                if (!Caster.CanBuff(mobile, false, BuffIcon.Curse, BuffIcon.Bless))
                {
                    return;
                }

                Caster.DoHarmful(mobile);
                mobile.TryAddBuff(new StatBuff(StatType.All)
                {
                    Value    = SpellHelper.GetModAmount(Caster, mobile, StatType.All) * -1,
                    Duration = SpellHelper.GetDuration(Caster, mobile),
                });

                mobile.FixedParticles(0x374A, 10, 15, 5028, EffectLayer.Waist);
                mobile.PlaySound(0x1FB);
            }
            eable.Free();
        }
Beispiel #9
0
        public async Task CastAsync()
        {
            if (!Caster.CanBuff(Caster, true, BuffIcon.Polymorph, BuffIcon.LichForm))
            {
                return;
            }

            var magery     = Caster.Skills.Magery.Value;
            var duration   = magery / 15.0;
            var range      = magery / 30.0;
            var powerLevel = magery / 15.0;

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

            var bonus     = Caster.GetClassModifier(SkillName.Magery);
            var sleepTime = 5.0;

            if (bonus > 1.0)
            {
                sleepTime /= bonus;
            }

            Caster.PlaySound(0x20F);

            void OnTick()
            {
                if (!Caster.Alive)
                {
                    return;
                }

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

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

                    var damage = Utility.RandomMinMax(2, 2 * (int)powerLevel);

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

                    Caster.Mana += damage;

                    mobile.FixedParticles(0x3749, 7, 16, 5013, EffectLayer.Waist);
                    mobile.PlaySound(0x1F9);
                }

                eable.Free();
            }

            if (Caster is IBuffable {
                BuffManager : { } manager
            })
Beispiel #10
0
        public async Task CastAsync()
        {
            if (!Caster.CanBuff(Caster, true, BuffIcon.Polymorph, BuffIcon.AnimalForm, BuffIcon.LichForm))
            {
                return;
            }

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

            var group   = Utility.RandomMinMax(0, 1);
            var critter = Utility.RandomMinMax(0, 9);

            switch (magery)
            {
            case < 80:
                group += 1;
                break;

            case < 90:
                group += 2;
                break;

            case >= 90:
                group = 3;
                break;
            }

            if (Caster.GetClassModifier(SkillName.Magery) > 1.0)
            {
                group   += 1;
                critter += 2;
            }

            group   = Math.Clamp(group, 0, Groups.Length - 1);
            critter = Math.Clamp(critter, 0, Groups[group].Length - 1);

            var bodyId = Groups[group][critter].BodyId;

            if (bodyId <= 0)
            {
                return;
            }

            var hueMod    = bodyId == SeaSerpent.BodyId ? 233 : 0;
            var modAmount = group * 3.0;

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

            var statMod = (int)modAmount;
            var arMod   = statMod / 3;

            Caster.TryAddBuff(new Polymorph
            {
                Description = $"<br>Str: +{statMod}<br>Dex: +{statMod}<br>Int: +{statMod}<br>Armor: +{arMod}",
                Duration    = SpellHelper.GetDuration(Caster, Caster),
                BodyMods    = (bodyId, hueMod),
                StatMods    = (StrMod: statMod, DexMod: statMod, IntMod: statMod),
                ArmorMod    = arMod,
            });
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            SpellHelper.Turn(Caster, target);

            if (!Caster.CanBuff(target, true, BuffIcon.NightSight, BuffIcon.Shadow))
            {
                return;
            }

            var level = 20.0 + Caster.Skills.Magery.Value / 15.0;

            Caster.FireHook(h => h.OnModifyWithMagicEfficiency(Caster, ref level));
            var duration = SpellHelper.GetDuration(Caster, target).TotalSeconds;

            if (level > 30)
            {
                level = 30;
            }

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

            if (protection > 0)
            {
                var modifier = 100.0 - protection;
                duration *= modifier / 100;

                if (duration < 1)
                {
                    target.PrivateOverheadMessage(
                        MessageType.Regular,
                        0x3B2,
                        true,
                        "The nature of the target prevents it from being affected by that spell!",
                        Caster.NetState
                        );
                    return;
                }
            }

            target.TryAddBuff(new NightSight
            {
                Title    = "Darkness",
                Icon     = BuffIcon.Shadow,
                Value    = LightCycle.DungeonLevel,
                Duration = TimeSpan.FromSeconds(duration),
            });

            target.FixedParticles(0x373B, 10, 10, 5007, EffectLayer.Waist);
            target.PlaySound(0x1E3);
        }
Beispiel #12
0
        public async Task CastAsync()
        {
            if (Caster.BodyMod == 183 || Caster.BodyMod == 184)
            {
                Caster.SendLocalizedMessage(1042402); // You cannot use incognito while wearing body paint
                return;
            }
            if (DisguiseTimers.IsDisguised(Caster))
            {
                Caster.SendLocalizedMessage(1061631); // You can't do that while disguised.
                return;
            }
            if (!Caster.CanBeginAction(typeof(PolymorphSpell)) || Caster.IsBodyMod)
            {
                DoFizzle();
                return;
            }

            if (!Caster.CanBuff(Caster, false, BuffIcon.Incognito))
            {
                Caster.SendLocalizedMessage(1079022); // You're already incognitoed!
                return;
            }

            if (!(Caster is PlayerMobile player))
            {
                return;
            }

            DisguiseTimers.StopTimer(Caster);

            var duration = TimeSpan.FromSeconds((Caster.Skills[SkillName.Magery].Value / 10) * 60);
            var name     = Caster.Female ? NameList.RandomName("female") : NameList.RandomName("male");

            Caster.TryAddBuff(new Incognito
            {
                Description = $"Disguised as \"{name}\"",
                Duration    = duration,
                Values      = (
                    0,
                    player.Race.RandomSkinHue(),
                    player.Race.RandomHair(player.Female),
                    player.Race.RandomHairHue(),
                    player.Race.RandomFacialHair(player.Female),
                    player.Race.RandomHairHue(),
                    name
                    )
            });
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            SpellHelper.Turn(Caster, target);

            if (target.CurePoison(Caster))
            {
                if (Caster != target)
                {
                    Caster.SendLocalizedMessage(1010058); // You have cured the target of all poisons!
                    target.SendLocalizedMessage(1010059); // You have been cured of all poisons.
                }
                else
                {
                    Caster.SendLocalizedMessage(1010059);  // You have been cured of all poisons.
                }

                if (!Caster.CanBuff(target, icons: BuffIcon.PoisonImmunity))
                {
                    return;
                }

                var power = Caster.Skills[SkillName.Magery].Value / 25;
                Caster.FireHook(h => h.OnModifyWithMagicEfficiency(Caster, ref power));

                var duration = Caster.Skills[SkillName.Magery].Value * 2;
                Caster.FireHook(h => h.OnModifyWithMagicEfficiency(Caster, ref duration));

                target.TryAddBuff(new PoisonImmunity
                {
                    Value    = (int)power,
                    Duration = TimeSpan.FromSeconds(duration),
                });
            }
            else
            {
                target.SendLocalizedMessage(1010060); // You have failed to cure your target!
            }

            target.FixedParticles(0x373A, 10, 15, 5012, EffectLayer.Waist);
            target.PlaySound(0x1E0);
        }
Beispiel #14
0
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            SpellHelper.Turn(Caster, target);

            var range    = Caster.Skills[SkillName.Magery].Value / 10.0;
            var duration = Caster.Skills[SkillName.Magery].Value * 70;

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

            foreach (var mobile in mobiles)
            {
                if (!(mobile is PlayerMobile))
                {
                    continue;
                }

                if (!Caster.CanBuff(mobile, true, BuffIcon.NightSight, BuffIcon.Shadow))
                {
                    continue;
                }

                mobile.TryAddBuff(new NightSight
                {
                    Title    = "Owl Sight",
                    Icon     = BuffIcon.NightSight,
                    Value    = LightCycle.DayLevel,
                    Duration = TimeSpan.FromSeconds(duration),
                });

                mobile.FixedParticles(0x373A, 10, 10, 5007, EffectLayer.Waist);
                mobile.PlaySound(0x1E3);
            }

            mobiles.Free();
        }
        public async Task CastAsync()
        {
            if (!Caster.CanBuff(Caster, true, BuffIcon.Polymorph, BuffIcon.LichForm))
            {
                return;
            }

            var casterSkill = Caster.Skills.Magery.Value;
            var duration    = casterSkill * 5;

            var strMod = 0 - Caster.Str / 2.0;
            var dexMod = 0 - Caster.Dex / 2.0;
            var intMod = (double)Caster.Int;

            var classBonus = Caster.GetClassModifier(SkillName.Magery);

            if (classBonus > 1.0)
            {
                duration *= classBonus;
                strMod   /= classBonus;
                dexMod   /= classBonus;
                intMod   *= classBonus;
            }

            Caster.FixedParticles(0x375B, 1, 16, 5044, EffectLayer.Waist);
            Caster.PlaySound(0x209);

            const int bodyId = 0x18;
            const int hueMod = 0;

            Caster.TryAddBuff(new Polymorph
            {
                Title       = "Liche Form",
                Description = $"<br>Str: {strMod}<br>Dex: {dexMod}<br>Int: +{intMod}",
                Icon        = BuffIcon.LichForm,
                BodyMods    = (bodyId, hueMod),
                StatMods    = (StrMod: (int)strMod, DexMod: (int)dexMod, IntMod: (int)intMod),
                Duration    = TimeSpan.FromSeconds(duration),
            });
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            if (target is BaseVendor || target is PlayerVendor || target.AccessLevel > Caster.AccessLevel)
            {
                Caster.SendLocalizedMessage(501857); // This spell won't work on that!
                return;
            }

            if (!Caster.CanBuff(target, icons: BuffIcon.HidingAndOrStealth))
            {
                return;
            }

            var duration = Caster.Skills[SkillName.Magery].Value;

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

            target.TryAddBuff(new Invisibility
            {
                Icon     = BuffIcon.Invisibility,
                Title    = "Invisible",
                Duration = TimeSpan.FromSeconds(duration),
                Start    = DateTime.UtcNow,
            });

            SpellHelper.Turn(Caster, target);

            Effects.SendLocationParticles(
                EffectItem.Create(new Point3D(target.X, target.Y, target.Z + 16), Caster.Map, EffectItem.DefaultDuration), 0x376A,
                10, 15, 5045);
            target.PlaySound(0x3C4);
        }
        public async Task CastAsync()
        {
            if (!Caster.CanBuff(Caster, false, BuffIcon.MagicReflection))
            {
                Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
                return;
            }

            var value = Caster.Skills[SkillName.Magery].Value / 12.0 + 1.0;

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

            Caster.TryAddBuff(new MagicReflectionBuff
            {
                Value = value >= (int)SpellCircle.Highest
                    ? SpellCircle.Highest - 1
                    : (SpellCircle)value,
                Charges = 1
            });

            Caster.FixedParticles(0x374B, 10, 10, 5037, EffectLayer.Waist);
            Caster.PlaySound(0x1E7);
        }
Beispiel #18
0
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            if (!Caster.CanBuff(target, true, BuffIcon.Curse, BuffIcon.Bless, BuffIcon.GiftOfRenewal))
            {
                return;
            }

            target.TryAddBuff(new StatBuff(StatType.All)
            {
                Value    = SpellHelper.GetModAmount(Caster, target, StatType.All),
                Duration = SpellHelper.GetDuration(Caster, target),
            });
            SpellHelper.Turn(Caster, target);

            target.FixedParticles(0x373A, 10, 15, 5018, EffectLayer.Waist);
            target.PlaySound(0x1EA);
        }
        public async Task OnTargetAsync(ITargetResponse <Mobile> response)
        {
            if (!response.HasValue)
            {
                return;
            }

            var target = response.Target;

            SpellHelper.Turn(Caster, target);

            if (!Caster.CanBuff(target, true, BuffIcon.Protection, BuffIcon.HitLowerDefense))
            {
                return;
            }

            var amount   = SpellHelper.GetModAmount(Caster, target) * 1.25;
            var duration = SpellHelper.GetDuration(Caster, target).TotalSeconds;

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

            if (protection > 0)
            {
                var modifier = 100.0 - protection;
                duration *= modifier / 100;
                amount   *= modifier / 100;

                if (duration < 1 || amount < 1)
                {
                    target.PrivateOverheadMessage(
                        MessageType.Regular,
                        0x3B2,
                        true,
                        "The nature of the target prevents it from being affected by that spell!",
                        Caster.NetState
                        );
                    return;
                }
            }

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

            if (amount < 1)
            {
                return;
            }

            target.TryAddBuff(new ArmorBuff
            {
                Icon     = BuffIcon.HitLowerDefense,
                Title    = "Decaying Ray",
                ArmorMod = (int)amount * -1,
                Duration = TimeSpan.FromSeconds(duration),
            });

            if (Caster != target)
            {
                Caster.SendSuccessMessage($"You reduced {target.Name}'s armor rating by {amount}.");
            }

            target.SendSuccessMessage($"Your armor rating was reduced by {amount}.");
            target.PlaySound(0xFD);
        }