Page 1 of 2
New Skald RR5/ BD RR5 Addition
PostPosted: Wed Apr 27, 2011 9:37 pm
by -Shawn-
- Code: Select all
UPDATE `classxrealmability` SET `AbilityKey`='Voice of Skaldi' WHERE (`ClassXRealmAbility_ID`='Skald-RR5')
- 2 Patches in 1 -
Use the SQL above to update skalds RR5's ability in the DB
*Made the new Skald RR5 (Voice of Skaldi)
-
http://camelotherald.com/patches.php?mode=live
*Also added SpeedDecrease to CC Immunity chance for BD's RR5
Re: New Skald RR5/ BD RR5 Addition
PostPosted: Wed Apr 27, 2011 10:52 pm
by Tolakram
Hi Shawn,
I appreciate the effort but I think you duplicated bad code and I'm going to rant.
- Code: Select all
+ if (target.EffectList.GetOfType(typeof(VoiceOfSkaldiEffect)) != null)
+ {
+
+ int basechance = base.CalculateSpellResistChance(target);
+ GameSpellEffect Nearsight = SpellHandler.FindEffectOnTarget(target, "Nearsight");
+ if (Nearsight == null)
+ {
+ basechance += (int)Nearsight.Spell.Value;
+ }
+ GameSpellEffect Mesmerize = SpellHandler.FindEffectOnTarget(target, "Mesmerize");
+ if (Mesmerize == null)
+ {
+ basechance += (int)Mesmerize.Spell.Value;
+ }
+ GameSpellEffect Stun = SpellHandler.FindEffectOnTarget(target, "Stun");
+ if (Stun == null)
+ {
+ basechance += (int)Stun.Spell.Value;
+ }
+
+ GameSpellEffect SpeedDecrease = SpellHandler.FindEffectOnTarget(target, "SpeedDecrease");
+ if (SpeedDecrease == null)
+ {
+ basechance += (int)SpeedDecrease.Spell.Value;
+ }
+ return Math.Min(100, basechance);
+
+ }
AllureOfDeath is what this code is based on and, frankly, it's complete crap. AllureOfDeath is supposed to grant 75% cc immunity, so the method CalculateSpellResistChance(GameLiving target) should simply return 75% chance of resist if active. It couldn't be more simpler. There's no fancy math manipulating basechance using spell value. whatever the heck that does.
VoiceOfTheSkald is supposed to grant 100% immunity for 30 seconds, so if active what should CalculateSpellResistChance(GameLiving target) return? 100? Egads, that's some difficult math.
Oh, and I see more.
- Code: Select all
if (Nearsight == null)
+ {
+ basechance += (int)Nearsight.Spell.Value;
+ }
If null then do something with it? That should be != null.
This kind of crap is all over the place and it is driving me crazy.
Is nearsight considered a CC spell? Why is nearsight here?
Re: New Skald RR5/ BD RR5 Addition
PostPosted: Wed Apr 27, 2011 11:01 pm
by geshi
Allure of Death (Bonedancer RR5) is supposed to give 75% immunity to CC, and 100% immunity to Nearsight according to DAoC Char Planner.
The Skald RR5 is supposed to give 100% immunity to all CC, nothing to do with Nearsight, I guess it was a copy & paste job and you forgot to remove the Nearsight part.
Re: New Skald RR5/ BD RR5 Addition
PostPosted: Wed Apr 27, 2011 11:49 pm
by -Shawn-
Sorry, was in a hurry when I made it guessed I should of payed more attention, there I updated it. Tell me if anything needs to be changed.
As for the
If null then do something with it? That should be != null.
This kind of crap is all over the place and it is driving me crazy.
Yemla actually pointed this out to me a few months ago when I first re-did the BD RR5, I had it as != to begin with... but as he told me if you think about it an look at the code it says FindTheEffectOnTarget and the spellhandler if you have it as != null then whats the point of adding chances to resist the spell if you already have the effect on you?
Copy Pasta is tasty.
As for that comment, we don't need any trolling on the boards haji.
Thanks!
Re: New Skald RR5/ BD RR5 Addition
PostPosted: Wed Apr 27, 2011 11:58 pm
by geshi
- Code: Select all
GameSpellEffect SpeedDecrease = SpellHandler.FindEffectOnTarget(target, "SpeedDecrease");
+ if (SpeedDecrease == null)
+ {
+ basechance += (int)SpeedDecrease.Spell.Value;
+ }
SpeedDecrease will be null, SpeedDecrease.Spell.Value will be empty, no need for that.
Also, the NS immunity will not be 100% as NS is not CC, it is Nearsight, and does not inherit from CCSpellHandler.
Also it should be
- Code: Select all
if (target.EffectList.GetOfType(typeof(VoiceOfSkaldiEffect)) != null)
{
return 100;
}
And the same for AllureofDeathEffect ..
- Code: Select all
if (target.EffectList.GetOfType(typeof(AllureofDeathEffect )) != null)
{
return 75;
}
Like Tolakram said
Then add
- Code: Select all
public override int CalculateSpellResistChance(GameLiving target)
{
if (target.EffectList.GetOfType(typeof(AllureofDeathEffect)) != null)
{
return 100;
}
return base.CalculateSpellResistChance(target);
}
To NearsightSpellHandler.cs

