Show
Ignore:
Timestamp:
11/19/08 13:39:20 (17 years ago)
Author:
yumileroy
Message:

[svn] Provide creature dual wield support.
Update glancing damage formula.
Do not daze creatures when other creatures attack from the back (need to find a better way).
Fix the damage calculation of +damage aura.

Original author: megamage
Date: 2008-10-29 20:00:21-05:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/Unit.cpp

    r131 r136  
    159159 
    160160    m_extraAttacks = 0; 
     161    m_canDualWield = false; 
    161162 
    162163    m_state = 0; 
     
    280281 
    281282    if(uint32 base_att = getAttackTimer(BASE_ATTACK)) 
    282     { 
    283283        setAttackTimer(BASE_ATTACK, (p_time >= base_att ? 0 : base_att - p_time) ); 
    284     } 
     284    if(uint32 ranged_att = getAttackTimer(RANGED_ATTACK)) 
     285        setAttackTimer(RANGED_ATTACK, (p_time >= ranged_att ? 0 : ranged_att - p_time) ); 
     286    if(uint32 off_att = getAttackTimer(OFF_ATTACK)) 
     287        setAttackTimer(OFF_ATTACK, (p_time >= off_att ? 0 : off_att - p_time) ); 
    285288 
    286289    // update abilities available only for fraction of time 
     
    298301        return ((Player*)this)->GetWeaponForAttack(OFF_ATTACK,true); 
    299302    else 
    300         return false; 
     303        return m_canDualWield; 
    301304} 
    302305 
     
    17701773    /// If this is a creature and it attacks from behind it has a probability to daze it's victim 
    17711774    if( (outcome==MELEE_HIT_CRIT || outcome==MELEE_HIT_CRUSHING || outcome==MELEE_HIT_NORMAL || outcome==MELEE_HIT_GLANCING) && 
    1772         GetTypeId() != TYPEID_PLAYER && !((Creature*)this)->GetCharmerOrOwnerGUID() && !pVictim->HasInArc(M_PI, this) ) 
     1775        GetTypeId() != TYPEID_PLAYER && !((Creature*)this)->GetCharmerOrOwnerGUID() && !pVictim->HasInArc(M_PI, this) 
     1776        && pVictim->GetTypeId() == TYPEID_PLAYER) 
    17731777    { 
    17741778        // -probability is between 0% and 40% 
     
    20572061        case MELEE_HIT_GLANCING: 
    20582062        { 
    2059             float reducePercent = 1.0f;                     //damage factor 
    2060  
    2061             // calculate base values and mods 
    2062             float baseLowEnd = 1.3; 
    2063             float baseHighEnd = 1.2; 
    2064             switch(getClass())                              // lowering base values for casters 
    2065             { 
    2066                 case CLASS_SHAMAN: 
    2067                 case CLASS_PRIEST: 
    2068                 case CLASS_MAGE: 
    2069                 case CLASS_WARLOCK: 
    2070                 case CLASS_DRUID: 
    2071                     baseLowEnd  -= 0.7; 
    2072                     baseHighEnd -= 0.3; 
    2073                     break; 
    2074             } 
    2075  
    2076             float maxLowEnd = 0.6; 
    2077             switch(getClass())                              // upper for melee classes 
    2078             { 
    2079                 case CLASS_WARRIOR: 
    2080                 case CLASS_ROGUE: 
    2081                     maxLowEnd = 0.91;                       //If the attacker is a melee class then instead the lower value of 0.91 
    2082             } 
    2083  
    2084             // calculate values 
    2085             int32 diff = int32(pVictim->GetDefenseSkillValue(this)) - int32(GetWeaponSkillValue(attType,pVictim)); 
    2086             float lowEnd  = baseLowEnd - ( 0.05f * diff ); 
    2087             float highEnd = baseHighEnd - ( 0.03f * diff ); 
    2088  
    2089             // apply max/min bounds 
    2090             if ( lowEnd < 0.01f )                           //the low end must not go bellow 0.01f 
    2091                 lowEnd = 0.01f; 
    2092             else if ( lowEnd > maxLowEnd )                  //the smaller value of this and 0.6 is kept as the low end 
    2093                 lowEnd = maxLowEnd; 
    2094  
    2095             if ( highEnd < 0.2f )                           //high end limits 
    2096                 highEnd = 0.2f; 
    2097             if ( highEnd > 0.99f ) 
    2098                 highEnd = 0.99f; 
    2099  
    2100             if(lowEnd > highEnd)                            // prevent negative range size 
    2101                 lowEnd = highEnd; 
    2102  
    2103             reducePercent = lowEnd + rand_norm() * ( highEnd - lowEnd ); 
    2104  
    2105             *damage = uint32(reducePercent * *damage); 
    2106             cleanDamage->damage += *damage; 
     2063            int32 leveldif = int32(pVictim->getLevel()) - int32(getLevel()); 
     2064            if (leveldif > 3) leveldif = 3; 
     2065            *damage *= (1 - leveldif * 0.1f); 
     2066            cleanDamage->damage = *damage; 
    21072067            *hitInfo |= HITINFO_GLANCING; 
    21082068            break; 
     
    75767536 
    75777537    float DoneActualBenefit = DoneAdvertisedBenefit * (CastingTime / 3500.0f) * DotFactor * SpellModSpellDamage * LvlPenalty; 
    7578     float TakenActualBenefit = TakenAdvertisedBenefit * (CastingTime / 3500.0f) * DotFactor * LvlPenalty; 
     7538    float TakenActualBenefit = TakenAdvertisedBenefit; 
     7539    if(spellProto->SpellFamilyName) 
     7540        TakenActualBenefit *= (CastingTime / 3500.0f) * DotFactor * LvlPenalty; 
    75797541 
    75807542    float tmpDamage = (float(pdamage)+DoneActualBenefit)*DoneTotalMod;