Go Back   EQEmulator Home > EQEmulator Forums > General > General::General Discussion

General::General Discussion General discussion about EverQuest(tm), EQEMu, and related topics.
Do not post support topics here.

Reply
 
Thread Tools Display Modes
  #1  
Old 05-30-2014, 05:14 PM
drmario
Fire Beetle
 
Join Date: May 2014
Posts: 4
Default 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.
Reply With Quote
  #2  
Old 05-30-2014, 06:12 PM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default

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
Reply With Quote
  #3  
Old 05-30-2014, 06:23 PM
drmario
Fire Beetle
 
Join Date: May 2014
Posts: 4
Default

Quote:
Originally Posted by NatedogEZ View Post
Heres the code if you think the math will better explain it :p
That could work, thank you!
Reply With Quote
  #4  
Old 05-30-2014, 06:34 PM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default

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
Reply With Quote
  #5  
Old 05-30-2014, 06:53 PM
drmario
Fire Beetle
 
Join Date: May 2014
Posts: 4
Default

Quote:
Originally Posted by NatedogEZ View Post
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?
Reply With Quote
  #6  
Old 05-30-2014, 07:57 PM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default

The formula looks incorrect.. its supposed to scale with level.. but it does not :p
Reply With Quote
  #7  
Old 05-30-2014, 08:09 PM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default

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
Reply With Quote
  #8  
Old 05-30-2014, 08:22 PM
drmario
Fire Beetle
 
Join Date: May 2014
Posts: 4
Default

Quote:
Originally Posted by NatedogEZ View Post
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!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 02:20 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3