示例#1
0
        //public virtual int CastDelayBase{ get{ return 3; } }
        //public virtual int CastDelayFastScalar{ get{ return 1; } }
        //public virtual int CastDelayPerSecond{ get{ return 4; } }
        //public virtual int CastDelayMinimum{ get{ return 1; } }

        public virtual TimeSpan GetCastDelay()
        {
            if (m_Scroll is SpellStone)
            {
                return(TimeSpan.Zero);
            }

            if (m_Scroll is BaseWand)
            {
                return(Core.ML ? CastDelayBase : TimeSpan.Zero);                // TODO: Should FC apply to wands?
            }

            // Faster casting cap of 2 (if not using the protection spell)
            // Faster casting cap of 0 (if using the protection spell)
            // Paladin spells are subject to a faster casting cap of 4
            // Paladins with magery of 70.0 or above are subject to a faster casting cap of 2
            int fcMax = 4;

            if (CastSkill == SkillName.Magery || CastSkill == SkillName.Necromancy || CastSkill == SkillName.Mysticism ||
                (CastSkill == SkillName.Chivalry && (m_Caster.Skills[SkillName.Magery].Value >= 70.0 || m_Caster.Skills[SkillName.Mysticism].Value >= 70.0)))
            {
                fcMax = 2;
            }

            int fc = AosAttributes.GetValue(m_Caster, AosAttribute.CastSpeed);

            if (fc > fcMax)
            {
                fc = fcMax;
            }

            if (ProtectionSpell.Registry.ContainsKey(m_Caster) || EodonianPotion.IsUnderEffects(m_Caster, PotionEffect.Urali))
            {
                fc = Math.Min(fcMax - 2, fc - 2);
            }

            TimeSpan baseDelay = CastDelayBase;

            TimeSpan fcDelay = TimeSpan.FromSeconds(-(CastDelayFastScalar * fc * CastDelaySecondsPerTick));

            //int delay = CastDelayBase + circleDelay + fcDelay;
            TimeSpan delay = baseDelay + fcDelay;

            if (delay < CastDelayMinimum)
            {
                delay = CastDelayMinimum;
            }

            #region Mondain's Legacy
            if (DreadHorn.IsUnderInfluence(m_Caster))
            {
                delay.Add(delay);
            }
            #endregion

            //return TimeSpan.FromSeconds( (double)delay / CastDelayPerSecond );
            return(delay);
        }
        public override bool OnDamage(Mobile m, ref int Damage)
        {
            Mobile attacker = m.FindMostRecentDamager(false);

            if (MyrmidexInvasionSystem.IsEnemies(m, attacker) && EodonianPotion.IsUnderEffects(attacker, PotionEffect.Kurak))
            {
                Damage *= 3;

                if (Damage > 0)
                {
                    m.FixedEffect(0x37B9, 10, 5);
                }
            }

            return(base.OnDamage(m, ref Damage));
        }
示例#3
0
        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 Buff");
                            BuffInfo.RemoveBuff(target, BuffIcon.Bless);
                            BuffInfo.RemoveBuff(target, BuffIcon.Strength);
                            break;

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

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

                        case BuffType.BarrabHemolymph:
                            arg = "Barrab hemolymph";
                            EodonianPotion.RemoveEffects(target, PotionEffect.Barrab);
                            break;

                        case BuffType.UraliTrance:
                            arg = "Urali Trance";
                            EodonianPotion.RemoveEffects(target, PotionEffect.Urali);
                            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();
        }
示例#4
0
        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);
        }