View Single Post

znihilist's Avatar


znihilist
01.30.2014 , 06:21 AM | #197
Quote: Originally Posted by Docmal View Post
Oh I see what you are asking now. I reviewed the code and misses are currently counted when the avg is calculated for damage out but not damage in. This seems like an oversight so I will be changing that in the next release.
Okay, check this piece of code, it uses the average method but without making a second pass on the numbers. However, if the first MH hit misses, then it will register the first OH hit as a MH hit. But it will regulate itself once it register another MH hit.

Code:
/*
isoffhand equals 1 if offhand hit or 0 if mainhand
hit is the damage of hit
average is the average value of hits
hitcounter is a counter of how many of the same ability we had including the one being evaluated right now
ohcount is counter of how many oh hits the algorithm have counted so far
mhcount is counter of how many mh hits the algorithm have counted so far
ohav is the average value of the offhand hits selected by the algorithm
mhav is the average value of the mainhand hits selected by the algorithm
*/
void isoffhand(double hit, double *average, bool *isoffhand, double hitcounter, double *ohcount, double *mhcount, double *ohav, double *mhav) 
{
	if (hitcounter == 1) *average = (hit) / 2.;
	else *average = ( (*average) * (hitcoutner-1) + (hit) ) / (hitcounter);
	if ( hit <= *average ) 
		{
			*isoffhand = 1;
			(*ohcount)++;
			if ( *ohcount == 1 ) *ohav=hit/2.;
			else *ohav = ( (*ohav) * (*ohcount) + (hit) ) / ( *ohcount + 1. );
	    }
	else 
		{
			*isoffhand = 0;
			(*mhcount)++;
			if ( *mhcount == 1 ) *mhav=hit/2.;
			else *mhav = ( (*mhav) * (*mhcount) + (hit) ) / ( *mhcount + 1. );
		}
}
Ps, there is bound to be an error or something wrong. But the idea is there!
(Also it might bloat out the overall code)
SWTOR: KotFE, Rise of the Ehh I guess I'll get used to it eventually
__________________________________________________
This is what a tentative roadmap should look like.