*Merge.
--HG-- branch : trunk
This commit is contained in:
+44
-35
@@ -2030,8 +2030,7 @@ void Spell::prepare(SpellCastTargets const* targets, Aura* triggeredByAura)
|
|||||||
// set timer base at cast time
|
// set timer base at cast time
|
||||||
ReSetTimer();
|
ReSetTimer();
|
||||||
|
|
||||||
//item: first cast may destroy item and second cast causes crash
|
if(m_IsTriggeredSpell)
|
||||||
if(m_IsTriggeredSpell || !m_casttime && !m_spellInfo->StartRecoveryTime && !m_castItemGUID && GetCurrentContainer() == CURRENT_GENERIC_SPELL)
|
|
||||||
cast(true);
|
cast(true);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2040,9 +2039,16 @@ void Spell::prepare(SpellCastTargets const* targets, Aura* triggeredByAura)
|
|||||||
if(isSpellBreakStealth(m_spellInfo) )
|
if(isSpellBreakStealth(m_spellInfo) )
|
||||||
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CAST);
|
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CAST);
|
||||||
|
|
||||||
m_caster->SetCurrentCastedSpell( this );
|
if(!m_casttime && !m_spellInfo->StartRecoveryTime
|
||||||
m_selfContainer = &(m_caster->m_currentSpells[GetCurrentContainer()]);
|
&& !m_castItemGUID //item: first cast may destroy item and second cast causes crash
|
||||||
SendSpellStart();
|
&& GetCurrentContainer() == CURRENT_GENERIC_SPELL)
|
||||||
|
cast(true);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_caster->SetCurrentCastedSpell( this );
|
||||||
|
m_selfContainer = &(m_caster->m_currentSpells[GetCurrentContainer()]);
|
||||||
|
SendSpellStart();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2147,9 +2153,6 @@ void Spell::cast(bool skipCheck)
|
|||||||
|
|
||||||
FillTargetMap();
|
FillTargetMap();
|
||||||
|
|
||||||
if(m_customAttr & SPELL_ATTR_CU_DIRECT_DAMAGE)
|
|
||||||
CalculateDamageDoneForAllTargets();
|
|
||||||
|
|
||||||
if(m_spellInfo->SpellFamilyName)
|
if(m_spellInfo->SpellFamilyName)
|
||||||
{
|
{
|
||||||
if (m_spellInfo->excludeCasterAuraSpell)
|
if (m_spellInfo->excludeCasterAuraSpell)
|
||||||
@@ -2205,12 +2208,15 @@ void Spell::cast(bool skipCheck)
|
|||||||
SendCastResult(castResult);
|
SendCastResult(castResult);
|
||||||
SendSpellGo(); // we must send smsg_spell_go packet before m_castItem delete in TakeCastItem()...
|
SendSpellGo(); // we must send smsg_spell_go packet before m_castItem delete in TakeCastItem()...
|
||||||
|
|
||||||
|
if(m_customAttr & SPELL_ATTR_CU_DIRECT_DAMAGE)
|
||||||
|
CalculateDamageDoneForAllTargets();
|
||||||
|
|
||||||
|
if(m_customAttr & SPELL_ATTR_CU_CHARGE)
|
||||||
|
EffectCharge(0);
|
||||||
|
|
||||||
// Okay, everything is prepared. Now we need to distinguish between immediate and evented delayed spells
|
// Okay, everything is prepared. Now we need to distinguish between immediate and evented delayed spells
|
||||||
if (m_spellInfo->speed > 0.0f && !IsChanneledSpell(m_spellInfo))
|
if (m_spellInfo->speed > 0.0f && !IsChanneledSpell(m_spellInfo))
|
||||||
{
|
{
|
||||||
if(m_customAttr & SPELL_ATTR_CU_CHARGE)
|
|
||||||
EffectCharge(0);
|
|
||||||
|
|
||||||
// Remove used for cast item if need (it can be already NULL after TakeReagents call
|
// Remove used for cast item if need (it can be already NULL after TakeReagents call
|
||||||
// in case delayed spell remove item at cast delay start
|
// in case delayed spell remove item at cast delay start
|
||||||
TakeCastItem();
|
TakeCastItem();
|
||||||
@@ -2226,6 +2232,32 @@ void Spell::cast(bool skipCheck)
|
|||||||
handle_immediate();
|
handle_immediate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//are there any spells need to be triggered after hit?
|
||||||
|
// handle SPELL_AURA_ADD_TARGET_TRIGGER auras
|
||||||
|
Unit::AuraList const& targetTriggers = m_caster->GetAurasByType(SPELL_AURA_ADD_TARGET_TRIGGER);
|
||||||
|
for(Unit::AuraList::const_iterator i = targetTriggers.begin(); i != targetTriggers.end(); ++i)
|
||||||
|
{
|
||||||
|
if (!(*i)->isAffectedOnSpell(m_spellInfo))
|
||||||
|
continue;
|
||||||
|
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
|
||||||
|
if( ihit->missCondition == SPELL_MISS_NONE )
|
||||||
|
{
|
||||||
|
// check m_caster->GetGUID() let load auras at login and speedup most often case
|
||||||
|
Unit *unit = m_caster->GetGUID()== ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
|
||||||
|
if (unit && unit->isAlive())
|
||||||
|
{
|
||||||
|
SpellEntry const *auraSpellInfo = (*i)->GetSpellProto();
|
||||||
|
uint32 auraSpellIdx = (*i)->GetEffIndex();
|
||||||
|
// Calculate chance at that moment (can be depend for example from combo points)
|
||||||
|
int32 chance = m_caster->CalculateSpellDamage(auraSpellInfo, auraSpellIdx, (*i)->GetBasePoints(),unit);
|
||||||
|
if(roll_chance_i(chance))
|
||||||
|
for (int j=0; j != (*i)->GetStackAmount(); ++j)
|
||||||
|
m_caster->CastSpell(unit, auraSpellInfo->EffectTriggerSpell[auraSpellIdx], true, NULL, (*i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// combo points should not be taken before SPELL_AURA_ADD_TARGET_TRIGGER auras are handled
|
||||||
if(!m_IsTriggeredSpell)
|
if(!m_IsTriggeredSpell)
|
||||||
{
|
{
|
||||||
TakePower();
|
TakePower();
|
||||||
@@ -2619,30 +2651,6 @@ void Spell::finish(bool ok)
|
|||||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||||
((Player*)m_caster)->RemoveSpellMods(this);
|
((Player*)m_caster)->RemoveSpellMods(this);
|
||||||
|
|
||||||
// handle SPELL_AURA_ADD_TARGET_TRIGGER auras
|
|
||||||
Unit::AuraList const& targetTriggers = m_caster->GetAurasByType(SPELL_AURA_ADD_TARGET_TRIGGER);
|
|
||||||
for(Unit::AuraList::const_iterator i = targetTriggers.begin(); i != targetTriggers.end(); ++i)
|
|
||||||
{
|
|
||||||
if (!(*i)->isAffectedOnSpell(m_spellInfo))
|
|
||||||
continue;
|
|
||||||
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
|
|
||||||
if( ihit->missCondition == SPELL_MISS_NONE )
|
|
||||||
{
|
|
||||||
// check m_caster->GetGUID() let load auras at login and speedup most often case
|
|
||||||
Unit *unit = m_caster->GetGUID()== ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
|
|
||||||
if (unit && unit->isAlive())
|
|
||||||
{
|
|
||||||
SpellEntry const *auraSpellInfo = (*i)->GetSpellProto();
|
|
||||||
uint32 auraSpellIdx = (*i)->GetEffIndex();
|
|
||||||
// Calculate chance at that moment (can be depend for example from combo points)
|
|
||||||
int32 chance = m_caster->CalculateSpellDamage(auraSpellInfo, auraSpellIdx, (*i)->GetBasePoints(),unit);
|
|
||||||
if(roll_chance_i(chance))
|
|
||||||
for (int j=0; j != (*i)->GetStackAmount(); ++j)
|
|
||||||
m_caster->CastSpell(unit, auraSpellInfo->EffectTriggerSpell[auraSpellIdx], true, NULL, (*i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Heal caster for all health leech from all targets
|
// Heal caster for all health leech from all targets
|
||||||
if (m_healthLeech)
|
if (m_healthLeech)
|
||||||
{
|
{
|
||||||
@@ -2660,6 +2668,7 @@ void Spell::finish(bool ok)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// call triggered spell only at successful cast (after clear combo points -> for add some if need)
|
// call triggered spell only at successful cast (after clear combo points -> for add some if need)
|
||||||
|
// I assume what he means is that some triggered spells may add combo points
|
||||||
if(!m_TriggerSpells.empty())
|
if(!m_TriggerSpells.empty())
|
||||||
TriggerSpell();
|
TriggerSpell();
|
||||||
|
|
||||||
|
|||||||
@@ -2232,7 +2232,7 @@ 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)
|
if(!spellInfo->speed && !spellInfo->SpellFamilyName)
|
||||||
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:
|
case SPELL_EFFECT_TRIGGER_SPELL:
|
||||||
|
|||||||
+7
-2
@@ -9275,9 +9275,9 @@ bool Unit::canDetectInvisibilityOf(Unit const* u) const
|
|||||||
{
|
{
|
||||||
if(m_invisibilityMask & u->m_invisibilityMask) // same group
|
if(m_invisibilityMask & u->m_invisibilityMask) // same group
|
||||||
return true;
|
return true;
|
||||||
AuraList const& auras = GetAurasByType(SPELL_AURA_MOD_STALKED); // Hunter mark
|
AuraList const& auras = u->GetAurasByType(SPELL_AURA_MOD_STALKED); // Hunter mark
|
||||||
for(AuraList::const_iterator iter = auras.begin(); iter != auras.end(); ++iter)
|
for(AuraList::const_iterator iter = auras.begin(); iter != auras.end(); ++iter)
|
||||||
if((*iter)->GetCasterGUID()==u->GetGUID())
|
if((*iter)->GetCasterGUID()==GetGUID())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if(uint32 mask = (m_detectInvisibilityMask & u->m_invisibilityMask))
|
if(uint32 mask = (m_detectInvisibilityMask & u->m_invisibilityMask))
|
||||||
@@ -9327,6 +9327,11 @@ bool Unit::canDetectStealthOf(Unit const* target, float distance) const
|
|||||||
if(HasAuraType(SPELL_AURA_DETECT_STEALTH))
|
if(HasAuraType(SPELL_AURA_DETECT_STEALTH))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
AuraList const& auras = target->GetAurasByType(SPELL_AURA_MOD_STALKED); // Hunter mark
|
||||||
|
for(AuraList::const_iterator iter = auras.begin(); iter != auras.end(); ++iter)
|
||||||
|
if((*iter)->GetCasterGUID()==GetGUID())
|
||||||
|
return true;
|
||||||
|
|
||||||
//Visible distance based on stealth value (stealth rank 4 300MOD, 10.5 - 3 = 7.5)
|
//Visible distance based on stealth value (stealth rank 4 300MOD, 10.5 - 3 = 7.5)
|
||||||
float visibleDistance = 10.5f - target->GetTotalAuraModifier(SPELL_AURA_MOD_STEALTH) / 100.0f;
|
float visibleDistance = 10.5f - target->GetTotalAuraModifier(SPELL_AURA_MOD_STEALTH) / 100.0f;
|
||||||
//Visible distance is modified by -Level Diff (every level diff = 1.0f in visible distance)
|
//Visible distance is modified by -Level Diff (every level diff = 1.0f in visible distance)
|
||||||
|
|||||||
Reference in New Issue
Block a user