public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else if (SphereSpellTarget is BaseWand)
            {
                BaseWand bw = SphereSpellTarget as BaseWand;
                bw.RechargeWand(Caster, this);
            }
            else if (CheckSequence())
            {
                SpellHelper.GetSurfaceTop(ref p);

                Map map = Caster.Map;

                if (map != null)
                {
                    IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), Core.AOS ? 2 : 3);

                    foreach (Mobile m in eable)
                    {
                        ProtectionSpell.ApplyProtectionEffect(m, Caster);
                    }

                    eable.Free();
                }
            }

            FinishSequence();
        }
        public BuffType GetRandomBuff(Mobile target)
        {
            List <BuffType> buffs = new List <BuffType>();

            if (MagicReflectSpell.HasReflect(target))
            {
                buffs.Add(BuffType.MagicReflect);
            }

            if (ReactiveArmorSpell.HasArmor(target))
            {
                buffs.Add(BuffType.ReactiveArmor);
            }

            if (ProtectionSpell.HasProtection(target))
            {
                buffs.Add(BuffType.Protection);
            }

            TransformContext context = TransformationSpellHelper.GetContext(target);

            if (context != null && context.Type != typeof(AnimalForm))
            {
                buffs.Add(BuffType.Transformation);
            }

            StatMod mod = target.GetStatMod("[Magic] Str Offset");

            if (mod != null && mod.Offset > 0)
            {
                buffs.Add(BuffType.StrBonus);
            }

            mod = target.GetStatMod("[Magic] Dex Offset");
            if (mod != null && mod.Offset > 0)
            {
                buffs.Add(BuffType.DexBonus);
            }

            mod = target.GetStatMod("[Magic] Int Offset");
            if (mod != null && mod.Offset > 0)
            {
                buffs.Add(BuffType.IntBonus);
            }

            if (buffs.Count == 0)
            {
                return(BuffType.None);
            }

            BuffType type = buffs[Utility.Random(buffs.Count)];

            buffs.Clear();

            return(type);
        }
Exemple #3
0
        void CheckProtectionSpellComboBox(ComboBox comboBox, ProtectionSpell spell, List <ProtectionSpell> spells)
        {
            SecondarySkillLevel skillLevel = (SecondarySkillLevel)comboBox.SelectedValue;

            if (skillLevel == SecondarySkillLevel.None)
            {
                return;
            }

            spell.CasterStats.SkillLevel = skillLevel;
            spells.Add(spell);
        }
Exemple #4
0
        public static void RemoveAllEffects(Mobile target, Mobile caster)
        {
            //Remove magic reflect
            if (target.MagicDamageAbsorb > 0)
            {
                target.MagicDamageAbsorb = 0;
            }

            //dispel protection
            ProtectionSpell.StopTimer(target);

            //dispell polymorph
            PolymorphSpell.StopTimer(target);

            //dispell incognito
            IncognitoSpell.StopTimer(target);
        }
Exemple #5
0
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else if (CheckSequence())
            {
                SpellHelper.Turn(Caster, p);

                SpellHelper.GetSurfaceTop(ref p);

                if (!Core.AOS)
                {
                    Effects.PlaySound(p, Caster.Map, 0x299);
                }

                if (Caster.Map == null)
                {
                    FinishSequence();
                    return;
                }

                var targets = Caster.Map.GetMobilesInRange(new Point3D(p), Core.AOS ? 2 : 3)
                              .Where(m => Caster.CanBeBeneficial(m, false));

                if (Core.AOS)
                {
                    var party = Party.Get(Caster);

                    foreach (var m in targets)
                    {
                        if (m == Caster || party?.Contains(m) == true)
                        {
                            Caster.DoBeneficial(m);
                            ProtectionSpell.Toggle(Caster, m);
                        }
                    }
                }
                else
                {
                    var val = (int)(Caster.Skills.Magery.Value / 10.0 + 1);

                    foreach (var m in targets)
                    {
                        if (m.BeginAction <ArchProtectionSpell>())
                        {
                            Caster.DoBeneficial(m);
                            m.VirtualArmorMod += val;

                            AddEntry(m, val);
                            new InternalTimer(m, Caster).Start();

                            m.FixedParticles(0x375A, 9, 20, 5027, EffectLayer.Waist);
                            m.PlaySound(0x1F7);
                        }
                    }
                }
            }

            FinishSequence();
        }
Exemple #6
0
        public virtual Spell ChooseSpell(Mobile c)
        {
            Spell spell = null;

            if (!SmartAI)
            {
                spell = CheckCastHealingSpell();

                if (spell != null)
                {
                    return(spell);
                }

                switch (Utility.Random(16))
                {
                case 0:
                {
                    spell = new FireballSpell(m_Mobile, null);
                    break;
                }

                case 1:
                {
                    m_Mobile.DebugSay("Protecting myself");

                    spell = new ProtectionSpell(m_Mobile, null);
                    break;
                }

                case 2:         // Poison them
                {
                    m_Mobile.DebugSay("Attempting to poison");

                    if (!c.Poisoned)
                    {
                        spell = new PoisonSpell(m_Mobile, null);
                    }

                    break;
                }

                case 3:         // Bless ourselves.
                {
                    m_Mobile.DebugSay("Blessing myself");

                    spell = new BlessSpell(m_Mobile, null);
                    break;
                }

                case 4:
                {
                    m_Mobile.DebugSay("Summoning FIRE FIELD!!!");

                    spell = new FireFieldSpell(m_Mobile, null);
                    break;
                }

                case 5:
                case 6:     // Curse them.
                {
                    m_Mobile.DebugSay("Attempting to curse");

                    spell = GetRandomCurseSpell();
                    break;
                }

                case 7:         // Paralyze them.
                {
                    m_Mobile.DebugSay("Attempting to paralyze");

                    if (m_Mobile.Skills[SkillName.Magery].Value > 50.0)
                    {
                        spell = new ParalyzeSpell(m_Mobile, null);
                    }

                    break;
                }

                case 8:     // Drain mana
                {
                    m_Mobile.DebugSay("Attempting to drain mana");

                    spell = GetRandomManaDrainSpell();
                    break;
                }

                default:     // Damage them.
                {
                    m_Mobile.DebugSay("Just doing damage");

                    spell = GetRandomDamageSpell();
                    break;
                }
                }

                return(spell);
            }

            spell = CheckCastHealingSpell();

            if (spell != null)
            {
                return(spell);
            }

            if (!c.Poisoned && c.Spell != null && c.Mana > (c.ManaMax / 2))
            {
                return(GetRandomManaDrainSpell());
            }

            if (m_Mobile.Hits < (m_Mobile.HitsMax / 2) && 0.30 > Utility.RandomDouble())
            {
                spell = new ProtectionSpell(m_Mobile, null);

                if (spell == null)
                {
                    spell = new BlessSpell(m_Mobile, null);
                }

                if (spell != null)
                {
                    return(spell);
                }
            }

            if (c.Hits < (c.HitsMax * 0.30))  //They're dying, set up a kill combo
            {
                m_Combo = 0;

                if (!c.Poisoned)
                {
                    spell = new PoisonSpell(m_Mobile, null);
                }
                else
                {
                    spell = new ParalyzeSpell(m_Mobile, null);
                }
            }

            switch (Utility.Random(10))
            {
            default:
            case 0:     // Deal some damage
            {
                spell = GetRandomDamageSpell();
                break;
            }

            case 1:     // Poison them
            {
                if (!c.Poisoned)
                {
                    spell = new PoisonSpell(m_Mobile, null);
                }

                break;
            }

            case 2:     // Set up a combo
            {
                if (m_Mobile.Mana < 40 && m_Mobile.Mana > 15)
                {
                    if (c.Paralyzed && !c.Poisoned)
                    {
                        m_Mobile.DebugSay("I am going to meditate");

                        m_Mobile.UseSkill(SkillName.Meditation);
                    }
                    else if (!c.Poisoned)
                    {
                        spell = new ParalyzeSpell(m_Mobile, null);
                    }
                }
                else if (m_Mobile.Mana > 60)
                {
                    if (Utility.Random(2) == 0 && !c.Paralyzed && !c.Frozen && !c.Poisoned)
                    {
                        m_Combo = 0;
                        spell   = new ParalyzeSpell(m_Mobile, null);
                    }
                    else
                    {
                        m_Combo = 1;
                        spell   = new ExplosionSpell(m_Mobile, null);
                    }
                }

                break;
            }

            case 3:
            {
                spell = GetRandomCurseSpell();
                break;
            }
            }

            return(spell);
        }
