*Fix the bug that charge spells do not apply stun auras.

*Update about triggered spells. Please report if spells such as execute and mass dispel are bugged.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-01-31 11:09:37 -06:00
parent b6f8f9eea8
commit 1f2292af79
4 changed files with 40 additions and 9 deletions
+10 -5
View File
@@ -273,13 +273,14 @@ void SpellCastTargets::write ( WorldPacket * data )
*data << m_strTarget; *data << m_strTarget;
} }
Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID, Spell** triggeringContainer ) Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID, Spell** triggeringContainer, bool skipCheck )
{ {
ASSERT( Caster != NULL && info != NULL ); ASSERT( Caster != NULL && info != NULL );
ASSERT( info == sSpellStore.LookupEntry( info->Id ) && "`info` must be pointer to sSpellStore element"); ASSERT( info == sSpellStore.LookupEntry( info->Id ) && "`info` must be pointer to sSpellStore element");
m_spellInfo = info; m_spellInfo = info;
m_customAttr = spellmgr.GetSpellCustomAttr(m_spellInfo->Id); m_customAttr = spellmgr.GetSpellCustomAttr(m_spellInfo->Id);
m_skipCheck = skipCheck;
m_caster = Caster; m_caster = Caster;
m_selfContainer = NULL; m_selfContainer = NULL;
m_triggeringContainer = triggeringContainer; m_triggeringContainer = triggeringContainer;
@@ -734,7 +735,11 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex)
// Calculate hit result // Calculate hit result
if(m_originalCaster) if(m_originalCaster)
{
target.missCondition = m_originalCaster->SpellHitResult(pVictim, m_spellInfo, m_canReflect); target.missCondition = m_originalCaster->SpellHitResult(pVictim, m_spellInfo, m_canReflect);
if(m_skipCheck && target.missCondition != SPELL_MISS_IMMUNE)
target.missCondition = SPELL_MISS_NONE;
}
else else
target.missCondition = SPELL_MISS_EVADE; //SPELL_MISS_NONE; target.missCondition = SPELL_MISS_EVADE; //SPELL_MISS_NONE;
@@ -980,7 +985,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
if (target->reflectResult == SPELL_MISS_NONE) // If reflected spell hit caster -> do all effect on him if (target->reflectResult == SPELL_MISS_NONE) // If reflected spell hit caster -> do all effect on him
DoSpellHitOnUnit(m_caster, mask); DoSpellHitOnUnit(m_caster, mask);
} }
else //TODO: This is a hack. need fix /*else //TODO: This is a hack. need fix
{ {
uint32 tempMask = 0; uint32 tempMask = 0;
for(uint32 i = 0; i < 3; ++i) for(uint32 i = 0; i < 3; ++i)
@@ -989,7 +994,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
tempMask |= 1<<i; tempMask |= 1<<i;
if(tempMask &= mask) if(tempMask &= mask)
DoSpellHitOnUnit(unit, tempMask); DoSpellHitOnUnit(unit, tempMask);
} }*/
// All calculated do it! // All calculated do it!
// Do healing and triggers // Do healing and triggers
@@ -3299,7 +3304,7 @@ void Spell::TriggerSpell()
{ {
for(TriggerSpells::iterator si=m_TriggerSpells.begin(); si!=m_TriggerSpells.end(); ++si) for(TriggerSpells::iterator si=m_TriggerSpells.begin(); si!=m_TriggerSpells.end(); ++si)
{ {
Spell* spell = new Spell(m_caster, (*si), true, m_originalCasterGUID, m_selfContainer); Spell* spell = new Spell(m_caster, (*si), true, m_originalCasterGUID, m_selfContainer, true);
spell->prepare(&m_targets); // use original spell original targets spell->prepare(&m_targets); // use original spell original targets
} }
} }
@@ -3626,7 +3631,7 @@ uint8 Spell::CanCast(bool strict)
} }
}*/ }*/
if(!m_triggeredByAuraSpell) if(!m_skipCheck && !m_triggeredByAuraSpell)
if(uint8 castResult = CheckRange(strict)) if(uint8 castResult = CheckRange(strict))
return castResult; return castResult;
+2 -1
View File
@@ -320,7 +320,7 @@ class Spell
void EffectQuestFail(uint32 i); void EffectQuestFail(uint32 i);
void EffectRedirectThreat(uint32 i); void EffectRedirectThreat(uint32 i);
Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID = 0, Spell** triggeringContainer = NULL ); Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID = 0, Spell** triggeringContainer = NULL, bool skipCheck = false );
~Spell(); ~Spell();
void prepare(SpellCastTargets * targets, Aura* triggeredByAura = NULL); void prepare(SpellCastTargets * targets, Aura* triggeredByAura = NULL);
@@ -571,6 +571,7 @@ class Spell
SpellEntry const* m_triggeredByAuraSpell; SpellEntry const* m_triggeredByAuraSpell;
uint32 m_customAttr; uint32 m_customAttr;
bool m_skipCheck;
}; };
namespace Trinity namespace Trinity
+23 -2
View File
@@ -609,6 +609,9 @@ void Spell::EffectDummy(uint32 i)
if(!unitTarget && !gameObjTarget && !itemTarget) if(!unitTarget && !gameObjTarget && !itemTarget)
return; return;
uint32 spell_id = 0;
int32 bp = 0;
// selection by spell family // selection by spell family
switch(m_spellInfo->SpellFamilyName) switch(m_spellInfo->SpellFamilyName)
{ {
@@ -1279,8 +1282,8 @@ void Spell::EffectDummy(uint32 i)
if(!unitTarget) if(!unitTarget)
return; return;
int32 basePoints0 = damage+int32(m_caster->GetPower(POWER_RAGE) * m_spellInfo->DmgMultiplier[i]); spell_id = 20647;
m_caster->CastCustomSpell(unitTarget, 20647, &basePoints0, NULL, NULL, true, 0); bp = damage+int32(m_caster->GetPower(POWER_RAGE) * m_spellInfo->DmgMultiplier[i]);
m_caster->SetPower(POWER_RAGE,0); m_caster->SetPower(POWER_RAGE,0);
return; return;
} }
@@ -1682,6 +1685,24 @@ void Spell::EffectDummy(uint32 i)
break; break;
} }
//spells triggered by dummy effect should not miss
if(spell_id)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry( spell_id );
if(!spellInfo)
{
sLog.outError("EffectDummy of spell %u: triggering unknown spell id %i\n", m_spellInfo->Id, spell_id);
return;
}
Spell* spell = new Spell(m_caster, spellInfo, true, m_originalCasterGUID, NULL, true);
if(bp) spell->m_currentBasePoints[0] = bp;
SpellCastTargets targets;
targets.setUnitTarget(unitTarget);
spell->prepare(&targets);
}
// pet auras // pet auras
if(PetAura const* petSpell = spellmgr.GetPetAura(m_spellInfo->Id)) if(PetAura const* petSpell = spellmgr.GetPetAura(m_spellInfo->Id))
{ {
+4
View File
@@ -2150,8 +2150,12 @@ void SpellMgr::LoadSpellCustomAttr()
mSpellCustomAttr[i] |= SPELL_ATTR_CU_DIRECT_DAMAGE; mSpellCustomAttr[i] |= SPELL_ATTR_CU_DIRECT_DAMAGE;
break; break;
case SPELL_EFFECT_CHARGE: case SPELL_EFFECT_CHARGE:
if(!spellInfo->speed)
spellInfo->speed = SPEED_CHARGE; spellInfo->speed = SPEED_CHARGE;
mSpellCustomAttr[i] |= SPELL_ATTR_CU_CHARGE; mSpellCustomAttr[i] |= SPELL_ATTR_CU_CHARGE;
case SPELL_EFFECT_TRIGGER_SPELL:
if(spellInfo->Targets & (TARGET_FLAG_SOURCE_LOCATION|TARGET_FLAG_DEST_LOCATION))
spellInfo->Effect[j] = SPELL_EFFECT_TRIGGER_MISSILE;
break; break;
} }
} }