aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorQAston <none@none>2009-04-29 20:33:49 +0200
committerQAston <none@none>2009-04-29 20:33:49 +0200
commit3e45bb2bfb304fb304aa0d48d125c79ea8ffdfa2 (patch)
tree92150f0d7c7cf3a228b5c65441da6f77b44cab55 /src
parent40ba1b7030c0614a8cad8bdce8e9f51d5282a314 (diff)
*Fix Blessing of Sanctuary
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/SpellMgr.cpp2
-rw-r--r--src/game/Unit.cpp72
-rw-r--r--src/game/Unit.h1
3 files changed, 73 insertions, 2 deletions
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index da1ddc9c3e7..5c754c651d6 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -2557,7 +2557,7 @@ void SpellMgr::LoadPetLevelupSpellMap()
if(!spell || !spell->spellLevel || GetTalentSpellPos(spell->Id))
continue;
// TODO: some spells have no spellfamilyflag but should be learned
- if (!spell->SpellFamilyFlags)
+ if (!spell->SpellFamilyName)
continue;
mPetLevelupSpellMap.insert(PetLevelupSpellMap::value_type(creatureFamily->ID, std::make_pair(spell->spellLevel , spell->Id )));
count++;
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());
diff --git a/src/game/Unit.h b/src/game/Unit.h
index 055eb9f3a38..539d8859684 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -1709,6 +1709,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
bool IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura* aura, SpellEntry const * procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const *& spellProcEvent );
bool HandleDummyAuraProc( Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
bool HandleObsModEnergyAuraProc( Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
+ bool HandleModDamagePctTakenAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
bool HandleHasteAuraProc( Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
bool HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
bool HandleOverrideClassScriptAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 cooldown);