All pastes #634456 Raw Edit

Untitled

public cpp v1 · immutable
#634456 ·published 2007-07-26 12:14 UTC
rendered paste body
int32 Unit::MeleeMissChanceCalc(const Unit *pVictim) const{    if(!pVictim)        return 0;    // Base misschance 5%    int32 misschance = 500;    // DualWield - Melee spells and physical dmg spells - 5% , white damage 24%    if (haveOffhandWeapon())    {        if ((m_currentSpells[CURRENT_MELEE_SPELL]) ||           (m_currentSpells[CURRENT_GENERIC_SPELL] &&             m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->School == SPELL_SCHOOL_NORMAL))        {            misschance = 500;        }        else        {            misschance = 2400;        }    }    // PvP : PvE melee misschances per leveldif > 2    int32 chance = pVictim->GetTypeId() == TYPEID_PLAYER ? 500 : 700;    int32 leveldif = pVictim->getLevel() - getLevel();    if(leveldif < 0)        leveldif = 0;    if(leveldif < 3)        misschance += leveldif * 100 - m_modHitChance*100;    else        misschance += (leveldif - 2) * chance - m_modHitChance*100;    return misschance > 6000 ? 6000 : misschance;}