UOGamers Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

  • To obtain new Razor updates, please reinstall Razor from our new website.

[COMPLETE] Remove Curse to work on spells it should

Status
Not open for further replies.
[COMPLETE] Remove Curse to work on spells it should

Type: Missing Feature

Basic Description: Chivalry Remove Curse should remove also: Blood Oath curse, Mind Rot and the Curse buff

Way to experience: speaks itself :)

Detailed Description: As above.
Links: http://www.uoguide.com/Remove_Curse
Code: see below.
To let this work correctly upon Mind Rot, the MindRot spell needs a retouch. http://www.uodemise.com/forum/showpost.php?p=558795&postcount=24
So, I said it should remove also Clumsy-Feeblemind-Weaken before. That was my fault - I just fizzled Remove Curse :eek: . And also about Strangle... sorry!

I have done some changes in RemoveCurse.cs. Some of changes are probabily redundant, like to remove the Blood Oath gump (it should be already in the BloodOath.RemoveCurse), anyway...

Note: this already includes the Remove Curse vs Blood Oath curse patch.

Code:
Index: Scripts/Spells/Chivalry/RemoveCurse.cs
===================================================================
--- Scripts/Spells/Chivalry/RemoveCurse.cs    (revision 319)
+++ Scripts/Spells/Chivalry/RemoveCurse.cs    (working copy)
@@ -86,14 +86,17 @@
                     CorpseSkinSpell.RemoveCurse( m );
                     CurseSpell.RemoveEffect( m );
                     MortalStrike.EndWound( m );
+                    if (Core.ML) { BloodOathSpell.RemoveCurse(m); }
+                    MindRotSpell.ClearMindRotScalar(m);
 
                     BuffInfo.RemoveBuff( m, BuffIcon.Clumsy );
                     BuffInfo.RemoveBuff( m, BuffIcon.FeebleMind );
                     BuffInfo.RemoveBuff( m, BuffIcon.Weaken );
+                    BuffInfo.RemoveBuff( m, BuffIcon.Curse );
                     BuffInfo.RemoveBuff( m, BuffIcon.MassCurse );
                     BuffInfo.RemoveBuff( m, BuffIcon.MortalStrike );
+                    BuffInfo.RemoveBuff( m, BuffIcon.Mindrot );
 
-                    // TODO: Should this remove blood oath? Pain spike?
                 }
                 else
                 {
Index: Scripts/Spells/Necromancy/BloodOathSpell.cs
===================================================================
--- Scripts/Spells/Necromancy/BloodOathSpell.cs    (revision 319)
+++ Scripts/Spells/Necromancy/BloodOathSpell.cs    (working copy)
@@ -58,6 +58,10 @@
                  * ((ss-rm)/8)+8
                  */
 
+                ExpireTimer timer = (ExpireTimer)m_Table[m];
+                if ( timer != null )
+                    timer.DoExpire();
+
                 m_OathTable[Caster] = Caster;
                 m_OathTable[m] = Caster;
 
@@ -72,13 +76,31 @@
                 TimeSpan duration = TimeSpan.FromSeconds( ((GetDamageSkill( Caster ) - GetResistSkill( m )) / 8) + 8 );
                 m.CheckSkill( SkillName.MagicResist, 0.0, 120.0 );    //Skill check for gain
 
-                new ExpireTimer( Caster, m, duration ).Start();
+                timer = new ExpireTimer( Caster, m, duration );
+                timer.Start();
+
+                BuffInfo.AddBuff( Caster, new BuffInfo( BuffIcon.BloodOathCaster, 1075659, duration, Caster, m.Name.ToString() ) );
+                BuffInfo.AddBuff( m, new BuffInfo( BuffIcon.BloodOathCurse, 1075661, duration, m, Caster.Name.ToString() ) );
+
+                m_Table[m] = timer;
             }
 
             FinishSequence();
         }
 
+        public static bool RemoveCurse( Mobile m )
+        {
+            ExpireTimer t = (ExpireTimer)m_Table[m];
+
+            if ( t == null )
+                return false;
+
+            t.DoExpire();
+            return true;
+        }
+
         private static Hashtable m_OathTable = new Hashtable();
