I've been poking around the oncast for spells comparing cursed weapon to other spell scripts to see if i can make it so all spells require a weapon to be cast. Additionally remove the auto equip removal when casting a magery spell. I could really use some direction on this. Anyone have any suggestions?

-- Figured out in spell.cs how to keep weapon in hand on casting.
Commented out

if (ClearHandsOnCast)
{
m_Caster.ClearHands();
}
 
Last edited:
Well after much annoyance and some helpful suggestions from justuo forum (lol) this is the script that works for what I was aiming for in case anyone was curious. This allows the spell to be cast and then rejected (returned) if no weapon is present, just like curse. However can be modified to fit any magic script.

only 1 more month of endless coding and designing before I release my completely custom client to work with my shard. It will be epic...

Code:
using System;
using System.Collections;
using Server.Items;

namespace Server.Spells.Chivalry
{
    public class DivineFurySpell : PaladinSpell
    {
        private static readonly SpellInfo m_Info = new SpellInfo(
            "Divine Fury", "Divinum Furis",
            -1,
            9002);
        private static readonly Hashtable m_Table = new Hashtable();
        public DivineFurySpell(Mobile caster, Item scroll)
            : base(caster, scroll, m_Info)
        {
        }

        public override TimeSpan CastDelayBase
        {
            get
            {
                return TimeSpan.FromSeconds(1.0);
            }
        }
        public override double RequiredSkill
        {
            get
            {
                return 25.0;
            }
        }
        public override int RequiredMana
        {
            get
            {
                return 15;
            }
        }
        public override int RequiredTithing
        {
            get
            {
                return 0;
            }
        }
        public override int MantraNumber
        {
            get
            {
                return 1060722;
            }
        }// Divinum Furis
        public override bool BlocksMovement
        {
            get
            {
                return false;
            }
        }
        public static bool UnderEffect(Mobile m)
        {
            return m_Table.Contains(m);
        }

        public override void OnCast()
        {
            BaseWeapon weapon = this.Caster.Weapon as BaseWeapon;

            if (weapon == null || weapon is Fists)
            {
                this.Caster.SendLocalizedMessage(501078); // You must be holding a weapon.
            }
            else if (this.CheckSequence())
            {
                this.Caster.PlaySound(0x20F);
                this.Caster.PlaySound(this.Caster.Female ? 0x338 : 0x44A);
                this.Caster.FixedParticles(0x376A, 1, 31, 9961, 1160, 0, EffectLayer.Waist);
                this.Caster.FixedParticles(0x37C4, 1, 31, 9502, 43, 2, EffectLayer.Waist);

                this.Caster.Stam = this.Caster.StamMax;

                Timer t = (Timer)m_Table[this.Caster];

                if (t != null)
                    t.Stop();

                int delay = this.ComputePowerValue(10);

                // TODO: Should caps be applied?
                if (delay < 7)
                    delay = 7;
                else if (delay > 24)
                    delay = 24;

                m_Table[this.Caster] = t = Timer.DelayCall(TimeSpan.FromSeconds(delay), new TimerStateCallback(Expire_Callback), this.Caster);
                this.Caster.Delta(MobileDelta.WeaponDamage);

                BuffInfo.AddBuff(this.Caster, new BuffInfo(BuffIcon.DivineFury, 1060589, 1075634, TimeSpan.FromSeconds(delay), this.Caster));
            }

            this.FinishSequence();
        }

        private static void Expire_Callback(object state)
        {
            Mobile m = (Mobile)state;

            m_Table.Remove(m);

            m.Delta(MobileDelta.WeaponDamage);
            m.PlaySound(0xF8);
        }
    }
}
 
Back