Core/Spell: convert more spells to SpellScripts

This commit is contained in:
joschiwald committed 2013-01-22 23:36:51 +01:00
1 parent 017ff298dd
commit af50ce6223
21 files changed
+1795 -801

No files matched your search

+8 -639
View File
@@ -256,8 +256,8 @@ Unit::Unit(bool isWorldObject): WorldObject(isWorldObject)
m_speed_rate[i] = 1.0f;
m_charmInfo = NULL;
m_reducedThreatPercent = 0;
m_misdirectionTargetGUID = 0;
_redirectThreadInfo = RedirectThreatInfo();
// remove aurastates allowing special moves
for (uint8 i = 0; i < MAX_REACTIVE; ++i)
@@ -4984,127 +4984,6 @@ void Unit::SendAttackStateUpdate(uint32 HitInfo, Unit* target, uint8 /*SwingType
SendAttackStateUpdate(&dmgInfo);
}
bool Unit::HandleHasteAuraProc(Unit* victim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 cooldown)
{
SpellInfo const* hasteSpell = triggeredByAura->GetSpellInfo();
Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER
? ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : NULL;
uint32 triggered_spell_id = 0;
Unit* target = victim;
int32 basepoints0 = 0;
switch (hasteSpell->SpellFamilyName)
{
case SPELLFAMILY_ROGUE:
{
switch (hasteSpell->Id)
{
// Blade Flurry
case 13877:
case 33735:
{
target = SelectNearbyTarget(victim);
if (!target)
return false;
basepoints0 = damage;
triggered_spell_id = 22482;
break;
}
}
break;
}
}
// processed charge only counting case
if (!triggered_spell_id)
return true;
SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!triggerEntry)
{
sLog->outError(LOG_FILTER_UNITS, "Unit::HandleHasteAuraProc: Spell %u has non-existing triggered spell %u", hasteSpell->Id, triggered_spell_id);
return false;
}
if (cooldown && GetTypeId() == TYPEID_PLAYER && ToPlayer()->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)
ToPlayer()->AddSpellCooldown(triggered_spell_id, 0, time(NULL) + cooldown);
return true;
}
bool Unit::HandleSpellCritChanceAuraProc(Unit* victim, uint32 /*damage*/, AuraEffect* triggeredByAura, SpellInfo const* /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 cooldown)
{
SpellInfo const* triggeredByAuraSpell = triggeredByAura->GetSpellInfo();
Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER
? ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : NULL;
uint32 triggered_spell_id = 0;
Unit* target = victim;
int32 basepoints0 = 0;
switch (triggeredByAuraSpell->SpellFamilyName)
{
case SPELLFAMILY_MAGE:
{
switch (triggeredByAuraSpell->Id)
{
// Focus Magic
case 54646:
{
Unit* caster = triggeredByAura->GetCaster();
if (!caster)
return false;
triggered_spell_id = 54648;
target = caster;
break;
}
}
}
}
// processed charge only counting case
if (!triggered_spell_id)
return true;
SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!triggerEntry)
{
sLog->outError(LOG_FILTER_UNITS, "Unit::HandleHasteAuraProc: Spell %u has non-existing triggered spell %u", triggeredByAuraSpell->Id, triggered_spell_id);
return false;
}
// default case
if (!target || (target != this && !target->isAlive()))
return false;
if (cooldown && GetTypeId() == TYPEID_PLAYER && ToPlayer()->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)
ToPlayer()->AddSpellCooldown(triggered_spell_id, 0, time(NULL) + cooldown);
return true;
}
//victim may be NULL
bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown)
{
@@ -5128,38 +5007,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
{
switch (dummySpell->Id)
{
// Bloodworms Health Leech
case 50453:
{
if (Unit* owner = GetOwner())
{
basepoints0 = int32(damage * 1.50f);
target = owner;
triggered_spell_id = 50454;
break;
}
return false;
}
// Eye for an Eye
case 9799:
case 25988:
{
// return damage % to attacker but < 50% own total health
basepoints0 = int32(std::min(CalculatePct(damage, triggerAmount), CountPctFromMaxHealth(50)));
triggered_spell_id = 25997;
break;
}
// Sweeping Strikes
case 18765:
case 35429:
{
target = SelectNearbyTarget(victim);
if (!target)
return false;
triggered_spell_id = 26654;
break;
}
// Unstable Power
case 24658:
{
@@ -5176,67 +5023,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
RemoveAuraFromStack(24662);
return true;
}
// Adaptive Warding (Frostfire Regalia set)
case 28764:
{
if (!procSpell)
return false;
// find Mage Armor
if (!GetAuraEffect(SPELL_AURA_MOD_MANA_REGEN_INTERRUPT, SPELLFAMILY_MAGE, 0x10000000, 0, 0))
return false;
switch (GetFirstSchoolInMask(procSpell->GetSchoolMask()))
{
case SPELL_SCHOOL_NORMAL:
case SPELL_SCHOOL_HOLY:
return false; // ignored
case SPELL_SCHOOL_FIRE: triggered_spell_id = 28765; break;
case SPELL_SCHOOL_NATURE: triggered_spell_id = 28768; break;
case SPELL_SCHOOL_FROST: triggered_spell_id = 28766; break;
case SPELL_SCHOOL_SHADOW: triggered_spell_id = 28769; break;
case SPELL_SCHOOL_ARCANE: triggered_spell_id = 28770; break;
default:
return false;
}
target = this;
break;
}
// Obsidian Armor (Justice Bearer`s Pauldrons shoulder)
case 27539:
{
if (!procSpell)
return false;
switch (GetFirstSchoolInMask(procSpell->GetSchoolMask()))
{
case SPELL_SCHOOL_NORMAL:
return false; // ignore
case SPELL_SCHOOL_HOLY: triggered_spell_id = 27536; break;
case SPELL_SCHOOL_FIRE: triggered_spell_id = 27533; break;
case SPELL_SCHOOL_NATURE: triggered_spell_id = 27538; break;
case SPELL_SCHOOL_FROST: triggered_spell_id = 27534; break;
case SPELL_SCHOOL_SHADOW: triggered_spell_id = 27535; break;
case SPELL_SCHOOL_ARCANE: triggered_spell_id = 27540; break;
default:
return false;
}
target = this;
break;
}
// Mana Leech (Passive) (Priest Pet Aura)
case 28305:
{
// Cast on owner
target = GetOwner();
if (!target)
return false;
triggered_spell_id = 34650;
break;
}
// Mark of Malice
case 33493:
{
@@ -5427,14 +5213,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
}
return false;
}
// Living Seed
case 48504:
{
triggered_spell_id = 48503;
basepoints0 = triggerAmount;
target = this;
break;
}
// Kill command
case 58914:
{
@@ -5594,50 +5372,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
}
break;
}
case 71875: // Item - Black Bruise: Necrotic Touch Proc
case 71877:
{
basepoints0 = CalculatePct(int32(damage), triggerAmount);
triggered_spell_id = 71879;
break;
}
// Item - Shadowmourne Legendary
case 71903:
{
if (!victim || !victim->isAlive() || HasAura(73422)) // cant collect shards while under effect of Chaos Bane buff
return false;
CastSpell(this, 71905, true, NULL, triggeredByAura);
// this can't be handled in AuraScript because we need to know victim
Aura const* dummy = GetAura(71905);
if (!dummy || dummy->GetStackAmount() < 10)
return false;
RemoveAurasDueToSpell(71905);
triggered_spell_id = 71904;
target = victim;
break;
}
// Shadow's Fate (Shadowmourne questline)
case 71169:
{
Unit* caster = triggeredByAura->GetCaster();
if (caster && caster->GetTypeId() == TYPEID_PLAYER && caster->ToPlayer()->GetQuestStatus(24547) == QUEST_STATUS_INCOMPLETE)
{
CastSpell(caster, 71203, true);
return true;
}
else
return false;
}
// Essence of the Blood Queen
case 70871:
{
basepoints0 = CalculatePct(int32(damage), triggerAmount);
CastCustomSpell(70872, SPELLVALUE_BASE_POINT0, basepoints0, this);
return true;
}
case 65032: // Boom aura (321 Boombot)
{
if (victim->GetEntry() != 33343) // Scrapbot
@@ -5650,13 +5384,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
instance->DoCastSpellOnPlayers(65037); // Achievement criteria marker
break;
}
// Dark Hunger (The Lich King encounter)
case 69383:
{
basepoints0 = CalculatePct(int32(damage), 50);
triggered_spell_id = 69384;
break;
}
}
break;
}
@@ -5674,22 +5401,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
triggered_spell_id = 29442;
break;
}
// Master of Elements
if (dummySpell->SpellIconID == 1920)
{
if (!procSpell)
return false;
// mana cost save
int32 cost = int32(procSpell->ManaCost + CalculatePct(GetCreateMana(), procSpell->ManaCostPercentage));
basepoints0 = CalculatePct(cost, triggerAmount);
if (basepoints0 <= 0)
return false;
target = this;
triggered_spell_id = 29077;
break;
}
// Arcane Potency
if (dummySpell->SpellIconID == 2120)
{
@@ -5707,7 +5418,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
}
break;
}
// Hot Streak
if (dummySpell->SpellIconID == 2999)
{
@@ -5730,20 +5440,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
counter->SetAmount(25);
return true;
}
// Burnout
if (dummySpell->SpellIconID == 2998)
{
if (!procSpell)
return false;
int32 cost = int32(procSpell->ManaCost + CalculatePct(GetCreateMana(), procSpell->ManaCostPercentage));
basepoints0 = CalculatePct(cost, triggerAmount);
if (basepoints0 <= 0)
return false;
triggered_spell_id = 44450;
target = this;
break;
}
// Incanter's Regalia set (add trigger chance to Mana Shield)
if (dummySpell->SpellFamilyFlags[0] & 0x8000)
{
@@ -5773,29 +5469,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
RemoveAurasByType(SPELL_AURA_MOD_DECREASE_SPEED);
return true;
}
// Ignite
case 11119:
case 11120:
case 12846:
case 12847:
case 12848:
{
switch (dummySpell->Id)
{
case 11119: basepoints0 = int32(0.04f * damage); break;
case 11120: basepoints0 = int32(0.08f * damage); break;
case 12846: basepoints0 = int32(0.12f * damage); break;
case 12847: basepoints0 = int32(0.16f * damage); break;
case 12848: basepoints0 = int32(0.20f * damage); break;
default:
sLog->outError(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: non handled spell id: %u (IG)", dummySpell->Id);
return false;
}
triggered_spell_id = 12654;
basepoints0 += victim->GetRemainingPeriodicAmount(GetGUID(), triggered_spell_id, SPELL_AURA_PERIODIC_DAMAGE);
break;
}
// Glyph of Ice Block
case 56372:
{
@@ -5815,25 +5488,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
}
break;
}
// Blessing of Ancient Kings (Val'anyr, Hammer of Ancient Kings)
case 64411:
{
if (!victim)
return false;
basepoints0 = int32(CalculatePct(damage, 15));
if (AuraEffect* aurEff = victim->GetAuraEffect(64413, 0, GetGUID()))
{
// The shield can grow to a maximum size of 20, 000 damage absorbtion
aurEff->SetAmount(std::min<int32>(aurEff->GetAmount() + basepoints0, 20000));
// Refresh and return to prevent replacing the aura
aurEff->GetBase()->RefreshDuration();
return true;
}
target = victim;
triggered_spell_id = 64413;
break;
}
case 47020: // Enter vehicle XT-002 (Scrapbot)
{
if (GetTypeId() != TYPEID_UNIT)
@@ -5854,16 +5508,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
{
switch (dummySpell->Id)
{
// Sweeping Strikes
case 12328:
{
target = SelectNearbyTarget(victim);
if (!target)
return false;
triggered_spell_id = 26654;
break;
}
// Victorious
case 32216:
{
@@ -5913,14 +5557,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
target = this;
break;
}
// Damage Shield
if (dummySpell->SpellIconID == 3214)
{
triggered_spell_id = 59653;
// % of amount blocked
basepoints0 = CalculatePct(int32(GetShieldBlockValue()), triggerAmount);
break;
}
// Glyph of Blocking
if (dummySpell->Id == 58375)
{
@@ -5991,31 +5627,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
triggeredByAura->SetAmount(triggeredByAura->GetAmount() - damage);
return true;
}
// Fel Synergy
if (dummySpell->SpellIconID == 3222)
{
target = GetGuardianPet();
if (!target)
return false;
basepoints0 = CalculatePct(int32(damage), triggerAmount);
triggered_spell_id = 54181;
break;
}
switch (dummySpell->Id)
{
// Siphon Life
case 63108:
{
if (!damage)
break;
// Glyph of Siphon Life
if (HasAura(56216))
triggerAmount += triggerAmount / 4;
triggered_spell_id = 63106;
target = this;
basepoints0 = CalculatePct(int32(damage), triggerAmount);
break;
}
// Glyph of Shadowflame
case 63310:
{
@@ -6126,24 +5739,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
victim->CastSpell(victim, 57669, true, castItem, triggeredByAura);
return true; // no hidden cooldown
}
// Divine Aegis
if (dummySpell->SpellIconID == 2820)
{
if (!target)
return false;
// Multiple effects stack, so let's try to find this aura.
int32 bonus = 0;
if (AuraEffect const* aurEff = target->GetAuraEffect(47753, 0))
bonus = aurEff->GetAmount();
basepoints0 = CalculatePct(int32(damage), triggerAmount) + bonus;
if (basepoints0 > target->getLevel() * 125)
basepoints0 = target->getLevel() * 125;
triggered_spell_id = 47753;
break;
}
// Body and Soul
if (dummySpell->SpellIconID == 2218)
{
@@ -6184,31 +5779,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
target = this;
break;
}
// Glyph of Prayer of Healing
case 55680:
{
triggered_spell_id = 56161;
SpellInfo const* GoPoH = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!GoPoH)
return false;
int EffIndex = 0;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; i++)
{
if (GoPoH->Effects[i].Effect == SPELL_EFFECT_APPLY_AURA)
{
EffIndex = i;
break;
}
}
int32 tickcount = GoPoH->GetMaxDuration() / GoPoH->Effects[EffIndex].Amplitude;
if (!tickcount)
return false;
basepoints0 = CalculatePct(int32(damage), triggerAmount) / tickcount;
break;
}
// Improved Shadowform
case 47570:
case 47569:
@@ -6481,13 +6051,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
triggered_spell_id = isWrathSpell ? 48518 : 48517;
break;
}
// Living Seed
else if (dummySpell->SpellIconID == 2860)
{
triggered_spell_id = 48504;
basepoints0 = CalculatePct(int32(damage), triggerAmount);
break;
}
break;
}
case SPELLFAMILY_ROGUE:
@@ -6508,16 +6071,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
triggered_spell_id = 32747;
break;
}
case 57934: // Tricks of the Trade
{
Unit* redirectTarget = GetMisdirectionTarget();
RemoveAura(57934);
if (!redirectTarget)
break;
CastSpell(this, 59628, true);
CastSpell(redirectTarget, 57933, true);
break;
}
}
switch (dummySpell->SpellIconID)
@@ -6636,14 +6189,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
switch (dummySpell->Id)
{
case 34477: // Misdirection
{
if (!GetMisdirectionTarget())
return false;
triggered_spell_id = 35079; // 4 sec buff on self
target = this;
break;
}
case 57870: // Glyph of Mend Pet
{
victim->CastSpell(victim, 57894, true, NULL, NULL, GetGUID());
@@ -6654,18 +6199,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
}
case SPELLFAMILY_PALADIN:
{
// Seal of Righteousness - melee proc dummy (addition ${$MWS*(0.022*$AP+0.044*$SPH)} damage)
if (dummySpell->SpellFamilyFlags[0] & 0x8000000)
{
if (effIndex != 0)
return false;
triggered_spell_id = 25742;
float ap = GetTotalAttackPowerValue(BASE_ATTACK);
int32 holy = SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_HOLY) +
victim->SpellBaseDamageBonusTaken(SPELL_SCHOOL_MASK_HOLY);
basepoints0 = (int32)GetAttackTime(BASE_ATTACK) * int32(ap * 0.022f + 0.044f * holy) / 1000;
break;
}
// Light's Beacon - Beacon of Light
if (dummySpell->Id == 53651)
{
@@ -6832,20 +6365,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
}
break;
}
case 25899: // Greater Blessing of Sanctuary
case 20911: // Blessing of Sanctuary
{
target = this;
switch (target->getPowerType())
{
case POWER_MANA:
triggered_spell_id = 57319;
break;
default:
return false;
}
break;
}
// Seal of Vengeance (damage calc on apply aura)
case 31801:
{
@@ -7348,20 +6867,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
target = this;
break;
}
// Earth Shield
if (dummySpell->SpellFamilyFlags[1] & 0x00000400)
{
// 3.0.8: Now correctly uses the Shaman's own spell critical strike chance to determine the chance of a critical heal.
originalCaster = triggeredByAura->GetCasterGUID();
target = this;
basepoints0 = triggerAmount;
// Glyph of Earth Shield
if (AuraEffect* aur = GetAuraEffect(63279, 0))
AddPct(basepoints0, aur->GetAmount());
triggered_spell_id = 379;
break;
}
// Flametongue Weapon (Passive)
if (dummySpell->SpellFamilyFlags[0] & 0x200000)
{
@@ -7813,114 +7318,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
return true;
}
bool Unit::HandleObsModEnergyAuraProc(Unit* victim, uint32 /*damage*/, AuraEffect* triggeredByAura, SpellInfo const* /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 cooldown)
{
SpellInfo const* dummySpell = triggeredByAura->GetSpellInfo();
//uint32 effIndex = triggeredByAura->GetEffIndex();
//int32 triggerAmount = triggeredByAura->GetAmount();
Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER
? ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : NULL;
uint32 triggered_spell_id = 0;
Unit* target = victim;
int32 basepoints0 = 0;
switch (dummySpell->SpellFamilyName)
{
case SPELLFAMILY_HUNTER:
{
// Aspect of the Viper
if (dummySpell->SpellFamilyFlags[1] & 0x40000)
{
uint32 maxmana = GetMaxPower(POWER_MANA);
basepoints0 = CalculatePct(maxmana, GetAttackTime(RANGED_ATTACK) / 1000.0f);
target = this;
triggered_spell_id = 34075;
break;
}
break;
}
}
// processed charge only counting case
if (!triggered_spell_id)
return true;
SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id);
// Try handle unknown trigger spells
if (!triggerEntry)
{
sLog->outError(LOG_FILTER_UNITS, "Unit::HandleObsModEnergyAuraProc: Spell %u has non-existing triggered spell %u", dummySpell->Id, triggered_spell_id);
return false;
}
if (cooldown && GetTypeId() == TYPEID_PLAYER && ToPlayer()->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)
ToPlayer()->AddSpellCooldown(triggered_spell_id, 0, time(NULL) + cooldown);
return true;
}
bool Unit::HandleModDamagePctTakenAuraProc(Unit* victim, uint32 /*damage*/, AuraEffect* triggeredByAura, SpellInfo const* /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 cooldown)
{
SpellInfo const* dummySpell = triggeredByAura->GetSpellInfo();
//uint32 effIndex = triggeredByAura->GetEffIndex();
//int32 triggerAmount = triggeredByAura->GetAmount();
Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER
? ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : NULL;
uint32 triggered_spell_id = 0;
Unit* target = victim;
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;
default:
return false;
}
}
break;
}
}
// processed charge only counting case
if (!triggered_spell_id)
return true;
SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!triggerEntry)
{
sLog->outError(LOG_FILTER_UNITS, "Unit::HandleModDamagePctTakenAuraProc: Spell %u has non-existing triggered spell %u", dummySpell->Id, triggered_spell_id);
return false;
}
if (cooldown && GetTypeId() == TYPEID_PLAYER && ToPlayer()->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)
ToPlayer()->AddSpellCooldown(triggered_spell_id, 0, time(NULL) + cooldown);
return true;
}
// Used in case when access to whole aura is needed
// All procs should be handled like this...
@@ -8303,12 +7700,6 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
RemoveAuraFromStack(auraSpellInfo->Id);
return false;
}
if (auraSpellInfo->Id == 50720)
{
target = triggeredByAura->GetCaster();
if (!target)
return false;
}
break;
case SPELLFAMILY_WARLOCK:
{
@@ -14536,7 +13927,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
SpellInfo const* spellInfo = i->aura->GetSpellInfo();
uint32 Id = i->aura->GetId();
AuraApplication const* aurApp = i->aura->GetApplicationOfTarget(GetGUID());
AuraApplication* aurApp = i->aura->GetApplicationOfTarget(GetGUID());
bool prepare = i->aura->CallScriptPrepareProcHandlers(aurApp, eventInfo);
@@ -14589,17 +13980,10 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
case SPELL_AURA_PROC_TRIGGER_DAMAGE:
{
// target has to be valid
if (!target)
if (!eventInfo.GetProcTarget())
break;
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: doing %u damage from spell id %u (triggered by %s aura of spell %u)", triggeredByAura->GetAmount(), spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
SpellNonMeleeDamage damageInfo(this, target, spellInfo->Id, spellInfo->SchoolMask);
uint32 newDamage = SpellDamageBonusDone(target, spellInfo, triggeredByAura->GetAmount(), SPELL_DIRECT_DAMAGE);
newDamage = target->SpellDamageBonusTaken(this, spellInfo, newDamage, SPELL_DIRECT_DAMAGE);
CalculateSpellDamageTaken(&damageInfo, newDamage, spellInfo);
DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
SendSpellNonMeleeDamageLog(&damageInfo);
DealSpellDamage(&damageInfo, true);
triggeredByAura->HandleProcTriggerDamageAuraProc(aurApp, eventInfo); // this function is part of the new proc system
takeCharges = true;
break;
}
@@ -14612,22 +13996,12 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
break;
}
case SPELL_AURA_OBS_MOD_POWER:
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: casting spell id %u (triggered by %s aura of spell %u)", spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
if (HandleObsModEnergyAuraProc(target, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown))
takeCharges = true;
break;
case SPELL_AURA_MOD_SPELL_CRIT_CHANCE:
case SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN:
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "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(target, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown))
takeCharges = true;
break;
case SPELL_AURA_MOD_MELEE_HASTE:
{
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: casting spell id %u (triggered by %s haste aura of spell %u)", spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
if (HandleHasteAuraProc(target, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown))
takeCharges = true;
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: casting spell id %u (triggered by %s aura of spell %u)", spellInfo->Id, isVictim ? "a victim's" : "an attacker's", triggeredByAura->GetId());
takeCharges = true;
break;
}
case SPELL_AURA_OVERRIDE_CLASS_SCRIPTS:
{
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: casting spell id %u (triggered by %s aura of spell %u)", spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
@@ -14699,11 +14073,6 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
if (triggeredByAura->GetCasterGUID() == target->GetGUID())
takeCharges = true;
break;
case SPELL_AURA_MOD_SPELL_CRIT_CHANCE:
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: casting spell id %u (triggered by %s spell crit chance aura of spell %u)", spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
if (procSpell && HandleSpellCritChanceAuraProc(target, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown))
takeCharges = true;
break;
// CC Auras which use their amount amount to drop
// Are there any more auras which need this?
case SPELL_AURA_MOD_CONFUSE: