Stun Spell Duration Calculator

A place to submit .patch fixes for the DOL SVN

Moderator: Developer Team

Stun Spell Duration Calculator

Postby Kadorien » Wed Oct 27, 2010 3:08 pm

I was looking at CCSpellHandler today in regards to stun duration and came across the equation used to calculation Stun Spell Duration

This is the equation currently used:

duration *= target.GetModified(eProperty.StunDuration) * 0.01;

Now I am not the sharpest tool in the shed, but this equation is wrong, from my calculations, if you had +30 points of Stun Duration on an item the following would occur:
(Using a 9 second stun)

9 *= 30 * 0.01
9 *= .3
duration = 2.7

+30 points is equal to 30% calculated by *0.01. The correct equation should be

duration -= duration * (target.GetModified(eProperty.StunDuration) * 0.01)

9 -= 9 * (30 *0.01)
9 -= 9 * .3
duration = 9 - 2.7
duration = 6.3 (30% reduction in stun time)

Also, I haven't run across Stun Reduction much on live, but from what I can tell Stun Reduction is currently only coded for a Stun Spell, does anyone know if this is intentional (live like)
Kadorien
DOL Novice
 
Posts: 57
Joined: Wed Sep 08, 2010 1:14 am

Re: Stun Spell Duration Calculator

Postby Graveen » Wed Oct 27, 2010 3:44 pm

The CC spell handler is used for styles ?

Can you do a live test please ?

It seems what you notice makes sense ! :)
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

Re: Stun Spell Duration Calculator

Postby Kadorien » Wed Oct 27, 2010 4:20 pm

I can't do a live test :(. I can assure you my equation is correct.

In regards to the StyleStun, if you pull up StyleStun it uses its own Duration function that just returns the style's duration. I can't pull it up right now.

I don't even know what on live uses a Stun Duration bonus to test it out but I do know that in theory, 30 points of stun duration would be 30% so my equation would be the correct one to use.

Right now the stun is set to the opposite percent i.e +30 points of Stun Duration will cause 70% of the stun's time to be reduced.
Kadorien
DOL Novice
 
Posts: 57
Joined: Wed Sep 08, 2010 1:14 am

Re: Stun Spell Duration Calculator

Postby Kadorien » Wed Oct 27, 2010 4:32 pm

CCSpellHandler.cs code from within
[SpellHandlerAttribute("Stun")]
public class StunSpellHandler : AbstractCCSpellHandler
{}

Code: Select all
protected override int CalculateEffectDuration(GameLiving target, double effectiveness)
      {
         double duration = base.CalculateEffectDuration(target, effectiveness);
         duration *= target.GetModified(eProperty.StunDuration) * 0.01;

         if (duration < 1)
            duration = 1;
         else if (duration > (Spell.Duration * 4))
            duration = (Spell.Duration * 4);
         return (int)duration;
      }


StyleStun.cs code from within
[SpellHandler("StyleStun")]
public class StyleStun : StunSpellHandler
{}

Code: Select all
protected override int CalculateEffectDuration(GameLiving target, double effectiveness)
      {
         return Spell.Duration;
      }
Kadorien
DOL Novice
 
Posts: 57
Joined: Wed Sep 08, 2010 1:14 am


Return to “%s” DOL Code Contributions

Who is online

Users browsing this forum: No registered users and 1 guest