diff options
author | QAston <none@none> | 2009-04-29 20:33:49 +0200 |
---|---|---|
committer | QAston <none@none> | 2009-04-29 20:33:49 +0200 |
commit | 3e45bb2bfb304fb304aa0d48d125c79ea8ffdfa2 (patch) | |
tree | 92150f0d7c7cf3a228b5c65441da6f77b44cab55 /src/game/Unit.cpp | |
parent | 40ba1b7030c0614a8cad8bdce8e9f51d5282a314 (diff) |
*Fix Blessing of Sanctuary
--HG--
branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r-- | src/game/Unit.cpp | 72 |
1 files changed, 71 insertions, 1 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 48b28179591..6df490c9185 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -6579,7 +6579,69 @@ bool Unit::HandleObsModEnergyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* if(!triggerEntry) { - sLog.outError("Unit::HandleDummyAuraProc: Spell %u have not existed triggered spell %u",dummySpell->Id,triggered_spell_id); + sLog.outError("Unit::HandleObsModEnergyAuraProc: Spell %u have not existed triggered spell %u",dummySpell->Id,triggered_spell_id); + return false; + } + + // default case + if(!target || target!=this && !target->isAlive()) + return false; + + if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id)) + return false; + + if(basepoints0) + CastCustomSpell(target,triggered_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura); + else + CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura); + + if( cooldown && GetTypeId()==TYPEID_PLAYER ) + ((Player*)this)->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown); + + return true; +} + +bool Unit::HandleModDamagePctTakenAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const * procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown) +{ + SpellEntry const *dummySpell = triggeredByAura->GetSpellProto (); + uint32 effIndex = triggeredByAura->GetEffIndex(); + int32 triggerAmount = triggeredByAura->GetAmount(); + + Item* castItem = triggeredByAura->GetParentAura()->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER + ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetParentAura()->GetCastItemGUID()) : NULL; + + uint32 triggered_spell_id = 0; + Unit* target = pVictim; + int32 basepoints0 = 0; + + switch(dummySpell->SpellFamilyName) + { + case SPELLFAMILY_PALADIN: + { + // Blessing of Sanctuary + if ( dummySpell->SpellFamilyFlags[0] & 0x10000000 ) + { + switch (getPowerType()) + { + case POWER_MANA: triggered_spell_id = 57319; break; + case POWER_RAGE: triggered_spell_id = 57320; break; + case POWER_RUNIC_POWER: triggered_spell_id = 57321; break; + default: + return false; + } + } + break; + } + } + // processed charge only counting case + if(!triggered_spell_id) + return true; + + SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id); + + if(!triggerEntry) + { + sLog.outError("Unit::HandleModDamagePctTakenAuraProc: Spell %u have not existed triggered spell %u",dummySpell->Id,triggered_spell_id); return false; } @@ -11752,6 +11814,14 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag sLog.outError("ObsModEnergy aura of spell %d procs twice from one effect!",spellInfo->Id); procDebug |= 2; break; + case SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN: + sLog.outDebug("ProcDamageAndSpell: casting spell id %u (triggered by %s aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); + if (!HandleModDamagePctTakenAuraProc(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown)) + continue; + if (procDebug & 16) + sLog.outError("ModDamagePctTaken aura of spell %d procs twice from one effect!",spellInfo->Id); + procDebug |= 16; + break; case SPELL_AURA_MOD_HASTE: { sLog.outDebug("ProcDamageAndSpell: casting spell id %u (triggered by %s haste aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); |