I recently revised this code a bit if anyone is interested I thought i would share.
Code:
if(RuleB(Combat, UseIntervalAC)) {
damage = ((max_dmg+eleBane);
}
else {
damage = MakeRandomInt((min_dmg+eleBane) - (otherac * acdiv/100.0f),(max_dmg+eleBane) - (otherac * acdiv/100.0f));
}
//check if we're hitting above our max or below it.
if((min_dmg+eleBane) != 0 && damage < (min_dmg+eleBane)) {
mlog(COMBAT__DAMAGE, "Damage (%d) is below min (%d). Setting to min.", damage, (min_dmg+eleBane));
damage = ((min_dmg+eleBane) - (otherac * acdiv/100.0f));
}
if((max_dmg+eleBane) != 0 && damage > (max_dmg+eleBane)) {
mlog(COMBAT__DAMAGE, "Damage (%d) is above max (%d). Setting to max.", damage, (max_dmg+eleBane));
damage = (max_dmg+eleBane);
}
NOTE: This code makes it so that if a mob rolls max hit it would land and anything below max hit would be mitigated. Now for raid targets since they are multiple levels
above the tank they would hit for max like normal keeping the dmg high and the encounters hard. But for none raid targets as long as they arent red it would allow
ac to do what it needs to do to.
What this does is take a % of your ac and reduces each hit by that percent. So if you have it set at 2 it would be dmg = max dmg - the persons ac who is being hit * 2/100
or for example
dmg=20-100*2/100
dmg=20-200/100
dmg=20-2
dmg=18