Tailean

Member
Code:
using System;
using System.Collections;
using Server.Targeting;
using Server.Network;

namespace Server.Spells.Fourth
{
    public class CurseSpell : MagerySpell
    {
        private static SpellInfo m_Info = new SpellInfo(
                "Curse", "Des Sanct",
                227,
                9031,
                Reagent.Nightshade,
                Reagent.Garlic,
                Reagent.SulfurousAsh
            );

        public override SpellCircle Circle { get { return SpellCircle.Fourth; } }

        public CurseSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
        {
        }

        public override void OnCast()
        {
            Caster.Target = new InternalTarget( this );
        }

        private static Hashtable m_UnderEffect = new Hashtable();

        public static void RemoveEffect( object state )
        {
            Mobile m = (Mobile)state;

            m_UnderEffect.Remove( m );

            m.UpdateResistances();
        }

        public static bool UnderEffect( Mobile m )
        {
            return m_UnderEffect.Contains( m );
        }

        public void Target( Mobile m )
        {
            if ( !Caster.CanSee( m ) )
            {
                Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
            }
            else if ( CheckHSequence( m ) )
            {
                SpellHelper.Turn( Caster, m );

                SpellHelper.CheckReflect( (int)this.Circle, Caster, ref m );

                SpellHelper.AddStatCurse( Caster, m, StatType.Str ); SpellHelper.DisableSkillCheck = true;
                SpellHelper.AddStatCurse( Caster, m, StatType.Dex );
                SpellHelper.AddStatCurse( Caster, m, StatType.Int ); SpellHelper.DisableSkillCheck = false;

                Timer t = (Timer)m_UnderEffect[m];

                if ( Caster.Player && m.Player /*&& Caster != m */ && t == null )    //On OSI you CAN curse yourself and get this effect.
                {
                    TimeSpan duration = SpellHelper.GetDuration( Caster, m );
                    m_UnderEffect[m] = t = Timer.DelayCall( duration, new TimerStateCallback( RemoveEffect ), m );
                    m.UpdateResistances();
                }

                if ( m.Spell != null )
                    m.Spell.OnCasterHurt();

                m.Paralyzed = false;

                m.FixedParticles( 0x374A, 10, 15, 5028, EffectLayer.Waist );
                m.PlaySound( 0x1E1 );

                int percentage = (int)(SpellHelper.GetOffsetScalar(Caster, m, true) * 100);
                TimeSpan length = SpellHelper.GetDuration(Caster, m);

                string args = String.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}", percentage, percentage, percentage, 10, 10, 10, 10);

                BuffInfo.AddBuff( m, new BuffInfo( BuffIcon.Curse, 1075835, 1075836, length, m, args.ToString() ) );

                HarmfulSpell( m );
            }

            FinishSequence();
        }

        private class InternalTarget : Target
        {
            private CurseSpell m_Owner;

            public InternalTarget( CurseSpell owner ) : base( Core.ML? 10 : 12, false, TargetFlags.Harmful )
            {
                m_Owner = owner;
            }

            protected override void OnTarget( Mobile from, object o )
            {
                if ( o is Mobile )
                    m_Owner.Target( (Mobile)o );
            }

            protected override void OnTargetFinish( Mobile from )
            {
                m_Owner.FinishSequence();
            }
        }
    }
}

It seems like it should work..I just don't get it.
 
buff icon with a curse spell have? If so, does it show a decrease in stats > 0 ?
Maybe you just have too much magic resistance?
 
ok it drops str dex and int fine, however the resistances is not being dropped to 60[except physical].
 
but does it add more? like I know it only shows 70 and counts 70 but do they have 100 in each resist if you added up all their armor? Enough to offset it possibly? Are you using the newest ServUO code?
 
Sorry, I should have been more clear, I am using RunUO 2.6 and it wont do anything weather the player has 100 resist or right at 70.
 
Try taking a look at the spells in ServUO and comparing them to RunUO. I know it works on ServUO.
 