+        private static Hashtable m_Table = new Hashtable();
 
         public static Mobile GetBloodOath( Mobile m )
         {
@@ -112,15 +134,26 @@
             {
                 if ( m_Caster.Deleted || m_Target.Deleted || !m_Caster.Alive || !m_Target.Alive || DateTime.Now >= m_End )
                 {
-                    m_Caster.SendLocalizedMessage( 1061620 ); // Your Blood Oath has been broken.
-                    m_Target.SendLocalizedMessage( 1061620 ); // Your Blood Oath has been broken.
+                    DoExpire();
+                }
+            }
 
-                    m_OathTable.Remove( m_Caster );
-                    m_OathTable.Remove( m_Target );
+            public void DoExpire()
+            {
+                m_Caster.SendLocalizedMessage( 1061620 ); // Your Blood Oath has been broken.
+                m_Target.SendLocalizedMessage( 1061620 ); // Your Blood Oath has been broken.
 
-                    Stop();
-                }
+                m_OathTable.Remove( m_Caster );
+                m_OathTable.Remove( m_Target );
+
+                Stop();
+
+                BuffInfo.RemoveBuff( m_Caster, BuffIcon.BloodOathCaster );
+                BuffInfo.RemoveBuff( m_Target, BuffIcon.BloodOathCurse );
+
+                m_Table.Remove( m_Caster );
             }
+
         }
 
         private class InternalTarget : Target
It works well and it's tested, but there is a little bug of minor importance, about Mind Rot.

MindRot.cs won't mean to have a RemoveCurse effect, so I have linked it to the ClearMindRotScalar.
The matter is that function (is that a function?? I have already said I can't code :( ) won't stop OnTick, that means:

- for developers: even if the effect is removed (tested many times), there is a counter that will run ClearMindRotScalar another time.
- for players: you will have the system message Your mind feels normal again only when the counter reaches 0, and if you move that message from OnTick to ClearMindRotScalar, you will have that message 2 times: as when you use Remove Curse, and at the end of the counter (since OnTick recalls it).

EDIT: these problems about Mind Rot will be no more if you apply the MindRot retouch.(http://www.uodemise.com/forum/showpost.php?p=558795&postcount=24)

Note: About Mass Curse, I have to see the buff and the bug associated about PvP fixed before testing it with Remove Curse.
 

gilgamash

Knight
Re: Remove Curse to work on spells it should

Just a simple guess (can't try it now):

If Timer is accessiable (as a private SUBfunction of the spell's class it should be):

Have you tried adding editing the MindRot.cs - part of ClearMindrotScalar(...) to

Code:
public static void ClearMindRotScalar( Mobile m )
{
	m_Table.Remove( m );
	BuffInfo.RemoveBuff( m, BuffIcon.Mindrot );
	Timer.m_End = Timer.DateTime.now;
}

and maybe additionally calling Timer.OnTick() ?

Greets,
G.
 
Re: Remove Curse to work on spells it should

gilgamash;557869 said:
Just a simple guess (can't try it now):

If Timer is accessiable (as a private SUBfunction of the spell's class it should be):

Have you tried adding editing the MindRot.cs - part of ClearMindrotScalar(...) to

Code:
public static void ClearMindRotScalar( Mobile m )
{
    m_Table.Remove( m );
    BuffInfo.RemoveBuff( m, BuffIcon.Mindrot );
    Timer.m_End = Timer.DateTime.now;
}
and maybe additionally calling Timer.OnTick() ?

it won't compile due to definitions m_End and DateTime not contained :p
 

gilgamash

Knight
Re: Remove Curse to work on spells it should

K, I have looked into the code to some more extense now. It seems to be like this:

1) each time MindRot is cast, a new ExpireTimer object is created, holding information about caster and target (and duration)
2) the reference to the timer is NOT saved, either it flies around somwhere in memory or is handled by some garbage collection
3) the effects of 2) are, that there seems to be no way of tracking back how many MindRot spells are cast on a player (or on whatever) and not being able to acces the timer from outside.

Those are, in my opinion, the reasons for the timer not being stopped properly: you can't acces it (it is wherever in memory) and thus not stop it; the ExpireTimers only Stop when the OnClick()-Procedure realizes that the duration is over.

My suggestion so far:

1) Maybe the list of casters and targets will be important sometime later for whatever reasons.
2) Cut the private subclass 'ExpireTimer' out and create some public classs (for example in the Server section') MRExpireTimer (for MindRot)
3) each mobile gets a hashtable for storing all MindRot spells it is afflicted by. The Key would thus be the caster, the value (of the hashtable) the MRExpireTimer.
4) Thus one could keep track, remove individual as well as all effective MindRots.

I am right now working on this....

Edit: Geeee, I am trying to get a golden runic hammer; I should collect and fill bods instead of coding :)
 

gilgamash

Knight
Re: Remove Curse to work on spells it should

Forget the nonsense I wrote, player can just be under the influence of ONE MindRot-Spell at a time.
I am in the testing phase of the patch now.
 

gilgamash

Knight
Re: Remove Curse to work on spells it should

