New Skald RR5/ BD RR5 Addition

A place to submit .patch fixes for the DOL SVN

Moderator: Developer Team

New Skald RR5/ BD RR5 Addition

Postby -Shawn- » Wed Apr 27, 2011 9:37 pm

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
Attachments
VoiceOfSkaldi+BDRR5Addition.patch
(8.06 KiB) Downloaded 28 times
viewtopic.php?f=6&t=14984

Sky is the limit.
-Shawn-
DOL Devotee
 
Posts: 305
Joined: Tue Nov 24, 2009 1:47 am
Location: New York

Re: New Skald RR5/ BD RR5 Addition

Postby Tolakram » Wed Apr 27, 2011 10:52 pm

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?
- Mark
User avatar
Tolakram
Storm / Storm-D2 Admin
 
Posts: 9189
Joined: Tue Jun 13, 2006 1:49 am
Location: Kentucky, USA

Re: New Skald RR5/ BD RR5 Addition

Postby geshi » Wed Apr 27, 2011 11:01 pm

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.
geshi
Contributor
 
Posts: 1826
Joined: Tue Oct 21, 2008 9:16 pm

Re: New Skald RR5/ BD RR5 Addition

Postby -Shawn- » Wed Apr 27, 2011 11:49 pm

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!
Attachments
VoiceOfSkaldi+BDRR5Addition.patch
(8.15 KiB) Downloaded 16 times
viewtopic.php?f=6&t=14984

Sky is the limit.
-Shawn-
DOL Devotee
 
Posts: 305
Joined: Tue Nov 24, 2009 1:47 am
Location: New York

Re: New Skald RR5/ BD RR5 Addition

Postby geshi » Wed Apr 27, 2011 11:58 pm

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
:D
geshi
Contributor
 
Posts: 1826
Joined: Tue Oct 21, 2008 9:16 pm

Re: New Skald RR5/ BD RR5 Addition

Postby -Shawn- » Thu Apr 28, 2011 12:17 am

Fixed.


Thanks for the help.
Attachments
VoiceOfSkaldi+BDRR5Addition.patch
(9.02 KiB) Downloaded 20 times
viewtopic.php?f=6&t=14984

Sky is the limit.
-Shawn-
DOL Devotee
 
Posts: 305
Joined: Tue Nov 24, 2009 1:47 am
Location: New York

Re: New Skald RR5/ BD RR5 Addition

Postby geshi » Thu Apr 28, 2011 12:21 am

Still isn't really fixed ;/
geshi
Contributor
 
Posts: 1826
Joined: Tue Oct 21, 2008 9:16 pm

Re: New Skald RR5/ BD RR5 Addition

Postby -Shawn- » Thu Apr 28, 2011 12:24 am

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.
viewtopic.php?f=6&t=14984

Sky is the limit.
-Shawn-
DOL Devotee
 
Posts: 305
Joined: Tue Nov 24, 2009 1:47 am
Location: New York

Re: New Skald RR5/ BD RR5 Addition

Postby geshi » Thu Apr 28, 2011 12:32 am

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 :)
geshi
Contributor
 
Posts: 1826
Joined: Tue Oct 21, 2008 9:16 pm

Re: New Skald RR5/ BD RR5 Addition

Postby Tolakram » Thu Apr 28, 2011 12:34 am

Keep at it Shawn, you can improve by learning what's wrong with this code. :)
- Mark
User avatar
Tolakram
Storm / Storm-D2 Admin
 
Posts: 9189
Joined: Tue Jun 13, 2006 1:49 am
Location: Kentucky, USA

Re: New Skald RR5/ BD RR5 Addition

Postby -Shawn- » Thu Apr 28, 2011 12:36 am

Alright then. Here's how you said it should be and it works :D. Enjoy!
Attachments
VoiceOfSkaldi+BDRR5Addition2.patch
(8.04 KiB) Downloaded 32 times
viewtopic.php?f=6&t=14984

Sky is the limit.
-Shawn-
DOL Devotee
 
Posts: 305
Joined: Tue Nov 24, 2009 1:47 am
Location: New York

Re: New Skald RR5/ BD RR5 Addition

Postby Dinberg » Thu Apr 28, 2011 9:28 am

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!
The Marvelous Contraption begins to stir...
User avatar
Dinberg
Inactive Staff Member
 
Posts: 4695
Joined: Sat Mar 10, 2007 9:47 am
Yahoo Messenger: dinberg_darktouch
Location: Jordheim

Re: New Skald RR5/ BD RR5 Addition

Postby Yemla » Thu Apr 28, 2011 10:49 am

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
Yemla
Contributor
 
Posts: 215
Joined: Sat Feb 02, 2008 3:21 am
Website: http://www.facebook.com/J.D.Snelling
Location: California

Re: New Skald RR5/ BD RR5 Addition

Postby Dinberg » Thu Apr 28, 2011 12:04 pm

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.
The Marvelous Contraption begins to stir...
User avatar
Dinberg
Inactive Staff Member
 
Posts: 4695
Joined: Sat Mar 10, 2007 9:47 am
Yahoo Messenger: dinberg_darktouch
Location: Jordheim

Re: New Skald RR5/ BD RR5 Addition

Postby Graveen » Thu May 12, 2011 8:43 am

The last patch Shawn provided is ok ?
Image
* pm me to contribute in Dawn of Light: code, database *
User avatar
Graveen
Project Leader
 
Posts: 12660
Joined: Fri Oct 19, 2007 9:22 pm
Location: France


Return to “%s” DOL Code Contributions

Who is online

Users browsing this forum: No registered users and 1 guest