Exemple #7
0
            protected override void OnTarget(Mobile from, object o)
            {
                if (m_Talisman == null || m_Talisman.Deleted)
                {
                    return;
                }

                Mobile target = o as Mobile;

                if (from.Talisman != m_Talisman)
                {
                    from.SendLocalizedMessage(502641);                       // You must equip this item to use it.
                }
                else if (target == null)
                {
                    from.SendLocalizedMessage(1046439);                       // That is not a valid target.
                }
                else if (m_Talisman.ChargeTime > 0)
                {
                    from.SendLocalizedMessage(1074882, m_Talisman.ChargeTime.ToString());                       // You must wait ~1_val~ seconds for this to recharge.
                }
                else if (m_Talisman.Charges == 0 && m_Talisman.MaxCharges > 0)
                {
                    from.SendLocalizedMessage(1042544);                       // This item is out of charges.
                }
                else
                {
                    switch (m_Talisman.Removal)
                    {
                    case TalismanRemoval.Curse:
                        target.PlaySound(0xF6);
                        target.PlaySound(0x1F7);
                        target.FixedParticles(0x3709, 1, 30, 9963, 13, 3, EffectLayer.Head);

                        IEntity mfrom = new Entity(Serial.Zero, new Point3D(target.X, target.Y, target.Z - 10), from.Map);
                        IEntity mto   = new Entity(Serial.Zero, new Point3D(target.X, target.Y, target.Z + 50), from.Map);
                        Effects.SendMovingParticles(mfrom, mto, 0x2255, 1, 0, false, false, 13, 3, 9501, 1, 0, EffectLayer.Head, 0x100);

                        StatMod mod;

                        mod = target.GetStatMod("[Magic] Str Offset");
                        if (mod != null && mod.Offset < 0)
                        {
                            target.RemoveStatMod("[Magic] Str Offset");
                        }

                        mod = target.GetStatMod("[Magic] Dex Offset");
                        if (mod != null && mod.Offset < 0)
                        {
                            target.RemoveStatMod("[Magic] Dex Offset");
                        }

                        mod = target.GetStatMod("[Magic] Int Offset");
                        if (mod != null && mod.Offset < 0)
                        {
                            target.RemoveStatMod("[Magic] Int Offset");
                        }

                        target.Paralyzed = false;

                        EvilOmenSpell.TryEndEffect(target);
                        StrangleSpell.RemoveCurse(target);
                        CorpseSkinSpell.RemoveCurse(target);
                        CurseSpell.RemoveEffect(target);

                        BuffInfo.RemoveBuff(target, BuffIcon.Clumsy);
                        BuffInfo.RemoveBuff(target, BuffIcon.FeebleMind);
                        BuffInfo.RemoveBuff(target, BuffIcon.Weaken);
                        BuffInfo.RemoveBuff(target, BuffIcon.MassCurse);

                        target.SendLocalizedMessage(1072408);                                   // Any curses on you have been lifted

                        if (target != from)
                        {
                            from.SendLocalizedMessage(1072409);                                       // Your targets curses have been lifted
                        }
                        break;

                    case TalismanRemoval.Damage:
                        target.PlaySound(0x201);
                        Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, EffectItem.DefaultDuration), 0x3728, 1, 13, 0x834, 0, 0x13B2, 0);

                        BleedAttack.EndBleed(target, true);
                        MortalStrike.EndWound(target);

                        BuffInfo.RemoveBuff(target, BuffIcon.Bleed);
                        BuffInfo.RemoveBuff(target, BuffIcon.MortalStrike);

                        target.SendLocalizedMessage(1072405);                                   // Your lasting damage effects have been removed!

                        if (target != from)
                        {
                            from.SendLocalizedMessage(1072406);                                       // Your Targets lasting damage effects have been removed!
                        }
                        break;

                    case TalismanRemoval.Ward:
                        target.PlaySound(0x201);
                        Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, EffectItem.DefaultDuration), 0x3728, 1, 13, 0x834, 0, 0x13B2, 0);

                        MagicReflectSpell.EndReflect(target);
                        ReactiveArmorSpell.EndArmor(target);
                        ProtectionSpell.EndProtection(target);

                        target.SendLocalizedMessage(1072402);                                   // Your wards have been removed!

                        if (target != from)
                        {
                            from.SendLocalizedMessage(1072403);                                       // Your target's wards have been removed!
                        }
                        break;

                    case TalismanRemoval.Wildfire:
                        // TODO
                        break;
                    }

                    m_Talisman.OnAfterUse(from);
                }
            }
        public override void OnTarget(Object o)
        {
            Mobile target = o as Mobile;

            if (target == null)
            {
                return;
            }

            if (m_CurseTable.ContainsKey(Caster))
            {
                Caster.SendLocalizedMessage(1154212); //You may not use the Purge Magic spell while you are under its curse.
            }
            else if (m_ImmuneTable.ContainsKey(target) || m_CurseTable.ContainsKey(target))
            {
                Caster.SendMessage("You may not use the Purge Magic spell while they are under its curse.");
            }
            else if (CheckHSequence(target))
            {
                if (CheckResisted(target))
                {
                    target.SendLocalizedMessage(501783);  // You feel yourself resisting magical energy.
                    Caster.SendLocalizedMessage(1080119); //Your Purge Magic has been resisted!
                }
                else
                {
                    Caster.PlaySound(0x655);
                    Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, EffectItem.DefaultDuration), 0x3728, 1, 13, 0x834, 0, 0x13B2, 0);

                    BuffType type = GetRandomBuff(target);

                    if (type != BuffType.None)
                    {
                        string arg = "";

                        switch (type)
                        {
                        case BuffType.MagicReflect:
                            MagicReflectSpell.EndReflect(target);
                            arg = "magic reflect";
                            break;

                        case BuffType.ReactiveArmor:
                            ReactiveArmorSpell.EndArmor(target);
                            arg = "reactive armor";
                            break;

                        case BuffType.Protection:
                            ProtectionSpell.EndProtection(target);
                            arg = "protection";
                            break;

                        case BuffType.Transformation:
                            TransformationSpellHelper.RemoveContext(target, true);
                            arg = "transformation spell";
                            break;

                        case BuffType.StrBonus:
                            arg = "strength bonus";
                            target.RemoveStatMod("[Magic] Str Offset");
                            BuffInfo.RemoveBuff(target, BuffIcon.Bless);
                            BuffInfo.RemoveBuff(target, BuffIcon.Strength);
                            break;

                        case BuffType.DexBonus:
                            arg = "dexterity bonus";
                            target.RemoveStatMod("[Magic] Dex Offset");
                            BuffInfo.RemoveBuff(target, BuffIcon.Bless);
                            BuffInfo.RemoveBuff(target, BuffIcon.Agility);
                            break;

                        case BuffType.IntBonus:
                            arg = "intelligence bonus";
                            target.RemoveStatMod("[Magic] Int Offset");
                            BuffInfo.RemoveBuff(target, BuffIcon.Bless);
                            BuffInfo.RemoveBuff(target, BuffIcon.Cunning);
                            break;
                        }

                        target.SendLocalizedMessage(1080117, arg); //Your ~1_ABILITY_NAME~ has been purged.
                        Caster.SendLocalizedMessage(1080118, arg); //Your target's ~1_ABILITY_NAME~ has been purged.

                        int duration = (int)((Caster.Skills[CastSkill].Value + Caster.Skills[DamageSkill].Value) / 15);

                        if (duration <= 0)
                        {
                            duration = 1;
                        }

                        m_ImmuneTable.Add(target, new ImmuneTimer(target, TimeSpan.FromSeconds(duration)));
                    }
                    else
                    {
                        Caster.SendLocalizedMessage(1080120); //Your target has no magic that can be purged.

                        int duration = (int)((Caster.Skills[CastSkill].Value + Caster.Skills[DamageSkill].Value) / 28);

                        if (duration <= 0)
                        {
                            duration = 1;
                        }

                        m_CurseTable.Add(target, new CurseTimer(target, Caster, TimeSpan.FromSeconds(duration)));
                    }
                }
            }

            FinishSequence();
        }
        public BuffType GetRandomBuff(Mobile target)
        {
            List <BuffType> buffs = new List <BuffType>();

            if (MagicReflectSpell.HasReflect(target))
            {
                buffs.Add(BuffType.MagicReflect);
            }

            if (ReactiveArmorSpell.HasArmor(target))
            {
                buffs.Add(BuffType.ReactiveArmor);
            }

            if (ProtectionSpell.HasProtection(target))
            {
                buffs.Add(BuffType.Protection);
            }

            TransformContext context = TransformationSpellHelper.GetContext(target);

            if (context != null && context.Type != typeof(AnimalForm))
            {
                buffs.Add(BuffType.Transformation);
            }

            StatMod mod = target.GetStatMod("[Magic] Str Buff");

            if (mod != null)
            {
                buffs.Add(BuffType.StrBonus);
            }

            mod = target.GetStatMod("[Magic] Dex Buff");
            if (mod != null)
            {
                buffs.Add(BuffType.DexBonus);
            }

            mod = target.GetStatMod("[Magic] Int Buff");
            if (mod != null)
            {
                buffs.Add(BuffType.IntBonus);
            }

            if (EodonianPotion.IsUnderEffects(target, PotionEffect.Barrab))
            {
                buffs.Add(BuffType.BarrabHemolymph);
            }

            if (EodonianPotion.IsUnderEffects(target, PotionEffect.Urali))
            {
                buffs.Add(BuffType.UraliTrance);
            }

            if (buffs.Count == 0)
            {
                return(BuffType.None);
            }

            BuffType type = buffs[Utility.Random(buffs.Count)];

            buffs.Clear();

            return(type);
        }