Tested it and it seems to work so far. However, it needed some major changes to the file and it is easier to attach the new files and give instructions.

First, add this line somewhere to the 'variables' section of Mobile.cs:

Code:
public object m_MindRotTimer = null;

The new MindRot.cs file is attached; amongst other things, the complete private class ExpireTimer is now missing as it was reprogrammed MRExpireTimer.cs. Create a Subdir 'Utils' in the 'Scripts\Spells' folder where you drop this file.

You need to run the 'compile.bat' file again, afterwards the Server.exe file should compile the stuff problemlessly.

The file 'RemoveCurse.cs' needs to be modified to include the additional lines given here:

http://www.uodemise.com/forum/showthread.php?t=115144

Atb,
G.

PS.: It was not just a minor bug, as the timer was not stopped (which was not possible as there being no refernce to it)
 

Attachments

  • MindRot.txt
    3.7 KB · Views: 1
  • MRExpireTimer.txt
    1 KB · Views: 1
Re: Remove Curse to work on spells it should

You are GREAT :)

gilgamash;558149 said:
Code:
public object m_MindRotTimer = null;

Oh... a core modification? Is really not possible to add it somewhere in a script outside core?

gilgamash;558149 said:
PS.: It was not just a minor bug, as the timer was not stopped (which was not possible as there being no refernce to it)

Not for developers, but at the end the "bug" was the timer that continued to run ClearMindRotScalar that was already executed before, so the effect was to delete Mind Rot effect another time.

EDIT: errr... could you give us more details about *where* I should put that line in Server/Mobile.cs??
 

Oppa

Wanderer
Re: Remove Curse to work on spells it should

Chivalry Remove Curse should remove also: Blood Oath curse, Mind Rot and the Curse buff
---------------------------------------------

it should remove... It's your wish ? or osi does the same thing?
 

gilgamash

Knight
Re: Remove Curse to work on spells it should

Hola,

put the line after the three you see above it.

Code:
private static readonly TimeSpan WarmodeSpamCatch = TimeSpan.FromSeconds( (Core.SE ? 1.0 : 0.5) );
private static readonly TimeSpan WarmodeSpamDelay = TimeSpan.FromSeconds( (Core.SE ? 4.0 : 2.0) );
private const int WarmodeCatchCount = 4; // Allow four warmode changes in 0.5 seconds, any more will be delay for two seconds

public object m_MindRotTimer = null;

I don't see a different way of doing this, as the object needs to keep track of it's being influenced by a spell (as nothing else than the Mobile target is a parameter of the Spell's functions).

Greets,
G.

P.S.: new Mobile.cs is attached.
 

Attachments

  • Mobile.zip
    45 KB · Views: 0

gilgamash

Knight
Re: Remove Curse to work on spells it should

I thought a little about it. I could create a new class storing the MindRot-scalar as well as the Timer. I'll try this today - that would laeve Mobile.cs untouched.

You'll hear from me later...
 

gilgamash

Knight
Re: Remove Curse to work on spells it should

Hoi,

the new way of implementation seems to work problemlessly.

Two things, thou:

1) Remove Curse drops a message 'You are no longer mortally wounede' whether one is wounded or not. That should be corrected.
2) I think it would be nice to drop some kind of message when a player is (succesfully) 'mind rottet'. What do you think? Any ideas?

If (2) is clarified, I'll post the new code. Mobile.cs now remains untouched. The code
should be tousted when performed 'paranthesized' on several players and it should be checked whether they get the correct message.


G.
 

Nikki_Demise

Bug Hunter
Re: Remove Curse to work on spells it should

Oppa;558754 said:
some people have to check on osi before we change it.

Since it's in a recent publish I'd say go ahead and add it but make sure it has a if( Core.ML )
 

gilgamash

Knight
Re: Remove Curse to work on spells it should

Would be nice if you left some ideas for a message
when a player is mind rottet (see above).
Even if it is not alike on OSI I think we should do that,
as for other curses, wounds etc. you get a message, too.

G.
 

Nikki_Demise

Bug Hunter
Re: Remove Curse to work on spells it should

gilgamash;558762 said:
Would be nice if you left some ideas for a message
when a player is mind rottet (see above).
Even if it is not alike on OSI I think we should do that,
as for other curses, wounds etc. you get a message, too.

G.

I'm not seeing anything in the Cliloc. If there is a mind rot message it should be in there.
 

gilgamash

Knight
Re: Remove Curse to work on spells it should

Well, my suggestion was to add one. So the player knows he is hexed.

But if you all prefer a best possible OSI-clone, that is fine for me.

G.
 
Status
Not open for further replies.
Top