View Single Post
  #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