mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
Mage 400 INTO master/434
Signed-off-by: Salja <salja2012@hotmail.de>
This commit is contained in:
parent
7665a09232
commit
22bfaa12b0
66 changed files with 5773 additions and 3971 deletions
|
|
@ -1587,7 +1587,7 @@ bool Creature::IsImmuneToSpell(SpellEntry const* spellInfo)
|
|||
if (!spellInfo)
|
||||
return false;
|
||||
|
||||
if (GetCreatureInfo()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1)))
|
||||
if (GetCreatureInfo()->MechanicImmuneMask & (1 << (spellInfo->GetMechanic() - 1)))
|
||||
return true;
|
||||
|
||||
return Unit::IsImmuneToSpell(spellInfo);
|
||||
|
|
@ -1595,20 +1595,22 @@ bool Creature::IsImmuneToSpell(SpellEntry const* spellInfo)
|
|||
|
||||
bool Creature::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index) const
|
||||
{
|
||||
if (GetCreatureInfo()->MechanicImmuneMask & (1 << (spellInfo->EffectMechanic[index] - 1)))
|
||||
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(index);
|
||||
|
||||
if (spellEffect && GetCreatureInfo()->MechanicImmuneMask & (1 << (spellEffect->EffectMechanic - 1)))
|
||||
return true;
|
||||
|
||||
// Taunt immunity special flag check
|
||||
if (GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NOT_TAUNTABLE)
|
||||
{
|
||||
// Taunt aura apply check
|
||||
if (spellInfo->Effect[index] == SPELL_EFFECT_APPLY_AURA)
|
||||
if (spellEffect && spellEffect->Effect == SPELL_EFFECT_APPLY_AURA)
|
||||
{
|
||||
if (spellInfo->EffectApplyAuraName[index] == SPELL_AURA_MOD_TAUNT)
|
||||
if (spellEffect && spellEffect->EffectApplyAuraName == SPELL_AURA_MOD_TAUNT)
|
||||
return true;
|
||||
}
|
||||
// Spell effect taunt check
|
||||
else if (spellInfo->Effect[index] == SPELL_EFFECT_ATTACK_ME)
|
||||
else if (spellEffect && spellEffect->Effect == SPELL_EFFECT_ATTACK_ME)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1634,20 +1636,25 @@ SpellEntry const* Creature::ReachWithSpellAttack(Unit* pVictim)
|
|||
bool bcontinue = true;
|
||||
for (int j = 0; j < MAX_EFFECT_INDEX; ++j)
|
||||
{
|
||||
if ((spellInfo->Effect[j] == SPELL_EFFECT_SCHOOL_DAMAGE) ||
|
||||
(spellInfo->Effect[j] == SPELL_EFFECT_INSTAKILL) ||
|
||||
(spellInfo->Effect[j] == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE) ||
|
||||
(spellInfo->Effect[j] == SPELL_EFFECT_HEALTH_LEECH)
|
||||
)
|
||||
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(SpellEffectIndex(j));
|
||||
if(!spellEffect)
|
||||
continue;
|
||||
if( (spellEffect->Effect == SPELL_EFFECT_SCHOOL_DAMAGE ) ||
|
||||
(spellEffect->Effect == SPELL_EFFECT_INSTAKILL) ||
|
||||
(spellEffect->Effect == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE) ||
|
||||
(spellEffect->Effect == SPELL_EFFECT_HEALTH_LEECH )
|
||||
)
|
||||
{
|
||||
bcontinue = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (bcontinue) continue;
|
||||
|
||||
if (spellInfo->manaCost > GetPower(POWER_MANA))
|
||||
if (bcontinue)
|
||||
continue;
|
||||
|
||||
if(spellInfo->GetManaCost() > GetPower(POWER_MANA))
|
||||
continue;
|
||||
|
||||
SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex);
|
||||
float range = GetSpellMaxRange(srange);
|
||||
float minrange = GetSpellMinRange(srange);
|
||||
|
|
@ -1658,12 +1665,16 @@ SpellEntry const* Creature::ReachWithSpellAttack(Unit* pVictim)
|
|||
// continue;
|
||||
if (dist > range || dist < minrange)
|
||||
continue;
|
||||
if (spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
|
||||
|
||||
|
||||
if(spellInfo->GetPreventionType() == SPELL_PREVENTION_TYPE_SILENCE && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
|
||||
continue;
|
||||
if (spellInfo->PreventionType == SPELL_PREVENTION_TYPE_PACIFY && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED))
|
||||
if(spellInfo->GetPreventionType() == SPELL_PREVENTION_TYPE_PACIFY && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED))
|
||||
continue;
|
||||
|
||||
return spellInfo;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -1686,7 +1697,8 @@ SpellEntry const* Creature::ReachWithSpellCure(Unit* pVictim)
|
|||
bool bcontinue = true;
|
||||
for (int j = 0; j < MAX_EFFECT_INDEX; ++j)
|
||||
{
|
||||
if ((spellInfo->Effect[j] == SPELL_EFFECT_HEAL))
|
||||
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(SpellEffectIndex(j));
|
||||
if( spellEffect && (spellEffect->Effect == SPELL_EFFECT_HEAL) )
|
||||
{
|
||||
bcontinue = false;
|
||||
break;
|
||||
|
|
@ -1695,8 +1707,9 @@ SpellEntry const* Creature::ReachWithSpellCure(Unit* pVictim)
|
|||
if (bcontinue)
|
||||
continue;
|
||||
|
||||
if (spellInfo->manaCost > GetPower(POWER_MANA))
|
||||
if(spellInfo->GetManaCost() > GetPower(POWER_MANA))
|
||||
continue;
|
||||
|
||||
SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex);
|
||||
float range = GetSpellMaxRange(srange);
|
||||
float minrange = GetSpellMinRange(srange);
|
||||
|
|
@ -1707,12 +1720,15 @@ SpellEntry const* Creature::ReachWithSpellCure(Unit* pVictim)
|
|||
// continue;
|
||||
if (dist > range || dist < minrange)
|
||||
continue;
|
||||
if (spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
|
||||
|
||||
if(spellInfo->GetPreventionType() == SPELL_PREVENTION_TYPE_SILENCE && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
|
||||
continue;
|
||||
if (spellInfo->PreventionType == SPELL_PREVENTION_TYPE_PACIFY && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED))
|
||||
if(spellInfo->GetPreventionType() == SPELL_PREVENTION_TYPE_PACIFY && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED))
|
||||
continue;
|
||||
|
||||
return spellInfo;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -2147,8 +2163,8 @@ void Creature::AddCreatureSpellCooldown(uint32 spellid)
|
|||
if (cooldown)
|
||||
_AddCreatureSpellCooldown(spellid, time(NULL) + cooldown / IN_MILLISECONDS);
|
||||
|
||||
if (spellInfo->Category)
|
||||
_AddCreatureCategoryCooldown(spellInfo->Category, time(NULL));
|
||||
if(uint32 category = spellInfo->GetCategory())
|
||||
_AddCreatureCategoryCooldown(category, time(NULL));
|
||||
}
|
||||
|
||||
bool Creature::HasCategoryCooldown(uint32 spell_id) const
|
||||
|
|
@ -2157,8 +2173,8 @@ bool Creature::HasCategoryCooldown(uint32 spell_id) const
|
|||
if (!spellInfo)
|
||||
return false;
|
||||
|
||||
CreatureSpellCooldowns::const_iterator itr = m_CreatureCategoryCooldowns.find(spellInfo->Category);
|
||||
return (itr != m_CreatureCategoryCooldowns.end() && time_t(itr->second + (spellInfo->CategoryRecoveryTime / IN_MILLISECONDS)) > time(NULL));
|
||||
CreatureSpellCooldowns::const_iterator itr = m_CreatureCategoryCooldowns.find(spellInfo->GetCategory());
|
||||
return (itr != m_CreatureCategoryCooldowns.end() && time_t(itr->second + (spellInfo->GetCategoryRecoveryTime() / IN_MILLISECONDS)) > time(NULL));
|
||||
}
|
||||
|
||||
bool Creature::HasSpellCooldown(uint32 spell_id) const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue