mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[7111] Fixes in Spell Effect immunes
Correct totem immunes for dot/leech/Fear/Transform auras (immune only to effect) Correct log if all effects immuned by Effect Immune Move check for IMMUNITY_STATE to Unit::IsImmunedToSpellEffect Signed-off-by: DiSlord <dislord@nomail.com>
This commit is contained in:
parent
c9ae3b8b5c
commit
17004d59d4
11 changed files with 61 additions and 53 deletions
|
|
@ -757,8 +757,6 @@ void Spell::CleanupTargetList()
|
|||
m_UniqueTargetInfo.clear();
|
||||
m_UniqueGOTargetInfo.clear();
|
||||
m_UniqueItemInfo.clear();
|
||||
m_countOfHit = 0;
|
||||
m_countOfMiss = 0;
|
||||
m_delayMoment = 0;
|
||||
}
|
||||
|
||||
|
|
@ -767,6 +765,9 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex)
|
|||
if( m_spellInfo->Effect[effIndex]==0 )
|
||||
return;
|
||||
|
||||
// Check for effect immune skip if immuned
|
||||
bool immuned = pVictim->IsImmunedToSpellEffect(m_spellInfo, effIndex);
|
||||
|
||||
uint64 targetGUID = pVictim->GetGUID();
|
||||
|
||||
// Lookup target in already in list
|
||||
|
|
@ -774,7 +775,8 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex)
|
|||
{
|
||||
if (targetGUID == ihit->targetGUID) // Found in list
|
||||
{
|
||||
ihit->effectMask |= 1<<effIndex; // Add only effect mask
|
||||
if (!immuned)
|
||||
ihit->effectMask |= 1<<effIndex; // Add only effect mask if not immuned
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -784,15 +786,11 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex)
|
|||
// Get spell hit result on target
|
||||
TargetInfo target;
|
||||
target.targetGUID = targetGUID; // Store target GUID
|
||||
target.effectMask = 1<<effIndex; // Store index of effect
|
||||
target.effectMask = immuned ? 0 : 1<<effIndex; // Store index of effect if not immuned
|
||||
target.processed = false; // Effects not apply on target
|
||||
|
||||
// Calculate hit result
|
||||
target.missCondition = m_caster->SpellHitResult(pVictim, m_spellInfo, m_canReflect);
|
||||
if (target.missCondition == SPELL_MISS_NONE)
|
||||
++m_countOfHit;
|
||||
else
|
||||
++m_countOfMiss;
|
||||
|
||||
// Spell have speed - need calculate incoming time
|
||||
if (m_spellInfo->speed > 0.0f)
|
||||
|
|
@ -872,8 +870,6 @@ void Spell::AddGOTarget(GameObject* pVictim, uint32 effIndex)
|
|||
else
|
||||
target.timeDelay = 0LL;
|
||||
|
||||
++m_countOfHit;
|
||||
|
||||
// Add target to list
|
||||
m_UniqueGOTargetInfo.push_back(target);
|
||||
}
|
||||
|
|
@ -916,8 +912,6 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
|
|||
|
||||
// Get mask of effects for target
|
||||
uint32 mask = target->effectMask;
|
||||
if (mask == 0) // No effects
|
||||
return;
|
||||
|
||||
Unit* unit = m_caster->GetGUID()==target->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster,target->targetGUID);
|
||||
if (!unit)
|
||||
|
|
@ -2985,7 +2979,23 @@ void Spell::WriteAmmoToPacket( WorldPacket * data )
|
|||
|
||||
void Spell::WriteSpellGoTargets( WorldPacket * data )
|
||||
{
|
||||
*data << (uint8)m_countOfHit;
|
||||
uint32 hit = m_UniqueGOTargetInfo.size(); // Always hits on GO
|
||||
uint32 miss = 0;
|
||||
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
|
||||
{
|
||||
if ((*ihit).effectMask == 0) // No effect apply - all immuned add state
|
||||
{
|
||||
// possibly SPELL_MISS_IMMUNE2 for this??
|
||||
ihit->missCondition = SPELL_MISS_IMMUNE2;
|
||||
miss++;
|
||||
}
|
||||
else if ((*ihit).missCondition == SPELL_MISS_NONE)
|
||||
hit++;
|
||||
else
|
||||
miss++;
|
||||
}
|
||||
|
||||
*data << (uint8)hit;
|
||||
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
|
||||
if ((*ihit).missCondition == SPELL_MISS_NONE) // Add only hits
|
||||
*data << uint64(ihit->targetGUID);
|
||||
|
|
@ -2993,7 +3003,7 @@ void Spell::WriteSpellGoTargets( WorldPacket * data )
|
|||
for(std::list<GOTargetInfo>::iterator ighit= m_UniqueGOTargetInfo.begin();ighit != m_UniqueGOTargetInfo.end();++ighit)
|
||||
*data << uint64(ighit->targetGUID); // Always hits
|
||||
|
||||
*data << (uint8)m_countOfMiss;
|
||||
*data << (uint8)miss;
|
||||
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
|
||||
{
|
||||
if( ihit->missCondition != SPELL_MISS_NONE ) // Add only miss
|
||||
|
|
@ -3501,16 +3511,11 @@ void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTar
|
|||
gameObjTarget = pGOTarget;
|
||||
|
||||
uint8 eff = m_spellInfo->Effect[i];
|
||||
uint32 mechanic = m_spellInfo->EffectMechanic[i];
|
||||
|
||||
damage = int32(CalculateDamage((uint8)i,unitTarget)*DamageMultiplier);
|
||||
|
||||
sLog.outDebug( "Spell: Effect : %u", eff);
|
||||
|
||||
//Simply return. Do not display "immune" in red text on client
|
||||
if(unitTarget && unitTarget->IsImmunedToSpellEffect(eff, mechanic))
|
||||
return;
|
||||
|
||||
if(eff<TOTAL_SPELL_EFFECTS)
|
||||
{
|
||||
//sLog.outDebug( "WORLD: Spell FX %d < TOTAL_SPELL_EFFECTS ", eff);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue