aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2009-06-15 23:38:57 -0500
committermegamage <none@none>2009-06-15 23:38:57 -0500
commit74e4f3f0592ee2800a1bd4f3000b5429d7bb865f (patch)
tree02de772aa71df0922f7fca83519b58f13298879d /src
parentcc527c884e9f643cadfd7ef186fbd419103c867b (diff)
parentc7c092f54bc6aa988991c601d532322c5cb8df32 (diff)
*Merge.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/Spell.cpp11
-rw-r--r--src/game/Spell.h1
-rw-r--r--src/game/Unit.cpp4
-rw-r--r--src/game/Unit.h2
4 files changed, 13 insertions, 5 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 68cc5c04659..9d730761903 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -868,6 +868,7 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex)
target.processed = false; // Effects not apply on target
target.alive = pVictim->isAlive();
target.damage = 0;
+ target.crit = false;
// Calculate hit result
if(m_originalCaster)
@@ -1094,7 +1095,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);
caster->DealDamageMods(damageInfo.target,damageInfo.damage,&damageInfo.absorb);
// Send log damage message to client
@@ -6082,11 +6083,17 @@ void Spell::CalculateDamageDoneForAllTargets()
}
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)
{
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);
+ }
}
}
}
diff --git a/src/game/Spell.h b/src/game/Spell.h
index 5d108f48fa1..adc661e206b 100644
--- a/src/game/Spell.h
+++ b/src/game/Spell.h
@@ -564,6 +564,7 @@ class Spell
bool processed:1;
bool alive:1;
int32 damage;
+ bool crit;
};
std::list<TargetInfo> m_UniqueTargetInfo;
uint8 m_needAliveTargetMask; // Mask req. alive targets
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 190aea1b923..75ee0e3784d 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -1271,7 +1271,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;
@@ -1283,7 +1283,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)
diff --git a/src/game/Unit.h b/src/game/Unit.h
index ce1c0265268..fc27db35c42 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -1194,7 +1194,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);
int32 GetIgnoredArmorMultiplier(SpellEntry const *spellInfo, WeaponAttackType attackType);
void DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss);