[8991] Merge 2 switch in Unit::HandleProcTriggerSpell

This commit is contained in:
VladimirMangos 2009-12-14 17:03:24 +03:00
parent 98dd3296e8
commit 2defba515e
2 changed files with 522 additions and 567 deletions

View file

@ -6825,51 +6825,114 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGUID()) : NULL;
// Try handle unknown trigger spells
if (sSpellStore.LookupEntry(trigger_spell_id)==NULL)
{
// Custom requirements (not listed in procEx) Warning! damage dealing after this
// Custom triggered spells
switch (auraSpellInfo->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
//if (auraSpellInfo->Id==59532) // Abandon Passengers on Poly
//if (auraSpellInfo->Id==54775) // Abandon Vehicle on Poly
//if (auraSpellInfo->Id==34082) // Advantaged State (DND)
if (auraSpellInfo->Id == 23780) // Aegis of Preservation (Aegis of Preservation trinket)
trigger_spell_id = 23781;
//else if (auraSpellInfo->Id==43504) // Alterac Valley OnKill Proc Aura
//else if (auraSpellInfo->Id == 48876) // Beast's Mark
//{
// trigger_spell_id = 48877;
//}
//else if (auraSpellInfo->Id == 59237) // Beast's Mark
//{
// trigger_spell_id = 59233;
//}
//else if (auraSpellInfo->Id==46939) // Black Bow of the Betrayer
//{
// trigger_spell_id = 29471; // gain mana
// 27526; // drain mana if possible
//}
//else if (auraSpellInfo->Id==50844) // Blood Mirror
//else if (auraSpellInfo->Id==54476) // Blood Presence
//else if (auraSpellInfo->Id==50689) // Blood Presence (Rank 1)
//else if (auraSpellInfo->Id==37030) // Chaotic Temperament
//else if (auraSpellInfo->Id==52856) // Charge
else if (auraSpellInfo->Id==43820) // Charm of the Witch Doctor (Amani Charm of the Witch Doctor trinket)
switch(auraSpellInfo->Id)
{
//case 191: // Elemental Response
// switch (procSpell->School)
// {
// case SPELL_SCHOOL_FIRE: trigger_spell_id = 34192; break;
// case SPELL_SCHOOL_FROST: trigger_spell_id = 34193; break;
// case SPELL_SCHOOL_ARCANE:trigger_spell_id = 34194; break;
// case SPELL_SCHOOL_NATURE:trigger_spell_id = 34195; break;
// case SPELL_SCHOOL_SHADOW:trigger_spell_id = 34196; break;
// case SPELL_SCHOOL_HOLY: trigger_spell_id = 34197; break;
// case SPELL_SCHOOL_NORMAL:trigger_spell_id = 34198; break;
// }
// break;
//case 5301: break; // Defensive State (DND)
//case 7137: break: // Shadow Charge (Rank 1)
//case 7377: break: // Take Immune Periodic Damage <Not Working>
//case 13358: break; // Defensive State (DND)
//case 16092: break; // Defensive State (DND)
//case 18943: break; // Double Attack
//case 19194: break; // Double Attack
//case 19817: break; // Double Attack
//case 19818: break; // Double Attack
//case 22835: break; // Drunken Rage
// trigger_spell_id = 14822; break;
case 23780: // Aegis of Preservation (Aegis of Preservation trinket)
trigger_spell_id = 23781;
break;
//case 24949: break; // Defensive State 2 (DND)
case 27522: // Mana Drain Trigger
case 40336: // Mana Drain Trigger
// On successful melee or ranged attack gain $29471s1 mana and if possible drain $27526s1 mana from the target.
if (isAlive())
CastSpell(this, 29471, true, castItem, triggeredByAura);
if (pVictim && pVictim->isAlive())
CastSpell(pVictim, 27526, true, castItem, triggeredByAura);
return true;
case 31255: // Deadly Swiftness (Rank 1)
// whenever you deal damage to a target who is below 20% health.
if (pVictim->GetHealth() > pVictim->GetMaxHealth() / 5)
return false;
target = this;
trigger_spell_id = 22588;
break;
//case 33207: break; // Gossip NPC Periodic - Fidget
case 33896: // Desperate Defense (Stonescythe Whelp, Stonescythe Alpha, Stonescythe Ambusher)
trigger_spell_id = 33898;
break;
//case 34082: break; // Advantaged State (DND)
//case 34783: break: // Spell Reflection
//case 35205: break: // Vanish
//case 35321: break; // Gushing Wound
//case 36096: break: // Spell Reflection
//case 36207: break: // Steal Weapon
//case 36576: break: // Shaleskin (Shaleskin Flayer, Shaleskin Ripper) 30023 trigger
//case 37030: break; // Chaotic Temperament
//case 38363: break; // Gushing Wound
//case 39215: break; // Gushing Wound
//case 40250: break; // Improved Duration
//case 40329: break; // Demo Shout Sensor
//case 40364: break; // Entangling Roots Sensor
//case 41054: break; // Copy Weapon
// trigger_spell_id = 41055; break;
//case 41248: break; // Consuming Strikes
// trigger_spell_id = 41249; break;
//case 42730: break: // Woe Strike
//case 43453: break: // Rune Ward
//case 43504: break; // Alterac Valley OnKill Proc Aura
//case 44326: break: // Pure Energy Passive
//case 44526: break; // Hate Monster (Spar) (30 sec)
//case 44527: break; // Hate Monster (Spar Buddy) (30 sec)
//case 44819: break; // Hate Monster (Spar Buddy) (>30% Health)
//case 44820: break; // Hate Monster (Spar) (<30%)
case 45057: // Evasive Maneuvers (Commendation of Kael`thas trinket)
// reduce you below $s1% health
if (GetHealth() - damage > GetMaxHealth() * triggerAmount / 100)
return false;
break;
//case 45903: break: // Offensive State
//case 46146: break: // [PH] Ahune Spanky Hands
//case 46939: break; // Black Bow of the Betrayer
// trigger_spell_id = 29471; - gain mana
// 27526; - drain mana if possible
case 43820: // Charm of the Witch Doctor (Amani Charm of the Witch Doctor trinket)
// Pct value stored in dummy
basepoints[0] = pVictim->GetCreateHealth() * auraSpellInfo->EffectBasePoints[1] / 100;
target = pVictim;
break;
}
//else if (auraSpellInfo->Id==41248) // Consuming Strikes
// trigger_spell_id = 41249;
//else if (auraSpellInfo->Id==45205) // Copy Offhand Weapon
//else if (auraSpellInfo->Id==57594) // Copy Ranged Weapon
//else if (auraSpellInfo->Id==41054) // Copy Weapon
// trigger_spell_id = 41055;
//else if (auraSpellInfo->Id==45343) // Dark Flame Aura
//else if (auraSpellInfo->Id==47300) // Dark Flame Aura
else if (auraSpellInfo->Id==57345) // Darkmoon Card: Greatness
//case 45205: break; // Copy Offhand Weapon
//case 45343: break; // Dark Flame Aura
//case 47300: break; // Dark Flame Aura
//case 48876: break; // Beast's Mark
// trigger_spell_id = 48877; break;
//case 49059: break; // Horde, Hate Monster (Spar Buddy) (>30% Health)
//case 50051: break; // Ethereal Pet Aura
//case 50689: break; // Blood Presence (Rank 1)
//case 50844: break; // Blood Mirror
//case 52856: break; // Charge
//case 54072: break; // Knockback Ball Passive
//case 54476: break; // Blood Presence
//case 54775: break; // Abandon Vehicle on Poly
case 57345: // Darkmoon Card: Greatness
{
float stat = 0.0f;
// strength
@ -6880,107 +6943,35 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
if (GetStat(STAT_INTELLECT)> stat) { trigger_spell_id = 60234;stat = GetStat(STAT_INTELLECT);}
// spirit
if (GetStat(STAT_SPIRIT) > stat) { trigger_spell_id = 60235; }
break;
}
else if (auraSpellInfo->Id==67702) // Death's Choice, Item - Coliseum 25 Normal Melee Trinket
//case 55580: break: // Mana Link
//case 57587: break: // Steal Ranged ()
//case 57594: break; // Copy Ranged Weapon
//case 59237: break; // Beast's Mark
// trigger_spell_id = 59233; break;
//case 59288: break; // Infra-Green Shield
//case 59532: break; // Abandon Passengers on Poly
//case 59735: break: // Woe Strike
case 67702: // Death's Choice, Item - Coliseum 25 Normal Melee Trinket
{
float stat = 0.0f;
// strength
if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 67708;stat = GetStat(STAT_STRENGTH); }
// agility
if (GetStat(STAT_AGILITY) > stat) { trigger_spell_id = 67703; }
break;
}
else if (auraSpellInfo->Id==67771) // Death's Choice (heroic), Item - Coliseum 25 Heroic Melee Trinket
case 67771: // Death's Choice (heroic), Item - Coliseum 25 Heroic Melee Trinket
{
float stat = 0.0f;
// strength
if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 67773;stat = GetStat(STAT_STRENGTH); }
// agility
if (GetStat(STAT_AGILITY) > stat) { trigger_spell_id = 67772; }
}
//else if (auraSpellInfo->Id==31255) // Deadly Swiftness (Rank 1)
//else if (auraSpellInfo->Id==5301) // Defensive State (DND)
//else if (auraSpellInfo->Id==13358) // Defensive State (DND)
//else if (auraSpellInfo->Id==16092) // Defensive State (DND)
//else if (auraSpellInfo->Id==24949) // Defensive State 2 (DND)
//else if (auraSpellInfo->Id==40329) // Demo Shout Sensor
else if (auraSpellInfo->Id == 33896) // Desperate Defense (Stonescythe Whelp, Stonescythe Alpha, Stonescythe Ambusher)
trigger_spell_id = 33898;
//else if (auraSpellInfo->Id==18943) // Double Attack
//else if (auraSpellInfo->Id==19194) // Double Attack
//else if (auraSpellInfo->Id==19817) // Double Attack
//else if (auraSpellInfo->Id==19818) // Double Attack
//else if (auraSpellInfo->Id==22835) // Drunken Rage
// trigger_spell_id = 14822;
/*
else if (auraSpellInfo->SpellIconID==191) // Elemental Response
{
switch (auraSpellInfo->Id && auraSpellInfo->AttributesEx==0)
{
case 34191:
case 34329:
case 34524:
case 34582:
case 36733:
break;
default:
sLog.outError("Unit::HandleProcTriggerSpell: Spell %u miss posibly Elemental Response",auraSpellInfo->Id);
return false;
}
//This generic aura self-triggers a different spell for each school of magic that lands on the wearer:
switch (procSpell->School)
{
case SPELL_SCHOOL_FIRE: trigger_spell_id = 34192; break;
case SPELL_SCHOOL_FROST: trigger_spell_id = 34193; break;
case SPELL_SCHOOL_ARCANE:trigger_spell_id = 34194; break;
case SPELL_SCHOOL_NATURE:trigger_spell_id = 34195; break;
case SPELL_SCHOOL_SHADOW:trigger_spell_id = 34196; break;
case SPELL_SCHOOL_HOLY: trigger_spell_id = 34197; break;
case SPELL_SCHOOL_NORMAL:trigger_spell_id = 34198; break;
default:
sLog.outError("Unit::HandleProcTriggerSpell: Spell %u Elemental Response wrong school",auraSpellInfo->Id);
return false;
}
}
*/
//else if (auraSpellInfo->Id==40364) // Entangling Roots Sensor
//else if (auraSpellInfo->Id==33207) // Gossip NPC Periodic - Fidget
//else if (auraSpellInfo->Id==50051) // Ethereal Pet Aura
//else if (auraSpellInfo->Id==35321) // Gushing Wound
//else if (auraSpellInfo->Id==38363) // Gushing Wound
//else if (auraSpellInfo->Id==39215) // Gushing Wound
//else if (auraSpellInfo->Id==44527) // Hate Monster (Spar Buddy) (30 sec)
//else if (auraSpellInfo->Id==44819) // Hate Monster (Spar Buddy) (>30% Health)
//else if (auraSpellInfo->Id==44526) // Hate Monster (Spar) (30 sec)
//else if (auraSpellInfo->Id==44820) // Hate Monster (Spar) (<30%)
//else if (auraSpellInfo->Id==49059) // Horde, Hate Monster (Spar Buddy) (>30% Health)
//else if (auraSpellInfo->Id==40250) // Improved Duration
//else if (auraSpellInfo->Id==59288) // Infra-Green Shield
//else if (auraSpellInfo->Id==54072) // Knockback Ball Passive
else if (auraSpellInfo->Id==27522 || auraSpellInfo->Id==40336)
// Mana Drain Trigger
{
// On successful melee or ranged attack gain $29471s1 mana and if possible drain $27526s1 mana from the target.
if (this && this->isAlive())
CastSpell(this, 29471, true, castItem, triggeredByAura);
if (pVictim && pVictim->isAlive())
CastSpell(pVictim, 27526, true, castItem, triggeredByAura);
return true;
}
//else if (auraSpellInfo->Id==55580) // Mana Link
//else if (auraSpellInfo->Id==45903) // Offensive State
//else if (auraSpellInfo->Id==44326) // Pure Energy Passive
//else if (auraSpellInfo->Id==43453) // Rune Ward
//else if (auraSpellInfo->Id== 7137) // Shadow Charge (Rank 1)
//else if (auraSpellInfo->Id==36576) // Shaleskin (Shaleskin Flayer, Shaleskin Ripper) 30023 trigger
//else if (auraSpellInfo->Id==34783) // Spell Reflection
//else if (auraSpellInfo->Id==36096) // Spell Reflection
//else if (auraSpellInfo->Id==57587) // Steal Ranged ()
//else if (auraSpellInfo->Id==36207) // Steal Weapon
//else if (auraSpellInfo->Id== 7377) // Take Immune Periodic Damage <Not Working>
//else if (auraSpellInfo->Id==35205) // Vanish
//else if (auraSpellInfo->Id==42730) // Woe Strike
//else if (auraSpellInfo->Id==59735) // Woe Strike
//else if (auraSpellInfo->Id==46146) // [PH] Ahune Spanky Hands
break;
case SPELLFAMILY_MAGE:
if (auraSpellInfo->SpellIconID == 2127) // Blazing Speed
@ -6996,6 +6987,14 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
return false;
}
}
// Persistent Shield (Scarab Brooch trinket)
else if(auraSpellInfo->Id == 26467)
{
// This spell originally trigger 13567 - Dummy Trigger (vs dummy efect)
basepoints[0] = damage * 15 / 100;
target = pVictim;
trigger_spell_id = 26470;
}
break;
case SPELLFAMILY_WARRIOR:
if (auraSpellInfo->Id == 50421) // Scent of Blood
@ -7069,13 +7068,40 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
return false;
}
}
// Cheat Death
else if (auraSpellInfo->Id == 28845)
{
// When your health drops below 20% ....
if (GetHealth() - damage > GetMaxHealth() / 5 || GetHealth() < GetMaxHealth() / 5)
return false;
}
// Decimation
else if (auraSpellInfo->Id == 63156 || auraSpellInfo->Id == 63158)
{
// Looking for dummy effect
Aura *aur = GetAura(auraSpellInfo->Id, 1);
if (!aur)
return false;
// If target's health is not below equal certain value (35%) not proc
if ((pVictim->GetHealth() * 100 / pVictim->GetMaxHealth()) > aur->GetModifier()->m_amount)
return false;
}
break;
}
case SPELLFAMILY_PRIEST:
{
// Greater Heal Refund
// Greater Heal Refund (Avatar Raiment set)
if (auraSpellInfo->Id==37594)
{
// Not give if target already have full health
if (pVictim->GetHealth() == pVictim->GetMaxHealth())
return false;
// If your Greater Heal brings the target to full health, you gain $37595s1 mana.
if (pVictim->GetHealth() + damage < pVictim->GetMaxHealth())
return false;
trigger_spell_id = 37595;
}
// Blessed Recovery
else if (auraSpellInfo->SpellIconID == 1875)
{
@ -7132,6 +7158,13 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
trigger_spell_id = 63468;
target = pVictim;
}
// Rapid Recuperation
else if (auraSpellInfo->Id == 53228 || auraSpellInfo->Id == 53232)
{
// This effect only from Rapid Fire (ability cast)
if (!(procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000020)))
return false;
}
break;
case SPELLFAMILY_PALADIN:
{
@ -7216,6 +7249,13 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
trigger_spell_id = 37661;
target = pVictim;
}
// Bonus Healing (Crystal Spire of Karabor mace)
else if (auraSpellInfo->Id == 40971)
{
// If your target is below $s1% health
if (pVictim->GetHealth() > pVictim->GetMaxHealth() * triggerAmount / 100)
return false;
}
// Thunder Capacitor
else if (auraSpellInfo->Id == 54841)
{
@ -7335,16 +7375,22 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
trigger_spell_id = 50475;
basepoints[0] = damage * triggerAmount / 100;
}
// Blade Barrier
else if (auraSpellInfo->SpellIconID == 85)
{
if (GetTypeId() != TYPEID_PLAYER || getClass() != CLASS_DEATH_KNIGHT ||
!((Player*)this)->IsBaseRuneSlotsOnCooldown(RUNE_BLOOD))
return false;
}
break;
}
default:
break;
}
}
// All ok. Check current trigger spell
SpellEntry const* triggerEntry = sSpellStore.LookupEntry(trigger_spell_id);
if ( triggerEntry == NULL )
if (!triggerEntry)
{
// Not cast unknown spell
// sLog.outError("Unit::HandleProcTriggerSpell: Spell %u have 0 in EffectTriggered[%d], not handled custom case?",auraSpellInfo->Id,triggeredByAura->GetEffIndex());
@ -7355,97 +7401,6 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
if (m_extraAttacks && IsSpellHaveEffect(triggerEntry, SPELL_EFFECT_ADD_EXTRA_ATTACKS))
return false;
// Custom requirements (not listed in procEx) Warning! damage dealing after this
// Custom triggered spells
switch (auraSpellInfo->Id)
{
// Persistent Shield (Scarab Brooch trinket)
// This spell originally trigger 13567 - Dummy Trigger (vs dummy efect)
case 26467:
{
basepoints[0] = damage * 15 / 100;
target = pVictim;
trigger_spell_id = 26470;
break;
}
// Cheat Death
case 28845:
{
// When your health drops below 20% ....
if (GetHealth() - damage > GetMaxHealth() / 5 || GetHealth() < GetMaxHealth() / 5)
return false;
break;
}
// Deadly Swiftness (Rank 1)
case 31255:
{
// whenever you deal damage to a target who is below 20% health.
if (pVictim->GetHealth() > pVictim->GetMaxHealth() / 5)
return false;
target = this;
trigger_spell_id = 22588;
}
// Greater Heal Refund (Avatar Raiment set)
case 37594:
{
// Not give if target already have full health
if (pVictim->GetHealth() == pVictim->GetMaxHealth())
return false;
// If your Greater Heal brings the target to full health, you gain $37595s1 mana.
if (pVictim->GetHealth() + damage < pVictim->GetMaxHealth())
return false;
break;
}
// Bonus Healing (Crystal Spire of Karabor mace)
case 40971:
{
// If your target is below $s1% health
if (pVictim->GetHealth() > pVictim->GetMaxHealth() * triggerAmount / 100)
return false;
break;
}
// Evasive Maneuvers (Commendation of Kael`thas trinket)
case 45057:
{
// reduce you below $s1% health
if (GetHealth() - damage > GetMaxHealth() * triggerAmount / 100)
return false;
break;
}
// Rapid Recuperation
case 53228:
case 53232:
{
// This effect only from Rapid Fire (ability cast)
if (!(procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000020)))
return false;
break;
}
// Decimation
case 63156:
case 63158:
{
// Looking for dummy effect
Aura *aur = GetAura(auraSpellInfo->Id, 1);
if (!aur)
return false;
// If target's health is not below equal certain value (35%) not proc
if ((pVictim->GetHealth() * 100 / pVictim->GetMaxHealth()) > aur->GetModifier()->m_amount)
return false;
break;
}
}
// Blade Barrier
if (auraSpellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && auraSpellInfo->SpellIconID == 85)
{
if (GetTypeId() != TYPEID_PLAYER || getClass() != CLASS_DEATH_KNIGHT ||
!((Player*)this)->IsBaseRuneSlotsOnCooldown(RUNE_BLOOD))
return false;
}
// Custom basepoints/target for exist spell
// dummy basepoints or other customs
switch(trigger_spell_id)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "8990"
#define REVISION_NR "8991"
#endif // __REVISION_NR_H__