Ejemplo n.º 1
0
        public override void OnCast()
        {
            BaseWeapon wep = Caster.Weapon as BaseWeapon;

            if (wep == null || wep != Weapon)
            {
                Caster.SendLocalizedMessage(501078); // You must be holding a weapon.
            }
            else if (IsUnderSpellEffects(Caster, Weapon))
            {
                Caster.SendLocalizedMessage(501775); // This spell is already in effect.
            }
            else if (Weapon.Immolating || Weapon.ConsecratedContext != null)
            {
                Caster.SendLocalizedMessage(1080128); //You cannot use this ability while your weapon is enchanted.
            }
            else if (Weapon.FocusWeilder != null)
            {
                Caster.SendLocalizedMessage(1080446); // You cannot enchant an item that is under the effects of the ninjitsu focus attack ability.
            }
            else if (Weapon.WeaponAttributes.HitLightning > 0 || Weapon.WeaponAttributes.HitFireball > 0 || Weapon.WeaponAttributes.HitHarm > 0 || Weapon.WeaponAttributes.HitMagicArrow > 0 || Weapon.WeaponAttributes.HitDispel > 0)
            {
                Caster.SendLocalizedMessage(1080127); // This weapon already has a hit spell effect and cannot be enchanted.
            }
            else if (CheckSequence() && Caster.Weapon == Weapon)
            {
                Caster.PlaySound(0x64E);
                Caster.FixedEffect(0x36CB, 1, 9, 1915, 0);

                int prim = (int)Caster.Skills[CastSkill].Value;
                int sec  = (int)Caster.Skills[DamageSkill].Value;

                int    value    = (50 * (prim + sec)) / 240;
                double duration = ((double)(prim + sec) / 2.0) + 30.0;

                if (Table == null)
                {
                    Table = new Dictionary <Mobile, EnchantmentTimer>();
                }

                Enhancement.SetValue(Caster, this.Attribute, value, ModName);

                if (prim >= 80 && sec >= 80)
                {
                    Enhancement.SetValue(Caster, AosAttribute.SpellChanneling, 1, ModName);
                    Enhancement.SetValue(Caster, AosAttribute.CastSpeed, -1, ModName);
                }

                Table[Caster] = new EnchantmentTimer(Caster, Weapon, this.Attribute, value, duration);

                BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.Enchant, 1080126, 1080129, TimeSpan.FromSeconds(duration), Caster, value));

                Weapon.EnchantedWeilder = Caster;
                Weapon.InvalidateProperties();
            }

            FinishSequence();
        }
Ejemplo n.º 2
0
        public override void OnCast()
        {
            if (CheckSequence())
            {
                // Values
                var bonus1 = 2 + (int)(Caster.Skills[SkillName.Mysticism].Value / 20);
                var bonus  = 1 + (int)(Caster.Skills[SkillName.Focus].Value / 20);

                // Mount
                var mount = Caster.Mount;

                if (mount != null)
                {
                    mount.Rider = null;
                }

                // Resists
                var mods = new List <ResistanceMod>();
                mods.Add(new ResistanceMod(ResistanceType.Physical, bonus1 + bonus));
                mods.Add(new ResistanceMod(ResistanceType.Fire, bonus1 + bonus));
                mods.Add(new ResistanceMod(ResistanceType.Cold, bonus1 + bonus));
                mods.Add(new ResistanceMod(ResistanceType.Poison, bonus1 + bonus));
                mods.Add(new ResistanceMod(ResistanceType.Energy, bonus1 + bonus));

                for (var i = 0; i < mods.Count; i++)
                {
                    Caster.AddResistanceMod(mods[i]);
                }

                // Effects
                Caster.BodyMod = 705;
                Caster.PlaySound(0x65A);
                Caster.FixedParticles(0x3728, 1, 13, 9918, 92, 3, EffectLayer.Head);

                m_Table.Add(Caster, mods);

                Enhancement.SetValue(Caster, AosAttribute.CastSpeed, -2, "Stone Form");
                Enhancement.SetValue(Caster, AosAttribute.WeaponSpeed, -10, "Stone Form");

                Caster.BeginAction(typeof(StoneFormSpell));
            }

            FinishSequence();
        }
