diff options
author | megamage <none@none> | 2008-12-19 20:23:34 -0600 |
---|---|---|
committer | megamage <none@none> | 2008-12-19 20:23:34 -0600 |
commit | 7c5a88fdf7f147ed36d110d503b0156ad4aea126 (patch) | |
tree | 0e02fa917daab385d1507689a5147e696ae1b75a /src | |
parent | e4836ca85fe0ba3ebfefc7e0defafff2534228e9 (diff) |
*Fix glancing damage calculation.
*Fix double threat spells: remove mind blast and earth shock, add frost shock.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/SpellMgr.h | 1 | ||||
-rw-r--r-- | src/game/Unit.cpp | 56 | ||||
-rw-r--r-- | src/game/Unit.h | 6 |
3 files changed, 9 insertions, 54 deletions
diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 2df825a8073..8bd43e81030 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -249,6 +249,7 @@ enum SpellEffectTargetTypes #define SPELLFAMILYFLAG_ROGUE_KIDNEYSHOT 0x000200000LL #define SPELLFAMILYFLAG_ROGUE__FINISHING_MOVE 0x9003E0000LL #define SPELLFAMILYFLAG_WARRIOR_SUNDERARMOR 0x000004000LL +#define SPELLFAMILYFLAG_SHAMAN_FROST_SHOCK 0x080000000LL // Spell clasification enum SpellSpecific diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 11cc5b73899..24d1f3a3121 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1793,51 +1793,9 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da damageInfo->HitInfo |= HITINFO_GLANCING; damageInfo->TargetState = VICTIMSTATE_NORMAL; damageInfo->procEx|=PROC_EX_NORMAL_HIT; - float reducePercent = 1.0f; //damage factor - // calculate base values and mods - float baseLowEnd = 1.3; - float baseHighEnd = 1.2; - switch(getClass()) // lowering base values for casters - { - case CLASS_SHAMAN: - case CLASS_PRIEST: - case CLASS_MAGE: - case CLASS_WARLOCK: - case CLASS_DRUID: - baseLowEnd -= 0.7; - baseHighEnd -= 0.3; - break; - } - - float maxLowEnd = 0.6; - switch(getClass()) // upper for melee classes - { - case CLASS_WARRIOR: - case CLASS_ROGUE: - maxLowEnd = 0.91; //If the attacker is a melee class then instead the lower value of 0.91 - } - - // calculate values - int32 diff = damageInfo->target->GetDefenseSkillValue() - GetWeaponSkillValue(damageInfo->attackType); - float lowEnd = baseLowEnd - ( 0.05f * diff ); - float highEnd = baseHighEnd - ( 0.03f * diff ); - - // apply max/min bounds - if ( lowEnd < 0.01f ) //the low end must not go bellow 0.01f - lowEnd = 0.01f; - else if ( lowEnd > maxLowEnd ) //the smaller value of this and 0.6 is kept as the low end - lowEnd = maxLowEnd; - - if ( highEnd < 0.2f ) //high end limits - highEnd = 0.2f; - if ( highEnd > 0.99f ) - highEnd = 0.99f; - - if(lowEnd > highEnd) // prevent negative range size - lowEnd = highEnd; - - reducePercent = lowEnd + rand_norm() * ( highEnd - lowEnd ); - + int32 leveldif = int32(pVictim->getLevel()) - int32(getLevel()); + if (leveldif > 3) leveldif = 3; + float reducePercent = 1 - leveldif * 0.1f; damageInfo->cleanDamage += damageInfo->damage-uint32(reducePercent * damageInfo->damage); damageInfo->damage = uint32(reducePercent * damageInfo->damage); break; @@ -2690,15 +2648,12 @@ void Unit::DoAttackDamage (Unit *pVictim, uint32 *damage, CleanDamage *cleanDama void Unit::AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType, bool extra ) { - if(hasUnitState(UNIT_STAT_CONFUSED | UNIT_STAT_STUNNED | UNIT_STAT_FLEEING) || HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED) ) + if(hasUnitState(UNIT_STAT_CANNOT_AUTOATTACK) || HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED) ) return; if (!pVictim->isAlive()) return; - if(IsNonMeleeSpellCasted(false)) - return; - CombatStart(pVictim); RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ATTACK); @@ -9411,8 +9366,7 @@ bool Unit::IsDamageToThreatSpell(SpellEntry const * spellInfo) const uint64 flags = spellInfo->SpellFamilyFlags; if((family == 5 && flags == 256) || //Searing Pain - (family == 6 && flags == 8192) || //Mind Blast - (family == 11 && flags == 1048576)) //Earth Shock + (family == SPELLFAMILY_SHAMAN && flags == SPELLFAMILYFLAG_SHAMAN_FROST_SHOCK)) return true; return false; diff --git a/src/game/Unit.h b/src/game/Unit.h index 5efc1a1b3fe..0e3294c0c67 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -367,9 +367,9 @@ enum UnitState UNIT_STAT_ISOLATED = 0x2000, // area auras do not affect other players UNIT_STAT_ATTACK_PLAYER = 0x4000, UNIT_STAT_CASTING = 0x8000, - UNIT_STAT_SIGHTLESS = - (UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING - | UNIT_STAT_STUNNED | UNIT_STAT_CONFUSED), + UNIT_STAT_LOST_CONTROL = (UNIT_STAT_CONFUSED | UNIT_STAT_STUNNED | UNIT_STAT_FLEEING), + UNIT_STAT_SIGHTLESS = (UNIT_STAT_LOST_CONTROL | UNIT_STAT_CHASE | UNIT_STAT_SEARCHING), + UNIT_STAT_CANNOT_AUTOATTACK = (UNIT_STAT_LOST_CONTROL | UNIT_STAT_CASTING), UNIT_STAT_ALL_STATE = 0xffff //(UNIT_STAT_STOPPED | UNIT_STAT_MOVING | UNIT_STAT_IN_COMBAT | UNIT_STAT_IN_FLIGHT) }; |