EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   General::General Discussion (https://www.eqemulator.org/forums/forumdisplay.php?f=586)
-   -   Question about buff duration - Durationformula (https://www.eqemulator.org/forums/showthread.php?t=38344)

drmario 05-30-2014 05:14 PM

Question about buff duration - Durationformula
 
Hi folks,

I have been trying to determine what is actually behind the "Durationformula" for spells to calculate the duration for levels 1-65. For some spells, it's pretty simple, for example:

- Ensnare: Buff Duration: 140 (14.0 minutes), Durationformula: "Level * 2 + 10" (durationformula 9).

With the above it's simple to figure out the spell duration for Ensnare at any character level.

However, with this spell, as an example:

- Snare: Buff Duration: 39 (3.9 minutes), Durationformula: "Duration * 3/5" (durationformula 2).

It's not easy (well, for me) to use this Durationformula and others to calculate duration by level.

I was hoping someone could shed some light into what "Duration * 3/5", "Duration / 2" etc. actually mean for determining the duration for the spells with those formulas at say, level 14, or whatever.

Thanks in advance.

NatedogEZ 05-30-2014 06:12 PM

Code:

// the generic formula calculations
int CalcBuffDuration_formula(int level, int formula, int duration)
{
        int i;        // temp variable

        switch(formula)
        {
                case 0:        // not a buff
                        return 0;

                case 1:
                        i = (int)ceil(level / 2.0f);
                        return i < duration ? (i < 1 ? 1 : i) : duration;

                case 2:
                        i = (int)ceil(duration / 5.0f * 3);
                        return i < duration ? (i < 1 ? 1 : i) : duration;

                case 3:
                        i = level * 30;
                        return i < duration ? (i < 1 ? 1 : i) : duration;

                case 4:        // only used by 'LowerElement'
                        return ((duration != 0) ? duration : 50);

                case 5:
                        i = duration;
                        // 0 value results in a 3 tick spell, else its between 1-3 ticks.
                        return i < 3 ? (i < 1 ? 3 : i) : 3;

                case 6:
                        i = (int)ceil(level / 2.0f);
                        return i < duration ? (i < 1 ? 1 : i) : duration;

                case 7:
                        i = level;
                        return (duration == 0) ? (i < 1 ? 1 : i) : duration;

                case 8:
                        i = level + 10;
                        return i < duration ? (i < 1 ? 1 : i) : duration;

                case 9:
                        i = level * 2 + 10;
                        return i < duration ? (i < 1 ? 1 : i) : duration;

                case 10:
                        i = level * 3 + 10;
                        return i < duration ? (i < 1 ? 1 : i) : duration;

                case 11:
                        return duration;

                case 12:
                        return duration;

                case 15:        // Don't know what the real formula for this should be. Used by Skinspikes potion.
                        return duration;

                case 50:        // lucy says this is unlimited?
                        return 72000;        // 5 days

                case 3600:
                        return duration ? duration : 3600;

                default:
                        LogFile->write(EQEMuLog::Debug, "CalcBuffDuration_formula: unknown formula %d", formula);
                        return 0;
        }
}



Heres the code if you think the math will better explain it :p

drmario 05-30-2014 06:23 PM

Quote:

Originally Posted by NatedogEZ (Post 230896)
Heres the code if you think the math will better explain it :p

That could work, thank you!

NatedogEZ 05-30-2014 06:34 PM

Also take note... the duration it returns is in "ticks" of 6 seconds

so if it returns a duration of 60 -- that is 6 minutes :)

drmario 05-30-2014 06:53 PM

Quote:

Originally Posted by NatedogEZ (Post 230898)
Also take note... the duration it returns is in "ticks" of 6 seconds

so if it returns a duration of 60 -- that is 6 minutes :)

I took a look at the full spells.cpp just now and that's pretty well explained too

However case 2:
Code:

i = (int)ceil(duration / 5.0f * 3);
return i < duration ? (i < 1 ? 1 : i) : duration;

is still mystifying to me. How is character level taken into account here for these spells including the druid level 1 Snare that clearly scales with level? O_o

It takes the duration, which default for Snare is "39", divides it by a float 5.0 * 3, rounds it to the nearest int, and that is supposed to = duration. What?

NatedogEZ 05-30-2014 07:57 PM

The formula looks incorrect.. its supposed to scale with level.. but it does not :p

NatedogEZ 05-30-2014 08:09 PM

Pretty sure case 2: should be this.... (going from what is posted on Lucy for spells that have that formula ID)


Code:

i = (int)ceil(level * 0.6f);
return i < duration ? (i < 1 ? 1 : i) : duration;


http://lucy.allakhazam.com/spell.htm...42&source=Live


At level 1 -- it returns 1 tick
at level 65 it returns 39 ticks (or MAX duration)


formula works with this spell too ... so it seems to be right on :)

http://lucy.allakhazam.com/spell.htm...97&source=Live

drmario 05-30-2014 08:22 PM

Quote:

Originally Posted by NatedogEZ (Post 230901)
Pretty sure case 2: should be this.... (going from what is posted on Lucy for spells that have that formula ID)


Code:

i = (int)ceil(level * 0.6f);
return i < duration ? (i < 1 ? 1 : i) : duration;


http://lucy.allakhazam.com/spell.htm...42&source=Live


At level 1 -- it returns 1 tick
at level 65 it returns 39 ticks (or MAX duration)


Works for me. Thanks again! :)


All times are GMT -4. The time now is 06:57 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.