*Fix glancing damage calculation.

*Fix double threat spells: remove mind blast and earth shock, add frost shock.

--HG--
branch : trunk
This commit is contained in:
megamage
2008-12-19 20:23:34 -06:00
parent e4836ca85f
commit 7c5a88fdf7
3 changed files with 9 additions and 54 deletions
+1
View File
@@ -249,6 +249,7 @@ enum SpellEffectTargetTypes
#define SPELLFAMILYFLAG_ROGUE_KIDNEYSHOT 0x000200000LL #define SPELLFAMILYFLAG_ROGUE_KIDNEYSHOT 0x000200000LL
#define SPELLFAMILYFLAG_ROGUE__FINISHING_MOVE 0x9003E0000LL #define SPELLFAMILYFLAG_ROGUE__FINISHING_MOVE 0x9003E0000LL
#define SPELLFAMILYFLAG_WARRIOR_SUNDERARMOR 0x000004000LL #define SPELLFAMILYFLAG_WARRIOR_SUNDERARMOR 0x000004000LL
#define SPELLFAMILYFLAG_SHAMAN_FROST_SHOCK 0x080000000LL
// Spell clasification // Spell clasification
enum SpellSpecific enum SpellSpecific
+5 -51
View File
@@ -1793,51 +1793,9 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da
damageInfo->HitInfo |= HITINFO_GLANCING; damageInfo->HitInfo |= HITINFO_GLANCING;
damageInfo->TargetState = VICTIMSTATE_NORMAL; damageInfo->TargetState = VICTIMSTATE_NORMAL;
damageInfo->procEx|=PROC_EX_NORMAL_HIT; damageInfo->procEx|=PROC_EX_NORMAL_HIT;
float reducePercent = 1.0f; //damage factor int32 leveldif = int32(pVictim->getLevel()) - int32(getLevel());
// calculate base values and mods if (leveldif > 3) leveldif = 3;
float baseLowEnd = 1.3; float reducePercent = 1 - leveldif * 0.1f;
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 );
damageInfo->cleanDamage += damageInfo->damage-uint32(reducePercent * damageInfo->damage); damageInfo->cleanDamage += damageInfo->damage-uint32(reducePercent * damageInfo->damage);
damageInfo->damage = uint32(reducePercent * damageInfo->damage); damageInfo->damage = uint32(reducePercent * damageInfo->damage);
break; break;
@@ -2690,15 +2648,12 @@ void Unit::DoAttackDamage (Unit *pVictim, uint32 *damage, CleanDamage *cleanDama
void Unit::AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType, bool extra ) 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; return;
if (!pVictim->isAlive()) if (!pVictim->isAlive())
return; return;
if(IsNonMeleeSpellCasted(false))
return;
CombatStart(pVictim); CombatStart(pVictim);
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ATTACK); RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ATTACK);
@@ -9411,8 +9366,7 @@ bool Unit::IsDamageToThreatSpell(SpellEntry const * spellInfo) const
uint64 flags = spellInfo->SpellFamilyFlags; uint64 flags = spellInfo->SpellFamilyFlags;
if((family == 5 && flags == 256) || //Searing Pain if((family == 5 && flags == 256) || //Searing Pain
(family == 6 && flags == 8192) || //Mind Blast (family == SPELLFAMILY_SHAMAN && flags == SPELLFAMILYFLAG_SHAMAN_FROST_SHOCK))
(family == 11 && flags == 1048576)) //Earth Shock
return true; return true;
return false; return false;
+3 -3
View File
@@ -367,9 +367,9 @@ enum UnitState
UNIT_STAT_ISOLATED = 0x2000, // area auras do not affect other players UNIT_STAT_ISOLATED = 0x2000, // area auras do not affect other players
UNIT_STAT_ATTACK_PLAYER = 0x4000, UNIT_STAT_ATTACK_PLAYER = 0x4000,
UNIT_STAT_CASTING = 0x8000, UNIT_STAT_CASTING = 0x8000,
UNIT_STAT_SIGHTLESS = UNIT_STAT_LOST_CONTROL = (UNIT_STAT_CONFUSED | UNIT_STAT_STUNNED | UNIT_STAT_FLEEING),
(UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING UNIT_STAT_SIGHTLESS = (UNIT_STAT_LOST_CONTROL | UNIT_STAT_CHASE | UNIT_STAT_SEARCHING),
| UNIT_STAT_STUNNED | UNIT_STAT_CONFUSED), 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) UNIT_STAT_ALL_STATE = 0xffff //(UNIT_STAT_STOPPED | UNIT_STAT_MOVING | UNIT_STAT_IN_COMBAT | UNIT_STAT_IN_FLIGHT)
}; };