*Update linked spell. Add new type: linked aura.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-02-05 22:49:07 -06:00
parent f00befd879
commit 9332f1e58d
8 changed files with 91 additions and 49 deletions
+6
View File
@@ -0,0 +1,6 @@
DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (31224,41292,44007,44867);
INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES
(31224, -1543, 2, 'Cloak of Shadows - Flare'),
(41292, 42017, 2, 'Aura of Suffering'),
(44007, -43657, 2, 'Storm Eye Safe Zone Immune'),
(44867, -46019, 2, 'Spectral Exhaustion - Teleport: Spectral Realm');
+4 -2
View File
@@ -15,6 +15,7 @@ CREATE TABLE `spell_linked_spell` (
INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES
-- class -- class
(31224, -1543, 2, 'Cloak of Shadows - Flare'),
(15237, 23455, 0, 'Holy Nova (rank1)'), (15237, 23455, 0, 'Holy Nova (rank1)'),
(15430, 23458, 0, 'Holy Nova (rank2)'), (15430, 23458, 0, 'Holy Nova (rank2)'),
(15431, 23459, 0, 'Holy Nova (rank3)'), (15431, 23459, 0, 'Holy Nova (rank3)'),
@@ -37,6 +38,7 @@ INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comm
-- Zul'aman -- Zul'aman
(44008, 45265, 1, 'Static Disruption Visual'), (44008, 45265, 1, 'Static Disruption Visual'),
(43648, 44007, 1, 'Storm Eye Safe Zone'), (43648, 44007, 1, 'Storm Eye Safe Zone'),
(44007, -43657, 2, 'Storm Eye Safe Zone Immune'),
(43658, 43653, 0, 'Electrical Arc Visual'), (43658, 43653, 0, 'Electrical Arc Visual'),
(43658, 43654, 0, 'Electrical Arc Visual'), (43658, 43654, 0, 'Electrical Arc Visual'),
(43658, 43655, 0, 'Electrical Arc Visual'), (43658, 43655, 0, 'Electrical Arc Visual'),
@@ -52,8 +54,7 @@ INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comm
(39908, 40017, 1, 'Eye Blast'), (39908, 40017, 1, 'Eye Blast'),
(40604, 40616, 1, 'Fel Rage Aura'), (40604, 40616, 1, 'Fel Rage Aura'),
(40616, 41625, 1, 'Fel Rage Aura'), (40616, 41625, 1, 'Fel Rage Aura'),
(41292, 42017, 1, 'Aura of Suffering'), (41292, 42017, 2, 'Aura of Suffering'),
(-41292, -42017, 0, 'Aura of Suffering'),
-- sunwell -- sunwell
(44869, 44866, 1, 'Spectral Blast Portal'), (44869, 44866, 1, 'Spectral Blast Portal'),
# (44869, 46648, 1, 'Spectral Blast Visual'), cause severe lag seems should be casted by go # (44869, 46648, 1, 'Spectral Blast Visual'), cause severe lag seems should be casted by go
@@ -62,6 +63,7 @@ INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comm
# (46021, 44852, 1, 'Spectral Realm Aura'), 44852 makes boss friendly to you # (46021, 44852, 1, 'Spectral Realm Aura'), 44852 makes boss friendly to you
(-46021, 46020, 0, 'Teleport: Normal Realm'), (-46021, 46020, 0, 'Teleport: Normal Realm'),
(46020, 44867, 1, 'Spectral Exhaustion'), (46020, 44867, 1, 'Spectral Exhaustion'),
(44867, -46019, 2, 'Spectral Exhaustion - Teleport: Spectral Realm'),
(45661, 45665, 1, 'Encapsulate'), (45661, 45665, 1, 'Encapsulate'),
(45347, -45348, 1, 'Remove Flame Touched'), (45347, -45348, 1, 'Remove Flame Touched'),
(45348, -45347, 1, 'Remove Dark Touched'), (45348, -45347, 1, 'Remove Dark Touched'),
+14 -16
View File
@@ -1215,15 +1215,14 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
if(m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->AI()) if(m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->AI())
((Creature*)m_caster)->AI()->SpellHitTarget(unit, m_spellInfo); ((Creature*)m_caster)->AI()->SpellHitTarget(unit, m_spellInfo);
if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(m_spellInfo->Id + 1000000)) if(m_customAttr & SPELL_ATTR_CU_LINK_HIT)
{ {
for(std::vector<int32>::const_iterator i = spell_triggered->begin(); i != spell_triggered->end(); ++i) if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(m_spellInfo->Id + SPELL_LINK_HIT))
{ for(std::vector<int32>::const_iterator i = spell_triggered->begin(); i != spell_triggered->end(); ++i)
if(*i < 0) if(*i < 0)
unit->RemoveAurasDueToSpell(-(*i)); unit->RemoveAurasDueToSpell(-(*i));
else else
unit->CastSpell(unit, *i, true, 0, 0, m_caster->GetGUID()); unit->CastSpell(unit, *i, true, 0, 0, m_caster->GetGUID());
}
} }
//This is not needed with procflag patch //This is not needed with procflag patch
@@ -2291,15 +2290,14 @@ void Spell::cast(bool skipCheck)
TakePower(); TakePower();
} }
if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(m_spellInfo->Id)) if(m_customAttr & SPELL_ATTR_CU_LINK_CAST)
{ {
for(std::vector<int32>::const_iterator i = spell_triggered->begin(); i != spell_triggered->end(); ++i) if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(m_spellInfo->Id))
{ for(std::vector<int32>::const_iterator i = spell_triggered->begin(); i != spell_triggered->end(); ++i)
if(*i < 0) if(*i < 0)
m_caster->RemoveAurasDueToSpell(-(*i)); m_caster->RemoveAurasDueToSpell(-(*i));
else else
m_caster->CastSpell(m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster, *i, true); m_caster->CastSpell(m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster, *i, true);
}
} }
SetExecutedCurrently(false); SetExecutedCurrently(false);
+1 -19
View File
@@ -240,7 +240,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
&Aura::HandleNULL, //183 SPELL_AURA_MOD_CRITICAL_THREAT &Aura::HandleNULL, //183 SPELL_AURA_MOD_CRITICAL_THREAT
&Aura::HandleNoImmediateEffect, //184 SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst &Aura::HandleNoImmediateEffect, //184 SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
&Aura::HandleNoImmediateEffect, //185 SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst &Aura::HandleNoImmediateEffect, //185 SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
&Aura::HandleModAttackerSpellHitChance, //186 SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE implemented in Unit::MagicSpellHitResult &Aura::HandleNoImmediateEffect, //186 SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE implemented in Unit::MagicSpellHitResult
&Aura::HandleNoImmediateEffect, //187 SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE implemented in Unit::GetUnitCriticalChance &Aura::HandleNoImmediateEffect, //187 SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE implemented in Unit::GetUnitCriticalChance
&Aura::HandleNoImmediateEffect, //188 SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE implemented in Unit::GetUnitCriticalChance &Aura::HandleNoImmediateEffect, //188 SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE implemented in Unit::GetUnitCriticalChance
&Aura::HandleModRating, //189 SPELL_AURA_MOD_RATING &Aura::HandleModRating, //189 SPELL_AURA_MOD_RATING
@@ -2038,12 +2038,6 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
return; return;
} }
// electrical storm safe zone
if (GetId() == 44007)
{
m_target->ApplySpellImmune(44007, IMMUNITY_ID, 43657, apply);
return;
}
break; break;
} }
case SPELLFAMILY_MAGE: case SPELLFAMILY_MAGE:
@@ -6113,15 +6107,3 @@ void Aura::HandleArenaPreparation(bool apply, bool Real)
else else
m_target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREPARATION); m_target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREPARATION);
} }
void Aura::HandleModAttackerSpellHitChance(bool apply, bool Real)
{
if(!Real)
return;
if(GetId() != 31224)
return;
//cloak of shadows : flare
m_target->ApplySpellImmune(31224, IMMUNITY_ID, 1543, apply);
}
-1
View File
@@ -209,7 +209,6 @@ class TRINITY_DLL_SPEC Aura
void HandlePreventFleeing(bool apply, bool Real); void HandlePreventFleeing(bool apply, bool Real);
void HandleManaShield(bool apply, bool Real); void HandleManaShield(bool apply, bool Real);
void HandleArenaPreparation(bool apply, bool Real); void HandleArenaPreparation(bool apply, bool Real);
void HandleModAttackerSpellHitChance(bool apply, bool Real);
virtual ~Aura(); virtual ~Aura();
+20 -1
View File
@@ -2266,9 +2266,28 @@ void SpellMgr::LoadSpellLinked()
} }
if(type) //we will find a better way when more types are needed if(type) //we will find a better way when more types are needed
trigger += 1000000; {
if(trigger > 0)
trigger += SPELL_LINKED_MAX_SPELLS * type;
else
trigger -= SPELL_LINKED_MAX_SPELLS * type;
}
mSpellLinkedMap[trigger].push_back(effect); mSpellLinkedMap[trigger].push_back(effect);
if(trigger > 0)
{
switch(type)
{
case 0: mSpellCustomAttr[trigger] |= SPELL_ATTR_CU_LINK_CAST; break;
case 1: mSpellCustomAttr[trigger] |= SPELL_ATTR_CU_LINK_HIT; break;
case 2: mSpellCustomAttr[trigger] |= SPELL_ATTR_CU_LINK_AURA; break;
}
}
else
{
mSpellCustomAttr[-trigger] |= SPELL_ATTR_CU_LINK_REMOVE;
}
++count; ++count;
} while( result->NextRow() ); } while( result->NextRow() );
+15
View File
@@ -291,6 +291,16 @@ enum SpellSpecific
SPELL_FOOD = 20 SPELL_FOOD = 20
}; };
#define SPELL_LINKED_MAX_SPELLS 200000
enum SpellLinkedType
{
SPELL_LINK_CAST = 0, // +: cast; -: remove
SPELL_LINK_HIT = 1 * 200000,
SPELL_LINK_AURA = 2 * 200000, // +: aura; -: immune
SPELL_LINK_REMOVE = 0,
};
SpellSpecific GetSpellSpecific(uint32 spellId); SpellSpecific GetSpellSpecific(uint32 spellId);
// Different spell properties // Different spell properties
@@ -703,6 +713,11 @@ inline bool IsProfessionSkill(uint32 skill)
#define SPELL_ATTR_CU_AURA_SPELL 0x00000080 #define SPELL_ATTR_CU_AURA_SPELL 0x00000080
#define SPELL_ATTR_CU_DIRECT_DAMAGE 0x00000100 #define SPELL_ATTR_CU_DIRECT_DAMAGE 0x00000100
#define SPELL_ATTR_CU_CHARGE 0x00000200 #define SPELL_ATTR_CU_CHARGE 0x00000200
#define SPELL_ATTR_CU_LINK_CAST 0x00000400
#define SPELL_ATTR_CU_LINK_HIT 0x00000800
#define SPELL_ATTR_CU_LINK_AURA 0x00001000
#define SPELL_ATTR_CU_LINK_REMOVE 0x00002000
typedef std::vector<uint32> SpellCustomAttribute; typedef std::vector<uint32> SpellCustomAttribute;
+31 -10
View File
@@ -4248,6 +4248,18 @@ bool Unit::AddAura(Aura *Aur)
} }
Aur->ApplyModifier(true,true); Aur->ApplyModifier(true,true);
uint32 id = Aur->GetId();
if(spellmgr.GetSpellCustomAttr(id) & SPELL_ATTR_CU_LINK_AURA)
{
if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(id + SPELL_LINK_AURA))
for(std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr)
if(*itr < 0)
ApplySpellImmune(id, IMMUNITY_ID, *itr, true);
else if(Unit* caster = Aur->GetCaster())
caster->AddAura(*itr, this);
}
sLog.outDebug("Aura %u now is in use", Aur->GetModifier()->m_auraname); sLog.outDebug("Aura %u now is in use", Aur->GetModifier()->m_auraname);
return true; return true;
} }
@@ -4698,15 +4710,24 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
if(mode != AURA_REMOVE_BY_STACK) if(mode != AURA_REMOVE_BY_STACK)
{ {
if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(-(int32)Aur->GetSpellProto()->Id)) uint32 id = Aur->GetId();
if(spellmgr.GetSpellCustomAttr(id) & SPELL_ATTR_CU_LINK_REMOVE)
{ {
for(std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr) if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(-(int32)id))
{ for(std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr)
if(*itr < 0) if(*itr < 0)
RemoveAurasDueToSpell(-(*itr)); RemoveAurasDueToSpell(-(*itr));
else if(Unit* caster = Aur->GetCaster()) else if(Unit* caster = Aur->GetCaster())
CastSpell(this, *itr, true, 0, 0, caster->GetGUID()); CastSpell(this, *itr, true, 0, 0, caster->GetGUID());
} }
if(spellmgr.GetSpellCustomAttr(id) & SPELL_ATTR_CU_LINK_AURA)
{
if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(id + SPELL_LINK_AURA))
for(std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr)
if(*itr < 0)
ApplySpellImmune(id, IMMUNITY_ID, *itr, false);
else
RemoveAurasDueToSpell(*itr);
} }
} }
@@ -13249,12 +13270,12 @@ void Unit::AddAura(uint32 spellId, Unit* target)
if(target->IsImmunedToSpellEffect(spellInfo->Effect[i], spellInfo->EffectMechanic[i])) if(target->IsImmunedToSpellEffect(spellInfo->Effect[i], spellInfo->EffectMechanic[i]))
continue; continue;
if(spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_CASTER) /*if(spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_CASTER)
{ {
Aura *Aur = CreateAura(spellInfo, i, NULL, this, this); Aura *Aur = CreateAura(spellInfo, i, NULL, this, this);
AddAura(Aur); AddAura(Aur);
} }
else else*/
{ {
Aura *Aur = CreateAura(spellInfo, i, NULL, target, this); Aura *Aur = CreateAura(spellInfo, i, NULL, target, this);
target->AddAura(Aur); target->AddAura(Aur);