Calculate spell critical hit chance at spell cast instead spell hit. Patch by thenecromancer.
--HG-- branch : trunk
This commit is contained in:
+8
-1
@@ -731,6 +731,7 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex)
|
||||
target.effectMask = 1<<effIndex; // Store index of effect
|
||||
target.processed = false; // Effects not apply on target
|
||||
target.damage = 0;
|
||||
target.crit = false;
|
||||
|
||||
// Calculate hit result
|
||||
if(m_originalCaster)
|
||||
@@ -1034,7 +1035,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
|
||||
SpellNonMeleeDamage damageInfo(caster, unitTarget, m_spellInfo->Id, m_spellSchoolMask);
|
||||
|
||||
// Add bonuses and fill damageInfo struct
|
||||
caster->CalculateSpellDamageTaken(&damageInfo, m_damage, m_spellInfo);
|
||||
caster->CalculateSpellDamageTaken(&damageInfo, m_damage, m_spellInfo, m_attackType, target->crit);
|
||||
|
||||
// Send log damage message to client
|
||||
caster->SendSpellNonMeleeDamageLog(&damageInfo);
|
||||
@@ -5438,11 +5439,17 @@ void Spell::CalculateDamageDoneForAllTargets()
|
||||
continue;
|
||||
|
||||
if (target.missCondition==SPELL_MISS_NONE) // In case spell hit target, do all effect on that target
|
||||
{
|
||||
target.damage += CalculateDamageDone(unit, mask, multiplier);
|
||||
target.crit = m_caster->isSpellCrit(unit, m_spellInfo, m_spellSchoolMask, m_attackType);
|
||||
}
|
||||
else if (target.missCondition == SPELL_MISS_REFLECT) // In case spell reflect from target, do all effect on caster (if hit)
|
||||
{
|
||||
if (target.reflectResult == SPELL_MISS_NONE) // If reflected spell hit caster -> do all effect on him
|
||||
{
|
||||
target.damage += CalculateDamageDone(m_caster, mask, multiplier);
|
||||
target.crit = m_caster->isSpellCrit(m_caster, m_spellInfo, m_spellSchoolMask, m_attackType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -525,6 +525,7 @@ class Spell
|
||||
uint8 effectMask:8;
|
||||
bool processed:1;
|
||||
int32 damage;
|
||||
bool crit;
|
||||
};
|
||||
std::list<TargetInfo> m_UniqueTargetInfo;
|
||||
uint8 m_needAliveTargetMask; // Mask req. alive targets
|
||||
|
||||
+2
-2
@@ -1169,7 +1169,7 @@ uint32 Unit::SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage
|
||||
return damageInfo.damage;
|
||||
}
|
||||
|
||||
void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 damage, SpellEntry const *spellInfo, WeaponAttackType attackType)
|
||||
void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 damage, SpellEntry const *spellInfo, WeaponAttackType attackType, bool crit)
|
||||
{
|
||||
if (damage < 0)
|
||||
return;
|
||||
@@ -1181,7 +1181,7 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 dama
|
||||
SpellSchoolMask damageSchoolMask = SpellSchoolMask(damageInfo->schoolMask);
|
||||
uint32 crTypeMask = pVictim->GetCreatureTypeMask();
|
||||
// Check spell crit chance
|
||||
bool crit = isSpellCrit(pVictim, spellInfo, damageSchoolMask, attackType);
|
||||
//bool crit = isSpellCrit(pVictim, spellInfo, damageSchoolMask, attackType);
|
||||
bool blocked = false;
|
||||
// Per-school calc
|
||||
switch (spellInfo->DmgClass)
|
||||
|
||||
+1
-1
@@ -957,7 +957,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
||||
void CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *damageInfo, WeaponAttackType attackType = BASE_ATTACK);
|
||||
void DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss);
|
||||
|
||||
void CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 damage, SpellEntry const *spellInfo, WeaponAttackType attackType = BASE_ATTACK);
|
||||
void CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 damage, SpellEntry const *spellInfo, WeaponAttackType attackType = BASE_ATTACK, bool crit = false);
|
||||
void DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss);
|
||||
|
||||
float MeleeSpellMissChance(const Unit *pVictim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const;
|
||||
|
||||
Reference in New Issue
Block a user