*Allow dest target spells to proc spellcast.

*Allow source target spells to be triggered during spellproc if no unit target avalible.

--HG--
branch : trunk
This commit is contained in:
QAston
2009-07-05 16:58:42 +02:00
parent a7f55ece55
commit 67f8ec608c
6 changed files with 59 additions and 8 deletions
+3 -3
View File
@@ -1192,9 +1192,9 @@ INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `Spell
( 51474, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Astral Shift (Rank 1) ( 51474, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Astral Shift (Rank 1)
( 51478, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Astral Shift (Rank 2) ( 51478, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Astral Shift (Rank 2)
( 51479, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Astral Shift (Rank 3) ( 51479, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Astral Shift (Rank 3)
(51483, 0x00000001, 11, 0x20000000, 0x00000000, 0x00000000, 0x00000400, 0x00000000, 0.000000, 0.000000, 0), (51483, 0x00000001, 11, 0x20000000, 0x00000000, 0x00000000, 0x00004000, 0x00000001, 0.000000, 0.000000, 0),
(51485, 0x00000001, 11, 0x20000000, 0x00000000, 0x00000000, 0x00000400, 0x00000000, 0.000000, 0.000000, 0), (51485, 0x00000001, 11, 0x20000000, 0x00000000, 0x00000000, 0x00004000, 0x00000001, 0.000000, 0.000000, 0),
(51486, 0x00000001, 11, 0x20000000, 0x00000000, 0x00000000, 0x00000400, 0x00000000, 0.000000, 0.000000, 0), (51486, 0x00000001, 11, 0x20000000, 0x00000000, 0x00000000, 0x00004000, 0x00000001, 0.000000, 0.000000, 0),
( 51521, 0x00, 11, 0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Stormstrike ( 51521, 0x00, 11, 0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Stormstrike
( 51522, 0x00, 11, 0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Stormstrike ( 51522, 0x00, 11, 0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Stormstrike
( 51528, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2.5, 0, 0), -- Maelstrom Weapon (Rank 1) ( 51528, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2.5, 0, 0), -- Maelstrom Weapon (Rank 1)
@@ -0,0 +1,5 @@
DELETE FROM `spell_proc_event` WHERE `entry` IN (51483, 51485, 51486);
INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES
(51483, 0x00000001, 11, 0x20000000, 0x00000000, 0x00000000, 0x00004000, 0x00000001, 0.000000, 0.000000, 0),
(51485, 0x00000001, 11, 0x20000000, 0x00000000, 0x00000000, 0x00004000, 0x00000001, 0.000000, 0.000000, 0),
(51486, 0x00000001, 11, 0x20000000, 0x00000000, 0x00000000, 0x00004000, 0x00000001, 0.000000, 0.000000, 0);
+33
View File
@@ -3076,6 +3076,7 @@ void Spell::_handle_immediate_phase()
if(!m_originalCaster) if(!m_originalCaster)
return; return;
uint8 oldEffMask = m_effectMask;
// process ground // process ground
for(uint32 j = 0; j < 3; ++j) for(uint32 j = 0; j < 3; ++j)
{ {
@@ -3092,6 +3093,38 @@ void Spell::_handle_immediate_phase()
m_effectMask |= (1<<j); m_effectMask |= (1<<j);
} }
} }
if (oldEffMask != m_effectMask && m_UniqueTargetInfo.empty())
{
uint32 procAttacker = m_procAttacker;
if (!procAttacker)
{
bool positive = true;
for (uint8 i = 0; i< MAX_SPELL_EFFECTS; ++i)
// If at least one effect negative spell is negative hit
if (m_effectMask & (1<<i) && !IsPositiveEffect(m_spellInfo->Id, i))
{
positive = false;
break;
}
switch(m_spellInfo->DmgClass)
{
case SPELL_DAMAGE_CLASS_MAGIC:
if (positive)
procAttacker |= PROC_FLAG_SUCCESSFUL_POSITIVE_MAGIC_SPELL;
else
procAttacker |= PROC_FLAG_SUCCESSFUL_NEGATIVE_MAGIC_SPELL;
break;
case SPELL_DAMAGE_CLASS_NONE:
if (positive)
procAttacker |= PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL_HIT;
else
procAttacker |= PROC_FLAG_SUCCESSFUL_NEGATIVE_SPELL_HIT;
break;
}
}
// Proc damage for spells which have only dest targets (2484 should proc 51486 for example)
m_originalCaster->ProcDamageAndSpell(0, procAttacker, 0, m_procEx | PROC_EX_NORMAL_HIT, 0, BASE_ATTACK, m_spellInfo, m_triggeredByAuraSpell);
}
} }
void Spell::_handle_finish_phase() void Spell::_handle_finish_phase()
+11
View File
@@ -236,6 +236,7 @@ SpellMgr::SpellMgr()
} }
} }
SpellMgr::~SpellMgr() SpellMgr::~SpellMgr()
{ {
} }
@@ -246,6 +247,16 @@ SpellMgr& SpellMgr::Instance()
return spellMgr; return spellMgr;
} }
bool SpellMgr::IsSrcTargetSpell(SpellEntry const *spellInfo) const
{
for (uint8 i = 0; i< MAX_SPELL_EFFECTS; ++i)
{
if(SpellTargetType[spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_AREA_SRC || SpellTargetType[spellInfo->EffectImplicitTargetB[i]] == TARGET_TYPE_AREA_SRC)
return true;
}
return false;
}
int32 GetSpellDuration(SpellEntry const *spellInfo) int32 GetSpellDuration(SpellEntry const *spellInfo)
{ {
if(!spellInfo) if(!spellInfo)
+2
View File
@@ -1042,6 +1042,8 @@ class SpellMgr
return SpellAreaForAreaMapBounds(mSpellAreaForAreaMap.lower_bound(area_id),mSpellAreaForAreaMap.upper_bound(area_id)); return SpellAreaForAreaMapBounds(mSpellAreaForAreaMap.lower_bound(area_id),mSpellAreaForAreaMap.upper_bound(area_id));
} }
bool SpellMgr::IsSrcTargetSpell(SpellEntry const *spellInfo) const;
// Modifiers // Modifiers
public: public:
static SpellMgr& Instance(); static SpellMgr& Instance();
+5 -5
View File
@@ -4829,7 +4829,7 @@ bool Unit::HandleHasteAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
} }
// default case // default case
if(!target || target!=this && !target->isAlive()) if((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive()))
return false; return false;
if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id)) if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id))
@@ -6944,7 +6944,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
} }
// default case // default case
if(!target || target!=this && !target->isAlive()) if((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive()))
return false; return false;
if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id)) if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id))
@@ -7002,7 +7002,7 @@ bool Unit::HandleObsModEnergyAuraProc(Unit *pVictim, uint32 damage, AuraEffect*
} }
// default case // default case
if(!target || target!=this && !target->isAlive()) if((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive()))
return false; return false;
if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id)) if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id))
@@ -7059,7 +7059,7 @@ bool Unit::HandleModDamagePctTakenAuraProc(Unit *pVictim, uint32 damage, AuraEff
} }
// default case // default case
if(!target || target!=this && !target->isAlive()) if((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive()))
return false; return false;
if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id)) if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id))
@@ -7870,7 +7870,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
target = !(procFlags & (PROC_FLAG_SUCCESSFUL_POSITIVE_MAGIC_SPELL | PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL_HIT)) && IsPositiveSpell(trigger_spell_id) ? this : pVictim; target = !(procFlags & (PROC_FLAG_SUCCESSFUL_POSITIVE_MAGIC_SPELL | PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL_HIT)) && IsPositiveSpell(trigger_spell_id) ? this : pVictim;
// default case // default case
if(!target || target!=this && !target->isAlive()) if((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive()))
return false; return false;
if(basepoints0) if(basepoints0)