Awesome. I just started playing around with an Ogre today and noticed this needed to be fixed. You saved me a lot of time.
One thing I did differently though is to make the Ogre check first. Six of one, half dozen of the other though.
Code:
//check stun chances if bashing
if (skill_used == BASH && GetLevel() < 56) {
int stun_resist = itembonuses.StunResist+spellbonuses.StunResist;
if(this->GetBaseRace() == OGRE && this->IsClient() && !attacker->BehindMob(this, attacker->GetX(), attacker->GetY())) {
mlog(COMBAT__HITS, "Stun Resisted. Ogres are immune to frontal melee stuns.");
} else {
if(stun_resist <= 0 || MakeRandomInt(0,99) >= stun_resist) {
mlog(COMBAT__HITS, "Stunned. We had %dpercent resist chance.");
Stun(0);
} else {
mlog(COMBAT__HITS, "Stun Resisted. We had %dpercent resist chance.");
}
}
}