Ejemplo n.º 3
0
        public override void OnCast()
        {
            if (CheckWSequence() && CheckSequence() && Caster.Weapon == Weapon)
            {
                Caster.PlaySound(0x64E);
                Caster.FixedEffect(0x37C4, 10, 14, 4, 3);

                Caster.SendMessage("You enchant the weapon.");

                int prim = (int)Caster.Skills[CastSkill].Value;
                int sec  = (int)Caster.Skills[DamageSkill].Value;

                int    value    = (50 * (prim + sec)) / 240;
                double duration = ((double)(prim + sec) / 2.0) + 30.0;

                if (Table == null)
                {
                    Table = new Dictionary <Mobile, EnchantmentTimer>();
                }

                if (Table.ContainsKey(Caster))
                {
                    RemoveEnchantment(Caster);
                }

                Enhancement.SetValue(Caster, this.Attribute, value, ModName);

                if (prim >= 80 && sec >= 80)
                {
                    Enhancement.SetValue(Caster, AosAttribute.SpellChanneling, 1, ModName);
                    Enhancement.SetValue(Caster, AosAttribute.CastSpeed, -1, ModName);
                }

                Table[Caster] = new EnchantmentTimer(Caster, Weapon, this.Attribute, value, duration);

                BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.Enchant, 1080126, 1080129, TimeSpan.FromSeconds(duration), Caster, value));

                Weapon.EnchantedWeilder = Caster;

                Weapon.InvalidateProperties();
            }

            FinishSequence();
        }
Ejemplo n.º 4
0
        public override void OnCast()
        {
            if (CheckWSequence() && CheckSequence() && Caster.Weapon == Weapon)
            {
                Caster.PlaySound(0x64E);
                Caster.FixedEffect(0x37C4, 10, 14, 4, 3);

                Caster.SendMessage("You enchant the weapon.");

                int prim = (int)Caster.Skills[CastSkill].Value;
                int sec  = (int)Caster.Skills[DamageSkill].Value;

                int    value    = (50 * (prim + sec)) / 240;
                double duration = Math.Max(30, (double)(prim + sec) / 2.0);

                if (Table == null)
                {
                    Table = new Dictionary <Mobile, EnchantmentTimer>();
                }

                if (Table.ContainsKey(Caster))
                {
                    RemoveEnchantment(Caster);
                }

                Enhancement.SetValue(Caster, this.Attribute, value, ModName);

                if ((Weapon.ArtifactRarity > 0 || Weapon.Name != null) && Weapon.Attributes.CastSpeed >= 0)
                {
                    Enhancement.SetValue(Caster, AosAttribute.CastSpeed, -1, ModName + "CastSpeed");
                }

                Table[Caster] = new EnchantmentTimer(Caster, Weapon, this.Attribute, value, duration);

                Weapon.EnchantedWeilder = Caster;

                Weapon.InvalidateProperties();
            }

            FinishSequence();
        }
Ejemplo n.º 5
0
        public static void RemoveEffect(Mobile m)
        {
            if (!m_Table.ContainsKey(m))
            {
                return;
            }

            var mods = m_Table[m];

            for (var i = 0; i < m_Table[m].Count; i++)
            {
                m.RemoveResistanceMod(mods[i]);
            }

            Enhancement.SetValue(m, AosAttribute.CastSpeed, 2, "Stone Form");
            Enhancement.SetValue(m, AosAttribute.WeaponSpeed, 10, "Stone Form");

            m_Table.Remove(m);
            m.EndAction(typeof(StoneFormSpell));
            m.PlaySound(0x201);
            m.FixedParticles(0x3728, 1, 13, 9918, 92, 3, EffectLayer.Head);
            m.BodyMod = 0;
        }