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