Changeset 136 for trunk/src/game/Unit.cpp
- Timestamp:
- 11/19/08 13:39:20 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/Unit.cpp
r131 r136 159 159 160 160 m_extraAttacks = 0; 161 m_canDualWield = false; 161 162 162 163 m_state = 0; … … 280 281 281 282 if(uint32 base_att = getAttackTimer(BASE_ATTACK)) 282 {283 283 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) ); 285 288 286 289 // update abilities available only for fraction of time … … 298 301 return ((Player*)this)->GetWeaponForAttack(OFF_ATTACK,true); 299 302 else 300 return false;303 return m_canDualWield; 301 304 } 302 305 … … 1770 1773 /// If this is a creature and it attacks from behind it has a probability to daze it's victim 1771 1774 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) 1773 1777 { 1774 1778 // -probability is between 0% and 40% … … 2057 2061 case MELEE_HIT_GLANCING: 2058 2062 { 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; 2107 2067 *hitInfo |= HITINFO_GLANCING; 2108 2068 break; … … 7576 7536 7577 7537 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; 7579 7541 7580 7542 float tmpDamage = (float(pdamage)+DoneActualBenefit)*DoneTotalMod;