Description
So I noticed, when a mob is bashing or kicking as a warrior, a roll is done in this code attack.cpp:4461 a roll of
if (zone->random.Int(0, 100) >= stun_resist) {
is done.
I looked up random.Int, and if I'm not corrected, this is doing a range of 0 to 100 inclusive, not exclusive.
So, the possible values of this random is 0 to 100
since it's doing an equal check or greater than check, it means that if a player has stun immunity va AAs, stun_resist will reach 100, and they'll still have a 1% chance to be stunned...
Is my conclusion correct? This oversight may be in other chunks of code too
seems lua is inclusive:
math.random() with no arguments generates a real number between 0 and 1.
math.random(upper) generates integer numbers between 1 and upper (both inclusive).
math.random(lower, upper) generates integer numbers between lower and upper (both inclusive).
perl is inclusive:
int(rand(10))
returns a random integer between 0 and 9, inclusive.
our random.Int is inclusive:
int Int(int low, int high)
{
if (low > high)
std::swap(low, high);
// EQ uses biased int distribution, so I guess we can support it :P
#ifdef BIASED_INT_DIST
return low + m_gen() % (high - low + 1);
#else
return int_dist(m_gen, int_param_t(low, high)); // [low, high]
#endif
}
so 0, 100 means 0 to 100 are valid values
the stun immunity rank effect of AAs ends up with a value 100
(zone->random.Int(0, 100) >= stun_resist)
this roll is 0 to 100, and checks if the random roll of 0 to 100 is greater or equal to your stun resist. Since immunity is 100, this means when it's 100, you still have a roll of 100 matching and getting stunned, so it's not true immunity
so changing it to (zone->random.Int(0, 100) > stun_resist)
makes it impossible to be stunned at 100.
but if left with >=, rolling 100 still gets you stunned.