Re: New Skald RR5/ BD RR5 Addition
PostPosted: Thu Apr 28, 2011 12:17 am
by -Shawn-
Fixed.
Thanks for the help.
Re: New Skald RR5/ BD RR5 Addition
PostPosted: Thu Apr 28, 2011 12:21 am
by geshi
Still isn't really fixed ;/
Re: New Skald RR5/ BD RR5 Addition
PostPosted: Thu Apr 28, 2011 12:24 am
by -Shawn-
Still isn't really fixed ;/
How so? because if just return it 75; what you are returning? nothing is defined.
If I am wrong please explain it to me so I know for next time because all of the spell handlers are defined underneath it.
How will it know for which spells etc, also what about the checks then etc to see if the player has the effect or not.
Re: New Skald RR5/ BD RR5 Addition
PostPosted: Thu Apr 28, 2011 12:32 am
by geshi
It doesn't need to do any of those checks, it's 75% flat chance for every CC spell.
You just need to return 75, CalculateSpellResistChance should return an int from 0 - 100 for the resist chance of the spell casted.
And really, you are setting basechance, but not doing anything else with it

Re: New Skald RR5/ BD RR5 Addition
PostPosted: Thu Apr 28, 2011 12:34 am
by Tolakram
Keep at it Shawn, you can improve by learning what's wrong with this code.

Re: New Skald RR5/ BD RR5 Addition
PostPosted: Thu Apr 28, 2011 12:36 am
by -Shawn-
Alright then. Here's how you said it should be and it works

. Enjoy!
Re: New Skald RR5/ BD RR5 Addition
PostPosted: Thu Apr 28, 2011 9:28 am
by Dinberg
Yemla actually pointed this out to me a few months ago when I first re-did the BD RR5, I had it as != to begin with... but as he told me if you think about it an look at the code it says FindTheEffectOnTarget and the spellhandler if you have it as != null then whats the point of adding chances to resist the spell if you already have the effect on you?
I can see the logic you've applied here; the error lies with the fact you are trying to call a reference to a null variable's properties, which will throw a NullReferenceException at runtime:
- Code: Select all
if (Nearsight == null)
+ {
+ basechance += (int)Nearsight.Spell.Value;
+ }
basechance += (int)
Nearsight.Spell.Value;
The bit in red is null, as per the previous logic. When we then try to call a reference to this nonexistant effect's spell, we will throw an exception. Hope that clears things up!
Re: New Skald RR5/ BD RR5 Addition
PostPosted: Thu Apr 28, 2011 10:49 am
by Yemla
Yemla actually pointed this out to me a few months ago when I first re-did the BD RR5, I had it as != to begin with... but as he told me if you think about it an look at the code it says FindTheEffectOnTarget and the spellhandler if you have it as != null then whats the point of adding chances to resist the spell if you already have the effect on you?
I can see the logic you've applied here; the error lies with the fact you are trying to call a reference to a null variable's properties, which will throw a NullReferenceException at runtime:
- Code: Select all
if (Nearsight == null)
+ {
+ basechance += (int)Nearsight.Spell.Value;
+ }
basechance += (int)
Nearsight.Spell.Value;
The bit in red is null, as per the previous logic. When we then try to call a reference to this nonexistant effect's spell, we will throw an exception. Hope that clears things up!
My exact statement was Nearsight being a FindTheEffectOnTarget, therefore the whole check was pointless...if the target already has the effect, the resist won't happen because its pre-coded to not re-apply any forms of CC in the spellhandlers
Re: New Skald RR5/ BD RR5 Addition
PostPosted: Thu Apr 28, 2011 12:04 pm
by Dinberg
I was just making sure Shawn understood what was incorrect about the code, the logic itself is, as you say, not neccessary due to earlier checks; I wanted to clarify the issue with nullrefexception and so thought it best to ignore this in the explanation for clarity.
Re: New Skald RR5/ BD RR5 Addition
PostPosted: Thu May 12, 2011 8:43 am
by Graveen
The last patch Shawn provided is ok ?