From d0820023bf7caa16981ebe477f88ecbfdf9bcdfc Mon Sep 17 00:00:00 2001 From: DiSlord Date: Mon, 26 Jan 2009 00:45:46 +0300 Subject: [PATCH] [7184] Implement more generic work for some SPELL_AURA_OVERRIDE_CLASS_SCRIPTS auras Fix warlock 17804 and ranks Implement druid 643 set bonus Shaman 23199, 28248, 32330 item (totems) DK 49202 and ranks, 49024 and ranks Priest 47573 and ranks Hunter 53241 and ranks Signed-off-by: DiSlord --- src/game/SpellAuras.cpp | 53 ------------------- src/game/Unit.cpp | 132 ++++++++++++++++++++++++++++++++++++++++++++--- src/shared/revision_nr.h | 2 +- 3 files changed, 127 insertions(+), 60 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index f47fe36ee..47b6f2c4b 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -5748,59 +5748,6 @@ void Aura::PeriodicTick() pdamage = pCaster->SpellDamageBonus(m_target,GetSpellProto(),pdamage,DOT); - // talent Soul Siphon add bonus to Drain Life spells - if( GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellProto()->SpellFamilyFlags & 0x8) ) - { - // find talent max bonus percentage - Unit::AuraList const& mClassScriptAuras = pCaster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for(Unit::AuraList::const_iterator i = mClassScriptAuras.begin(); i != mClassScriptAuras.end(); ++i) - { - if ((*i)->GetModifier()->m_miscvalue == 4992 || (*i)->GetModifier()->m_miscvalue == 4993) - { - if((*i)->GetEffIndex()!=1) - { - sLog.outError("Expected spell %u structure change, need code update",(*i)->GetId()); - break; - } - - // effect 1 m_amount - int32 maxPercent = (*i)->GetModifier()->m_amount; - // effect 0 m_amount - int32 stepPercent = pCaster->CalculateSpellDamage((*i)->GetSpellProto(),0,(*i)->GetSpellProto()->EffectBasePoints[0],pCaster); - - // count affliction effects and calc additional damage in percentage - int32 modPercent = 0; - Unit::AuraMap const& victimAuras = m_target->GetAuras(); - for (Unit::AuraMap::const_iterator itr = victimAuras.begin(); itr != victimAuras.end(); ++itr) - { - Aura* aura = itr->second; - if (aura->IsPositive())continue; - SpellEntry const* m_spell = aura->GetSpellProto(); - if (m_spell->SpellFamilyName != SPELLFAMILY_WARLOCK) - continue; - - SkillLineAbilityMap::const_iterator lower = spellmgr.GetBeginSkillLineAbilityMap(m_spell->Id); - SkillLineAbilityMap::const_iterator upper = spellmgr.GetEndSkillLineAbilityMap(m_spell->Id); - - for(SkillLineAbilityMap::const_iterator _spell_idx = lower; _spell_idx != upper; ++_spell_idx) - { - if(_spell_idx->second->skillId == SKILL_AFFLICTION) - { - modPercent += stepPercent; - if (modPercent >= maxPercent) - { - modPercent = maxPercent; - break; - } - } - } - } - pdamage += (pdamage*modPercent/100); - break; - } - } - } - //As of 2.2 resilience reduces damage from DoT ticks as much as the chance to not be critically hit // Reduce dot damage from resilience for players if (m_target->GetTypeId()==TYPEID_PLAYER) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 1bc557487..9e04d2b7d 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -7477,19 +7477,139 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 if( (*i)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spellProto) ) TakenTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; - // .. taken pct: scripted (increases damage of * against targets *) + // done scripted mod AuraList const& mOverrideClassScript = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); for(AuraList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i) { + if (!(*i)->isAffectedOnSpell(spellProto)) + continue; switch((*i)->GetModifier()->m_miscvalue) { - //Molten Fury - case 4920: case 4919: + // Molten Fury + case 4920: + case 4919: + { if(pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT)) - TakenTotalMod *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f; break; + TakenTotalMod *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f; + break; + } + // Soul Siphon + case 4992: + case 4993: + { + // effect 1 m_amount + int32 maxPercent = (*i)->GetModifier()->m_amount; + // effect 0 m_amount + int32 stepPercent = CalculateSpellDamage((*i)->GetSpellProto(), 0, (*i)->GetSpellProto()->EffectBasePoints[0], this); + // count affliction effects and calc additional damage in percentage + int32 modPercent = 0; + Unit::AuraMap const& victimAuras = pVictim->GetAuras(); + for (Unit::AuraMap::const_iterator itr = victimAuras.begin(); itr != victimAuras.end(); ++itr) + { + SpellEntry const* m_spell = itr->second->GetSpellProto(); + if (m_spell->SpellFamilyName != SPELLFAMILY_WARLOCK || !(m_spell->SpellFamilyFlags & 0x0004071B8044C402LL)) + continue; + modPercent += stepPercent; + if (modPercent >= maxPercent) + { + modPercent = maxPercent; + break; + } + } + DoneTotalMod *= (modPercent+100.0f)/100.0f; + break; + } + // Starfire Bonus + case 5481: + { + AuraList const& auras = pVictim->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); + for(AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + { + SpellEntry const* m_spell = (*itr)->GetSpellProto(); + if (m_spell->SpellFamilyName == SPELLFAMILY_DRUID && + m_spell->SpellFamilyFlags & 0x0000000000200002LL) + { + DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; + break; + } + } + break; + } + // Increased Lightning Damage + case 4554: + case 5142: + case 6008: + { + pdamage+=(*i)->GetModifier()->m_amount; + break; + } + // Tundra Stalker + // Merciless Combat + case 7277: + { + // Merciless Combat + if ((*i)->GetSpellProto()->SpellIconID == 2656) + { + if(pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT)) + TakenTotalMod *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f; + } + else // Tundra Stalker + { + AuraList const& auras = pVictim->GetAurasByType(SPELL_AURA_DUMMY); + for(AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + { + SpellEntry const* m_spell = (*itr)->GetSpellProto(); + if (m_spell->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && + m_spell->SpellFamilyFlags & 0x0400000000000000LL) + { + DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; + break; + } + } + } + break; + } + // Twisted Faith + case 7377: + { + AuraList const& auras = pVictim->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); + for(AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + { + SpellEntry const* m_spell = (*itr)->GetSpellProto(); + if (m_spell->SpellFamilyName == SPELLFAMILY_PRIEST && + m_spell->SpellFamilyFlags & 0x0000000000008000LL && + (*itr)->GetCasterGUID()==GetGUID()) + { + DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; + break; + } + } + break; + } + } + } + // taken scripted mod + AuraList const& mOverrideClassScriptTaken = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); + for(AuraList::const_iterator i = mOverrideClassScriptTaken.begin(); i != mOverrideClassScriptTaken.end(); ++i) + { + if (!(*i)->isAffectedOnSpell(spellProto)) + continue; + switch((*i)->GetModifier()->m_miscvalue) + { + // Marked for Death + case 7598: + case 7599: + case 7600: + case 7601: + case 7602: + { + if ((*i)->GetCasterGUID()==GetGUID() || // Self + (*i)->GetCasterGUID()==GetOwnerGUID()) // Owner + DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; + break; + } } } - // .. taken pct: dummy auras AuraList const& mDummyAuras = pVictim->GetAurasByType(SPELL_AURA_DUMMY); for(AuraList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) @@ -7508,7 +7628,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 TakenTotalMod *= (mod+100.0f)/100.0f; } break; - //Mangle + // Mangle case 2312: for(int j=0;j<3;j++) { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index aecd6e404..102e3a390 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7183" + #define REVISION_NR "7184" #endif // __REVISION_NR_H__ -- 2.11.4.GIT