Code:
public override int GetMaxResistance( ResistanceType type )
        {
            if ( AccessLevel >= AccessLevel.Player )
                return 70;

            int max = base.GetMaxResistance( type );

            if ( type != ResistanceType.Physical && 65 < max && Spells.Fourth.CurseSpell.UnderEffect( this ) )
                max = 65;

            if( Core.ML && this.Race == Race.Elf && type == ResistanceType.Energy )
                max += 5; //Intended to go after the 60 max from curse

            if( Core.ML && this.Race == Race.Elf && type == ResistanceType.Energy )
            max += 5; //Intended to go after the 60 max from curse

            if( Core.ML && this.Race == Race.Elf && type == ResistanceType.Fire )
            max += 5; //Intended to go after the 60 max from curse

            if( Core.ML && this.Race == Race.Elf && type == ResistanceType.Cold )
            max += 5; //Intended to go after the 60 max from curse

            if( Core.ML && this.Race == Race.Elf && type == ResistanceType.Poison )
            max += 5; //Intended to go after the 60 max from curse

            if( Core.ML && this.Race == Race.Elf && type == ResistanceType.Physical )
            max += 5; //Intended to go after the 60 max from curse


            if( Core.ML && this.Race == Race.Human && type == ResistanceType.Energy )
            max += 5; //Intended to go after the 60 max from curse

            if( Core.ML && this.Race == Race.Human && type == ResistanceType.Fire )
            max += 5; //Intended to go after the 60 max from curse

            if( Core.ML && this.Race == Race.Human && type == ResistanceType.Cold )
            max += 5; //Intended to go after the 60 max from curse

            if( Core.ML && this.Race == Race.Human && type == ResistanceType.Poison )
            max += 5; //Intended to go after the 60 max from curse

            if( Core.ML && this.Race == Race.Human && type == ResistanceType.Physical )
            max += 5; //Intended to go after the 60 max from curse

            return max;
        }

is there something wrong in this part of the code? Not sure how its supposed to be.
 
I was using real players
[doublepost=1527688712][/doublepost]Ok so I looked at that gethub u provided and did some editing, however curse still refuses to lower the resists to 60.

Code:
public override int GetMaxResistance( ResistanceType type )
        {
            if ( AccessLevel >= AccessLevel.Player )
                return 70;//stevie edit was 70

            int max = base.GetMaxResistance( type );

            if ( type != ResistanceType.Physical && 60 < max && Spells.Fourth.CurseSpell.UnderEffect( this ) )
                max = 60;

            if( Core.ML && this.Race == Race.Elf && type == ResistanceType.Energy )
                max += 5; //Intended to go after the 60 max from curse

            //if( Core.ML && this.Race == Race.Elf && type == ResistanceType.Energy )
            //max += 5; //Intended to go after the 60 max from curse

            //if( Core.ML && this.Race == Race.Elf && type == ResistanceType.Fire )
            //max += 5; //Intended to go after the 60 max from curse

            //if( Core.ML && this.Race == Race.Elf && type == ResistanceType.Cold )
            //max += 5; //Intended to go after the 60 max from curse

            //if( Core.ML && this.Race == Race.Elf && type == ResistanceType.Poison )
            //max += 5; //Intended to go after the 60 max from curse

            //if( Core.ML && this.Race == Race.Elf && type == ResistanceType.Physical )
            //max += 5; //Intended to go after the 60 max from curse


            //if( Core.ML && this.Race == Race.Human && type == ResistanceType.Energy )
            //max += 5; //Intended to go after the 60 max from curse

            //if( Core.ML && this.Race == Race.Human && type == ResistanceType.Fire )
            //max += 5; //Intended to go after the 60 max from curse

            //if( Core.ML && this.Race == Race.Human && type == ResistanceType.Cold )
            //max += 5; //Intended to go after the 60 max from curse

            //if( Core.ML && this.Race == Race.Human && type == ResistanceType.Poison )
            //max += 5; //Intended to go after the 60 max from curse

            //if( Core.ML && this.Race == Race.Human && type == ResistanceType.Physical )
            //max += 5; //Intended to go after the 60 max from curse

            return max;
        }
 
Code:
public override int GetMaxResistance( ResistanceType type )
        {
            if ( AccessLevel >= AccessLevel.Player )
                return 70;//stevie edit was 70

            int max = base.GetMaxResistance( type );

            if ( type != ResistanceType.Physical && 60 < max && Spells.Fourth.CurseSpell.UnderEffect( this ) )
                max = 60;

            if( Core.ML && this.Race == Race.Elf && type == ResistanceType.Energy )
                max += 5; //Intended to go after the 60 max from curse

            //if( Core.ML && this.Race == Race.Elf && type == ResistanceType.Energy )
            //max += 5; //Intended to go after the 60 max from curse

            //if( Core.ML && this.Race == Race.Elf && type == ResistanceType.Fire )
            //max += 5; //Intended to go after the 60 max from curse

            //if( Core.ML && this.Race == Race.Elf && type == ResistanceType.Cold )
            //max += 5; //Intended to go after the 60 max from curse

            //if( Core.ML && this.Race == Race.Elf && type == ResistanceType.Poison )
            //max += 5; //Intended to go after the 60 max from curse

            //if( Core.ML && this.Race == Race.Elf && type == ResistanceType.Physical )
            //max += 5; //Intended to go after the 60 max from curse


            //if( Core.ML && this.Race == Race.Human && type == ResistanceType.Energy )
            //max += 5; //Intended to go after the 60 max from curse

            //if( Core.ML && this.Race == Race.Human && type == ResistanceType.Fire )
            //max += 5; //Intended to go after the 60 max from curse

            //if( Core.ML && this.Race == Race.Human && type == ResistanceType.Cold )
            //max += 5; //Intended to go after the 60 max from curse

            //if( Core.ML && this.Race == Race.Human && type == ResistanceType.Poison )
            //max += 5; //Intended to go after the 60 max from curse

            //if( Core.ML && this.Race == Race.Human && type == ResistanceType.Physical )
            //max += 5; //Intended to go after the 60 max from curse

            return max;
        }
 
it's PlayerMobile.cs, PlayerMobile based on Mobile.
So Mobile.cs have GetMaxResistance method too, and in playermobile invoked base method (means Mobile.GetMaxResistance) in this line:
Code:
int max =base.GetMaxResistance( type );
"base" is a reference to the base class.

Show your GetMaxResistance method from Mobile.cs
 
I run Runuo 2.6, there is no mobile.cs is it something else?

the top of my player mobile is:

Code:
namespace Server.Mobiles
{
    #region Enums
    [Flags]
    public enum PlayerFlag // First 16 bits are reserved for default-distro use, start custom flags at 0x00010000
    {
        None                    = 0x00000000,
        Glassblowing            = 0x00000001,
        Masonry                    = 0x00000002,
        SandMining                = 0x00000004,
        StoneMining                = 0x00000008,
        ToggleMiningStone        = 0x00000010,
        KarmaLocked                = 0x00000020,
        AutoRenewInsurance        = 0x00000040,
        UseOwnFilter            = 0x00000080,
        PublicMyRunUO            = 0x00000100,
        PagingSquelched            = 0x00000200,
        Young                    = 0x00000400,
        AcceptGuildInvites        = 0x00000800,
        DisplayChampionTitle    = 0x00001000,
        HasStatReward            = 0x00002000,
        Archeology = 0x008000000,
        RefuseTrades            = 0x00004000
    }
 
i have mobiles.bin, mobiles.idx, and mobiles.tdb
[doublepost=1527782886][/doublepost]mobiles.cfg
[doublepost=1527800937][/doublepost]Any ideas?
[doublepost=1527849903][/doublepost]Okay, so I still can't figure this out but the problem has something to do with this code
Code:
  if ( AccessLevel >= AccessLevel.Player )
                return 70;
So . . . at some point, I changed this code to return 70 (This makes the players max resistances all 70's.)
Code:
  if ( AccessLevel >= AccessLevel.Player )
                return 100;

From a fresh install of 2.6 it returns 100 instead of 70 and when u log in all players resistances are 70 with the above code. This must mean there is other code I had edited at some point long ago that i no longer remember editing. Any ideas of any other code that deals with this?
 
I think I see the problem. You have an error in the check, where you check Access Level for more or equal to "Player", and you need to check only for more ">"
change:
Code:
  if ( AccessLevel >= AccessLevel.Player )
                return 70;
to:
Code:
  if ( AccessLevel > AccessLevel.Player )
                return 70;

and test changes with player account
 
So I tested it, and that didn't help, when a player casts curse on another player their resistances are not altered in any way. Thanks for trying tho.
 
Last edited:

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back