Exemple #10
0
        public void Target(BaseTalisman talis, Mobile owner, Mobile m)
        {
            if (this.Parent == owner)
            {
                //Curse Removal
                if (talis.m_TalismanType == TalismanType.CurseRemoval)
                {
                    m.PlaySound(0xF6);
                    m.PlaySound(0x1F7);
                    m.FixedParticles(0x3709, 1, 30, 9963, 13, 3, EffectLayer.Head);

                    StatMod mod;

                    mod = m.GetStatMod("[Magic] Str Malus");
                    if (mod != null && mod.Offset < 0)
                    {
                        m.RemoveStatMod("[Magic] Str Malus");
                    }

                    mod = m.GetStatMod("[Magic] Dex Malus");
                    if (mod != null && mod.Offset < 0)
                    {
                        m.RemoveStatMod("[Magic] Dex Malus");
                    }

                    mod = m.GetStatMod("[Magic] Int Malus");
                    if (mod != null && mod.Offset < 0)
                    {
                        m.RemoveStatMod("[Magic] Int Malus");
                    }

                    m.Paralyzed = false;

                    EvilOmenSpell.CheckEffect(m);
                    StrangleSpell.RemoveCurse(m);
                    CorpseSkinSpell.RemoveCurse(m);
                    CurseSpell.RemoveEffect(m);

                    BuffInfo.RemoveBuff(m, BuffIcon.Clumsy);
                    BuffInfo.RemoveBuff(m, BuffIcon.FeebleMind);
                    BuffInfo.RemoveBuff(m, BuffIcon.Weaken);
                    BuffInfo.RemoveBuff(m, BuffIcon.MassCurse);
                    BuffInfo.RemoveBuff(m, BuffIcon.Curse);
                    BuffInfo.RemoveBuff(m, BuffIcon.EvilOmen);
                    StrangleSpell.RemoveCurse(m);
                    CorpseSkinSpell.RemoveCurse(m);

                    if (owner != m)
                    {
                        owner.SendLocalizedMessage(1072409);               // Your targets curses have been lifted
                    }
                    m.SendLocalizedMessage(1072408);                       // Any curses on you have been lifted
                }

                //Damage Removal
                if (talis.m_TalismanType == TalismanType.DamageRemoval)
                {
                    Effects.SendLocationEffect(m.Location, m.Map, 0x3728, 8);
                    Effects.PlaySound(m, m.Map, 0x201);
                    BleedAttack.EndBleed(m, false);
                    MortalStrike.EndWound(m);
                    m.CurePoison(m);

                    BuffInfo.RemoveBuff(m, BuffIcon.Bleed);
                    BuffInfo.RemoveBuff(m, BuffIcon.MortalStrike);

                    if (owner != m)
                    {
                        owner.SendLocalizedMessage(1072406);               // Your Targets lasting damage effects have been removed!
                    }
                    m.SendLocalizedMessage(1072405);                       // Your lasting damage effects have been removed!
                }

                //Ward Removal
                if (talis.m_TalismanType == TalismanType.WardRemoval)
                {
                    Effects.SendLocationEffect(m.Location, m.Map, 0x3728, 8);
                    Effects.PlaySound(m, m.Map, 0x201);

                    ProtectionSpell.RemoveWard(m);
                    ReactiveArmorSpell.RemoveWard(m);
                    MagicReflectSpell.RemoveWard(m);
                    TransformationSpell.RemoveContext(m, true);
                    ReaperFormSpell.RemoveEffects(m);
                    if (StoneFormSpell.UnderEffect(m))
                    {
                        StoneFormSpell.RemoveEffects(m);
                    }

                    if (owner != m)
                    {
                        owner.SendLocalizedMessage(1072403);               // Your target's wards have been removed!
                    }
                    m.SendLocalizedMessage(1072402);                       // Your wards have been removed!
                }

                //Wildfire Removal
                if (talis.m_TalismanType == TalismanType.WildfireRemoval)
                {
                    owner.SendLocalizedMessage(1042753, "Wildfire Removal");                       // ~1_SOMETHING~ has been temporarily disabled.
                }
                //CARGE TIMER
                ChargeTimeLeft = 1200;
                m_ChargeTimer  = new ChargeTimeLeftTimer(this);
                m_ChargeTimer.Start();
                m_ChargeTimeLeft3 = DateTime.Now;
            }
            else if (m_TalismanType != 0)
            {
                m.SendLocalizedMessage(502641);                   // You must equip this item to use it.
            }
        }