Core/Spells: Fixed Envenom damage

- The players AP should stack with combo points, not deadly poison stack.
+ some cleanup
Thanks @Cepox (and some others at google code issue tracker)

Closes #2929
This commit is contained in:
kaelima
2011-12-16 08:15:55 +01:00
parent 7f114b8ab7
commit 929ad95525
+44 -34
View File
@@ -606,57 +606,67 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
case SPELLFAMILY_ROGUE:
{
// Envenom
if (m_caster->GetTypeId() == TYPEID_PLAYER && (m_spellInfo->SpellFamilyFlags[1] & 0x8))
if (m_spellInfo->SpellFamilyFlags[1] & 0x00000008)
{
// consume from stack dozes not more that have combo-points
if (uint32 combo = m_caster->ToPlayer()->GetComboPoints())
if (Player* player = m_caster->ToPlayer())
{
// Lookup for Deadly poison (only attacker applied)
if (AuraEffect const* aurEff = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x10000, 0, 0, m_caster->GetGUID()))
// consume from stack dozes not more that have combo-points
if (uint32 combo = player->GetComboPoints())
{
// count consumed deadly poison doses at target
bool needConsume = true;
uint32 spellId = aurEff->GetId();
uint32 doses = aurEff->GetBase()->GetStackAmount();
if (doses > combo)
doses = combo;
// Master Poisoner
Unit::AuraEffectList const& auraList = m_caster->ToPlayer()->GetAuraEffectsByType(SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK);
for (Unit::AuraEffectList::const_iterator iter = auraList.begin(); iter != auraList.end(); ++iter)
// Lookup for Deadly poison (only attacker applied)
if (AuraEffect const* aurEff = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x00010000, 0, 0, m_caster->GetGUID()))
{
if ((*iter)->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_ROGUE && (*iter)->GetSpellInfo()->SpellIconID == 1960)
// count consumed deadly poison doses at target
bool needConsume = true;
uint32 spellId = aurEff->GetId();
uint32 doses = aurEff->GetBase()->GetStackAmount();
if (doses > combo)
doses = combo;
// Master Poisoner
Unit::AuraEffectList const& auraList = player->GetAuraEffectsByType(SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK);
for (Unit::AuraEffectList::const_iterator iter = auraList.begin(); iter != auraList.end(); ++iter)
{
uint32 chance = (*iter)->GetSpellInfo()->Effects[EFFECT_2].CalcValue(m_caster);
if ((*iter)->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_ROGUE && (*iter)->GetSpellInfo()->SpellIconID == 1960)
{
uint32 chance = (*iter)->GetSpellInfo()->Effects[EFFECT_2].CalcValue(m_caster);
if (chance && roll_chance_i(chance))
needConsume = false;
if (chance && roll_chance_i(chance))
needConsume = false;
break;
break;
}
}
if (needConsume)
for (uint32 i = 0; i < doses; ++i)
unitTarget->RemoveAuraFromStack(spellId);
damage *= doses;
damage += int32(player->GetTotalAttackPowerValue(BASE_ATTACK) * 0.09f * combo);
}
if (needConsume)
for (uint32 i = 0; i < doses; ++i)
unitTarget->RemoveAuraFromStack(spellId);
damage *= doses;
damage += int32(((Player*)m_caster)->GetTotalAttackPowerValue(BASE_ATTACK) * 0.09f * doses);
// Eviscerate and Envenom Bonus Damage (item set effect)
if (m_caster->HasAura(37169))
damage += combo * 40;
}
// Eviscerate and Envenom Bonus Damage (item set effect)
if (m_caster->HasAura(37169))
damage += ((Player*)m_caster)->GetComboPoints()*40;
}
}
// Eviscerate
else if ((m_spellInfo->SpellFamilyFlags[0] & 0x00020000) && m_caster->GetTypeId() == TYPEID_PLAYER)
else if (m_spellInfo->SpellFamilyFlags[0] & 0x00020000)
{
if (uint32 combo = ((Player*)m_caster)->GetComboPoints())
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
damage += irand(int32(ap * combo * 0.03f), int32(ap * combo * 0.07f));
if (uint32 combo = ((Player*)m_caster)->GetComboPoints())
{
float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
damage += irand(int32(ap * combo * 0.03f), int32(ap * combo * 0.07f));
// Eviscerate and Envenom Bonus Damage (item set effect)
if (m_caster->HasAura(37169))
damage += combo*40;
// Eviscerate and Envenom Bonus Damage (item set effect)
if (m_caster->HasAura(37169))
damage += combo*40;
}
}
}
break;