mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
[11288] Check IsPositiveEffect in IsPositiveSpell only for existed effects.
Thanks to NoFantasy for problem research. Also make IsPositiveEffect use SpellEntry* arg instead spell id.
This commit is contained in:
parent
dae28ae93a
commit
989d229968
9 changed files with 24 additions and 21 deletions
|
|
@ -92,11 +92,18 @@ bool DynamicObject::Create( uint32 guidlow, Unit *caster, uint32 spellId, SpellE
|
|||
SetFloatValue(DYNAMICOBJECT_RADIUS, radius);
|
||||
SetUInt32Value(DYNAMICOBJECT_CASTTIME, WorldTimer::getMSTime()); // new 2.4.0
|
||||
|
||||
SpellEntry const* spellProto = sSpellStore.LookupEntry(spellId);
|
||||
if (!spellProto)
|
||||
{
|
||||
sLog.outError("DynamicObject (spell %u) not created. Spell not exist!", spellId, GetPositionX(), GetPositionY());
|
||||
return false;
|
||||
}
|
||||
|
||||
m_aliveDuration = duration;
|
||||
m_radius = radius;
|
||||
m_effIndex = effIndex;
|
||||
m_spellId = spellId;
|
||||
m_positive = IsPositiveEffect(m_spellId, m_effIndex);
|
||||
m_positive = IsPositiveEffect(spellProto, m_effIndex);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1301,7 +1301,7 @@ void Pet::_LoadAuras(uint32 timediff)
|
|||
if ((effIndexMask & (1 << i)) == 0)
|
||||
continue;
|
||||
|
||||
if (remaintime[i] != -1 && !IsPositiveEffect(spellid, SpellEffectIndex(i)))
|
||||
if (remaintime[i] != -1 && !IsPositiveEffect(spellproto, SpellEffectIndex(i)))
|
||||
{
|
||||
if (remaintime[i]/IN_MILLISECONDS <= int32(timediff))
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -15980,7 +15980,7 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff)
|
|||
if ((effIndexMask & (1 << i)) == 0)
|
||||
continue;
|
||||
|
||||
if (remaintime[i] != -1 && !IsPositiveEffect(spellid, SpellEffectIndex(i)))
|
||||
if (remaintime[i] != -1 && !IsPositiveEffect(spellproto, SpellEffectIndex(i)))
|
||||
{
|
||||
if (remaintime[i]/IN_MILLISECONDS <= int32(timediff))
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -783,7 +783,7 @@ void Spell::prepareDataForTriggerSystem()
|
|||
// avoid triggering negative hit for only positive targets
|
||||
m_negativeEffectMask = 0x0;
|
||||
for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
|
||||
if (!IsPositiveEffect(m_spellInfo->Id, SpellEffectIndex(i)))
|
||||
if (!IsPositiveEffect(m_spellInfo, SpellEffectIndex(i)))
|
||||
m_negativeEffectMask |= (1<<i);
|
||||
|
||||
// Hunter traps spells (for Entrapment trigger)
|
||||
|
|
@ -1832,7 +1832,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
|
|||
SpellTargets targetB = SPELL_TARGETS_AOE_DAMAGE;
|
||||
|
||||
// Select friendly targets for positive effect
|
||||
if (IsPositiveEffect(m_spellInfo->Id, effIndex))
|
||||
if (IsPositiveEffect(m_spellInfo, effIndex))
|
||||
targetB = SPELL_TARGETS_FRIENDLY;
|
||||
|
||||
UnitList tempTargetUnitMap;
|
||||
|
|
|
|||
|
|
@ -385,7 +385,7 @@ m_isPersistent(false), m_in_use(0), m_spellAuraHolder(holder)
|
|||
|
||||
bool isPassive = IsPassiveSpell(GetSpellProto());
|
||||
bool isPermanent = false;
|
||||
m_positive = IsPositiveEffect(spellproto->Id, m_effIndex);
|
||||
m_positive = IsPositiveEffect(spellproto, m_effIndex);
|
||||
|
||||
m_applyTime = time(NULL);
|
||||
|
||||
|
|
|
|||
|
|
@ -623,17 +623,13 @@ bool IsExplicitNegativeTarget(uint32 targetA)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool IsPositiveEffect(uint32 spellId, SpellEffectIndex effIndex)
|
||||
bool IsPositiveEffect(SpellEntry const *spellproto, SpellEffectIndex effIndex)
|
||||
{
|
||||
SpellEntry const *spellproto = sSpellStore.LookupEntry(spellId);
|
||||
if (!spellproto)
|
||||
return false;
|
||||
|
||||
switch(spellproto->Effect[effIndex])
|
||||
{
|
||||
case SPELL_EFFECT_DUMMY:
|
||||
// some explicitly required dummy effect sets
|
||||
switch(spellId)
|
||||
switch(spellproto->Id)
|
||||
{
|
||||
case 28441: // AB Effect 000
|
||||
return false;
|
||||
|
|
@ -708,7 +704,7 @@ bool IsPositiveEffect(uint32 spellId, SpellEffectIndex effIndex)
|
|||
case SPELL_AURA_ADD_TARGET_TRIGGER:
|
||||
return true;
|
||||
case SPELL_AURA_PERIODIC_TRIGGER_SPELL:
|
||||
if (spellId != spellproto->EffectTriggerSpell[effIndex])
|
||||
if (spellproto->Id != spellproto->EffectTriggerSpell[effIndex])
|
||||
{
|
||||
uint32 spellTriggeredId = spellproto->EffectTriggerSpell[effIndex];
|
||||
SpellEntry const *spellTriggeredProto = sSpellStore.LookupEntry(spellTriggeredId);
|
||||
|
|
@ -720,8 +716,8 @@ bool IsPositiveEffect(uint32 spellId, SpellEffectIndex effIndex)
|
|||
{
|
||||
// if non-positive trigger cast targeted to positive target this main cast is non-positive
|
||||
// this will place this spell auras as debuffs
|
||||
if (IsPositiveTarget(spellTriggeredProto->EffectImplicitTargetA[effIndex],spellTriggeredProto->EffectImplicitTargetB[effIndex]) &&
|
||||
!IsPositiveEffect(spellTriggeredId,SpellEffectIndex(i)))
|
||||
if (IsPositiveTarget(spellTriggeredProto->EffectImplicitTargetA[effIndex], spellTriggeredProto->EffectImplicitTargetB[effIndex]) &&
|
||||
!IsPositiveEffect(spellTriggeredProto, SpellEffectIndex(i)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -854,7 +850,7 @@ bool IsPositiveSpell(uint32 spellId)
|
|||
// spells with at least one negative effect are considered negative
|
||||
// some self-applied spells have negative effects but in self casting case negative check ignored.
|
||||
for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
|
||||
if (!IsPositiveEffect(spellId, SpellEffectIndex(i)))
|
||||
if (spellproto->Effect[i] && !IsPositiveEffect(spellproto, SpellEffectIndex(i)))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2405,7 +2401,7 @@ SpellEntry const* SpellMgr::SelectAuraRankForLevel(SpellEntry const* spellInfo,
|
|||
IsAreaEffectPossitiveTarget(Targets(spellInfo->EffectImplicitTargetA[i])))) ||
|
||||
spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PARTY ||
|
||||
spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_RAID) &&
|
||||
IsPositiveEffect(spellInfo->Id, SpellEffectIndex(i)))
|
||||
IsPositiveEffect(spellInfo, SpellEffectIndex(i)))
|
||||
{
|
||||
needRankSelection = true;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ inline bool IsNonCombatSpell(SpellEntry const *spellInfo)
|
|||
}
|
||||
|
||||
bool IsPositiveSpell(uint32 spellId);
|
||||
bool IsPositiveEffect(uint32 spellId, SpellEffectIndex effIndex);
|
||||
bool IsPositiveEffect(SpellEntry const *spellInfo, SpellEffectIndex effIndex);
|
||||
bool IsPositiveTarget(uint32 targetA, uint32 targetB);
|
||||
|
||||
bool IsExplicitPositiveTarget(uint32 targetA);
|
||||
|
|
|
|||
|
|
@ -7195,7 +7195,7 @@ bool Unit::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex i
|
|||
for(AuraList::const_iterator iter = immuneAuraApply.begin(); iter != immuneAuraApply.end(); ++iter)
|
||||
if (spellInfo->Dispel == DISPEL_MAGIC && // Magic debuff
|
||||
((*iter)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spellInfo)) && // Check school
|
||||
!IsPositiveEffect(spellInfo->Id, index)) // Harmful
|
||||
!IsPositiveEffect(spellInfo, index)) // Harmful
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -8751,7 +8751,7 @@ int32 Unit::CalculateSpellDuration(SpellEntry const* spellProto, SpellEffectInde
|
|||
// Find total mod value (negative bonus)
|
||||
int32 durationMod_always = target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD, mechanic);
|
||||
// Modify from SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL aura for negative effects (stack always ?)
|
||||
if (!IsPositiveEffect(spellProto->Id, effect_index))
|
||||
if (!IsPositiveEffect(spellProto, effect_index))
|
||||
durationMod_always+=target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL, spellProto->Dispel);
|
||||
// Find max mod (negative bonus)
|
||||
int32 durationMod_not_stack = target->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK, mechanic);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11287"
|
||||
#define REVISION_NR "11288"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue