Mage 400 INTO master/434

Signed-off-by: Salja <salja2012@hotmail.de>
This commit is contained in:
Salja 2012-08-05 13:30:05 +02:00 committed by Antz
parent 7665a09232
commit 22bfaa12b0
66 changed files with 5773 additions and 3971 deletions

View file

@ -165,18 +165,18 @@ void MovementInfo::Write(ByteBuffer& data) const
bool GlobalCooldownMgr::HasGlobalCooldown(SpellEntry const* spellInfo) const
{
GlobalCooldownList::const_iterator itr = m_GlobalCooldowns.find(spellInfo->StartRecoveryCategory);
GlobalCooldownList::const_iterator itr = m_GlobalCooldowns.find(spellInfo->GetStartRecoveryCategory());
return itr != m_GlobalCooldowns.end() && itr->second.duration && WorldTimer::getMSTimeDiff(itr->second.cast_time, WorldTimer::getMSTime()) < itr->second.duration;
}
void GlobalCooldownMgr::AddGlobalCooldown(SpellEntry const* spellInfo, uint32 gcd)
{
m_GlobalCooldowns[spellInfo->StartRecoveryCategory] = GlobalCooldown(gcd, WorldTimer::getMSTime());
m_GlobalCooldowns[spellInfo->GetStartRecoveryCategory()] = GlobalCooldown(gcd, WorldTimer::getMSTime());
}
void GlobalCooldownMgr::CancelGlobalCooldown(SpellEntry const* spellInfo)
{
m_GlobalCooldowns[spellInfo->StartRecoveryCategory].duration = 0;
m_GlobalCooldowns[spellInfo->GetStartRecoveryCategory()].duration = 0;
}
////////////////////////////////////////////////////////////
@ -430,10 +430,10 @@ bool Unit::haveOffhandWeapon() const
else
{
uint32 ItemId = GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1);
ItemEntry const* itemInfo = sItemStore.LookupEntry(ItemId);
/*ItemEntry const* itemInfo = sItemStore.LookupEntry(ItemId);
if (itemInfo && itemInfo->Class == ITEM_CLASS_WEAPON)
return true;
return true;*/
return false;
}
@ -856,7 +856,7 @@ uint32 Unit::DealDamage(Unit* pVictim, uint32 damage, CleanDamage const* cleanDa
if (damagetype == DIRECT_DAMAGE || damagetype == SPELL_DIRECT_DAMAGE)
{
if (!spellProto || !(spellProto->AuraInterruptFlags & AURA_INTERRUPT_FLAG_DIRECT_DAMAGE))
if (!spellProto || !(spellProto->GetAuraInterruptFlags() & AURA_INTERRUPT_FLAG_DIRECT_DAMAGE))
pVictim->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_DIRECT_DAMAGE);
}
if (pVictim->GetTypeId() != TYPEID_PLAYER)
@ -899,7 +899,7 @@ uint32 Unit::DealDamage(Unit* pVictim, uint32 damage, CleanDamage const* cleanDa
next = i; ++next;
if (spellProto && spellProto->Id == se->Id) // Not drop auras added by self
continue;
if (!se->procFlags && (se->AuraInterruptFlags & AURA_INTERRUPT_FLAG_DAMAGE))
if (!se->GetProcFlags() && (se->GetAuraInterruptFlags() & AURA_INTERRUPT_FLAG_DAMAGE))
{
pVictim->RemoveAurasDueToSpell(i->second->GetId());
next = vAuras.begin();
@ -920,7 +920,7 @@ uint32 Unit::DealDamage(Unit* pVictim, uint32 damage, CleanDamage const* cleanDa
{
if (spell->getState() == SPELL_STATE_PREPARING)
{
if (spell->m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_ABORT_ON_DMG)
if(spell->m_spellInfo->GetInterruptFlags() & SPELL_INTERRUPT_FLAG_ABORT_ON_DMG)
pVictim->InterruptSpell(CurrentSpellTypes(i));
else
spell->Delayed();
@ -933,8 +933,8 @@ uint32 Unit::DealDamage(Unit* pVictim, uint32 damage, CleanDamage const* cleanDa
{
if (spell->getState() == SPELL_STATE_CASTING)
{
uint32 channelInterruptFlags = spell->m_spellInfo->ChannelInterruptFlags;
if (channelInterruptFlags & CHANNEL_FLAG_DELAY)
uint32 channelInterruptFlags = spell->m_spellInfo->GetChannelInterruptFlags();
if( channelInterruptFlags & CHANNEL_FLAG_DELAY )
{
if (pVictim != this) // don't shorten the duration of channeling if you damage yourself
spell->DelayedChannel();
@ -1137,9 +1137,9 @@ void Unit::CastSpell(Unit* Victim, SpellEntry const* spellInfo, bool triggered,
SpellCastTargets targets;
targets.setUnitTarget(Victim);
if (spellInfo->Targets & TARGET_FLAG_DEST_LOCATION)
if (spellInfo->GetTargets() & TARGET_FLAG_DEST_LOCATION)
targets.setDestination(Victim->GetPositionX(), Victim->GetPositionY(), Victim->GetPositionZ());
if (spellInfo->Targets & TARGET_FLAG_SOURCE_LOCATION)
if (spellInfo->GetTargets() & TARGET_FLAG_SOURCE_LOCATION)
if (WorldObject* caster = spell->GetCastingObject())
targets.setSource(caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ());
@ -1200,9 +1200,9 @@ void Unit::CastCustomSpell(Unit* Victim, SpellEntry const* spellInfo, int32 cons
targets.setUnitTarget(Victim);
spell->m_CastItem = castItem;
if (spellInfo->Targets & TARGET_FLAG_DEST_LOCATION)
if (spellInfo->GetTargets() & TARGET_FLAG_DEST_LOCATION)
targets.setDestination(Victim->GetPositionX(), Victim->GetPositionY(), Victim->GetPositionZ());
if (spellInfo->Targets & TARGET_FLAG_SOURCE_LOCATION)
if (spellInfo->GetTargets() & TARGET_FLAG_SOURCE_LOCATION)
if (WorldObject* caster = spell->GetCastingObject())
targets.setSource(caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ());
@ -1253,9 +1253,9 @@ void Unit::CastSpell(float x, float y, float z, SpellEntry const* spellInfo, boo
SpellCastTargets targets;
if (spellInfo->Targets & TARGET_FLAG_DEST_LOCATION)
if (spellInfo->GetTargets() & TARGET_FLAG_DEST_LOCATION)
targets.setDestination(x, y, z);
if (spellInfo->Targets & TARGET_FLAG_SOURCE_LOCATION)
if (spellInfo->GetTargets() & TARGET_FLAG_SOURCE_LOCATION)
targets.setSource(x, y, z);
// Spell cast with x,y,z but without dbc target-mask, set destination
@ -1296,7 +1296,7 @@ void Unit::CalculateSpellDamage(SpellNonMeleeDamage* damageInfo, int32 damage, S
bool crit = IsSpellCrit(pVictim, spellInfo, damageSchoolMask, attackType);
// damage bonus (per damage class)
switch (spellInfo->DmgClass)
switch (spellInfo->GetDmgClass())
{
// Melee and Ranged Spells
case SPELL_DAMAGE_CLASS_RANGED:
@ -1969,8 +1969,9 @@ void Unit::CalculateDamageAbsorbAndResist(Unit* pCaster, SpellSchoolMask schoolM
continue;
SpellEntry const* i_spellProto = (*i)->GetSpellProto();
SpellClassOptionsEntry const* adsClassOptions = i_spellProto->GetSpellClassOptions();
// Fire Ward or Frost Ward
if (i_spellProto->SpellFamilyName == SPELLFAMILY_MAGE && i_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000108))
if(adsClassOptions && adsClassOptions->SpellFamilyName == SPELLFAMILY_MAGE && adsClassOptions->SpellFamilyFlags & UI64LIT(0x0000000000000108))
{
int chance = 0;
Unit::AuraList const& auras = GetAurasByType(SPELL_AURA_ADD_PCT_MODIFIER);
@ -1978,7 +1979,7 @@ void Unit::CalculateDamageAbsorbAndResist(Unit* pCaster, SpellSchoolMask schoolM
{
SpellEntry const* itr_spellProto = (*itr)->GetSpellProto();
// Frost Warding (chance full absorb)
if (itr_spellProto->SpellFamilyName == SPELLFAMILY_MAGE && itr_spellProto->SpellIconID == 501)
if (itr_spellProto->GetSpellFamilyName() == SPELLFAMILY_MAGE && itr_spellProto->SpellIconID == 501)
{
// chance stored in next dummy effect
chance = itr_spellProto->CalculateSimpleValue(EFFECT_INDEX_1);
@ -2025,8 +2026,9 @@ void Unit::CalculateDamageAbsorbAndResist(Unit* pCaster, SpellSchoolMask schoolM
// Handle custom absorb auras
// TODO: try find better way
SpellClassOptionsEntry const* classOptions = spellProto->GetSpellClassOptions();
switch (spellProto->SpellFamilyName)
switch(spellProto->GetSpellFamilyName())
{
case SPELLFAMILY_GENERIC:
{
@ -2277,7 +2279,9 @@ void Unit::CalculateDamageAbsorbAndResist(Unit* pCaster, SpellSchoolMask schoolM
else
currentAbsorb = RemainingDamage;
if (float manaMultiplier = (*i)->GetSpellProto()->EffectMultipleValue[(*i)->GetEffIndex()])
SpellEffectEntry const* spellEffect = (*i)->GetSpellProto()->GetSpellEffect((*i)->GetEffIndex());
if (float manaMultiplier = (spellEffect ? spellEffect->EffectMultipleValue : 0))
{
if (Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod((*i)->GetId(), SPELLMOD_MULTIPLE_VALUE, manaMultiplier);
@ -2315,8 +2319,8 @@ void Unit::CalculateDamageAbsorbAndResist(Unit* pCaster, SpellSchoolMask schoolM
SpellEntry const* itr_spellProto = (*itr)->GetSpellProto();
// Incanter's Absorption
if (itr_spellProto->SpellFamilyName == SPELLFAMILY_GENERIC &&
itr_spellProto->SpellIconID == 2941)
if (itr_spellProto->GetSpellFamilyName() == SPELLFAMILY_GENERIC &&
itr_spellProto->SpellIconID == 2941)
{
int32 amount = int32(incanterAbsorption * (*itr)->GetModifier()->m_amount / 100);
@ -2398,7 +2402,7 @@ void Unit::CalculateDamageAbsorbAndResist(Unit* pCaster, SpellSchoolMask schoolM
// Apply death prevention spells effects
if (preventDeathSpell && RemainingDamage >= (int32)GetHealth())
{
switch (preventDeathSpell->SpellFamilyName)
switch(preventDeathSpell->GetSpellFamilyName())
{
// Cheat Death
case SPELLFAMILY_ROGUE:
@ -2437,7 +2441,7 @@ void Unit::CalculateAbsorbResistBlock(Unit* pCaster, SpellNonMeleeDamage* damage
{
bool blocked = false;
// Get blocked status
switch (spellProto->DmgClass)
switch (spellProto->GetDmgClass())
{
// Melee and Ranged Spells
case SPELL_DAMAGE_CLASS_RANGED:
@ -2823,8 +2827,8 @@ uint32 Unit::CalculateDamage(WeaponAttackType attType, bool normalized)
float Unit::CalculateLevelPenalty(SpellEntry const* spellProto) const
{
uint32 spellLevel = spellProto->spellLevel;
if (spellLevel <= 0)
uint32 spellLevel = spellProto->GetSpellLevel();
if(spellLevel <= 0)
return 1.0f;
float LvlPenalty = 0.0f;
@ -2950,11 +2954,11 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* pVictim, SpellEntry const* spell)
{
WeaponAttackType attType = BASE_ATTACK;
if (spell->DmgClass == SPELL_DAMAGE_CLASS_RANGED)
if (spell->GetDmgClass() == SPELL_DAMAGE_CLASS_RANGED)
attType = RANGED_ATTACK;
// bonus from skills is 0.04% per skill Diff
int32 attackerWeaponSkill = (spell->EquippedItemClass == ITEM_CLASS_WEAPON) ? int32(GetWeaponSkillValue(attType, pVictim)) : GetMaxSkillValueForLevel();
int32 attackerWeaponSkill = (spell->GetEquippedItemClass() == ITEM_CLASS_WEAPON) ? int32(GetWeaponSkillValue(attType,pVictim)) : GetMaxSkillValueForLevel();
int32 skillDiff = attackerWeaponSkill - int32(pVictim->GetMaxSkillValueForLevel(this));
int32 fullSkillDiff = attackerWeaponSkill - int32(pVictim->GetDefenseSkillValue(this));
@ -3136,7 +3140,7 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* pVictim, SpellEntry const* spell)
modHitChance -= resist_mech;
// Chance resist debuff
modHitChance -= pVictim->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_DEBUFF_RESISTANCE, int32(spell->Dispel));
modHitChance-=pVictim->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_DEBUFF_RESISTANCE, int32(spell->GetDispel()));
int32 HitChance = modHitChance * 100;
// Increase hit chance from attacker SPELL_AURA_MOD_SPELL_HIT_CHANCE and attacker ratings
@ -3217,7 +3221,7 @@ SpellMissInfo Unit::SpellHitResult(Unit* pVictim, SpellEntry const* spell, bool
}
}
switch (spell->DmgClass)
switch (spell->GetDmgClass())
{
case SPELL_DAMAGE_CLASS_NONE:
return SPELL_MISS_NONE;
@ -4007,7 +4011,7 @@ bool Unit::AddSpellAuraHolder(SpellAuraHolder* holder)
if (foundHolder->GetCasterGuid() == holder->GetCasterGuid())
{
// Aura can stack on self -> Stack it;
if (aurSpellInfo->StackAmount)
if (aurSpellInfo->GetStackAmount())
{
// can be created with >1 stack by some spell mods
foundHolder->ModStackAmount(holder->GetStackAmount());
@ -4027,7 +4031,8 @@ bool Unit::AddSpellAuraHolder(SpellAuraHolder* holder)
if (Aura* aur = holder->GetAuraByEffectIndex(SpellEffectIndex(i)))
{
// m_auraname can be modified to SPELL_AURA_NONE for area auras, use original
AuraType aurNameReal = AuraType(aurSpellInfo->EffectApplyAuraName[i]);
SpellEffectEntry const* spellEffect = aurSpellInfo->GetSpellEffect(SpellEffectIndex(i));
AuraType aurNameReal = AuraType(spellEffect ? spellEffect->EffectApplyAuraName : 0);
if (aurNameReal == SPELL_AURA_PERIODIC_DAMAGE && aur->GetAuraDuration() > 0)
{
@ -4059,7 +4064,8 @@ bool Unit::AddSpellAuraHolder(SpellAuraHolder* holder)
continue;
// m_auraname can be modified to SPELL_AURA_NONE for area auras, use original
AuraType aurNameReal = AuraType(aurSpellInfo->EffectApplyAuraName[i]);
SpellEffectEntry const* spellEffect = aurSpellInfo->GetSpellEffect(SpellEffectIndex(i));
AuraType aurNameReal = AuraType(spellEffect ? spellEffect->EffectApplyAuraName : SPELL_AURA_NONE);
switch (aurNameReal)
{
@ -4233,14 +4239,25 @@ bool Unit::RemoveNoStackAurasDueToAuraHolder(SpellAuraHolder* holder)
bool is_triggered_by_spell = false;
// prevent triggering aura of removing aura that triggered it
for (int j = 0; j < MAX_EFFECT_INDEX; ++j)
if (i_spellProto->EffectTriggerSpell[j] == spellId)
for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
{
SpellEffectEntry const* iSpellEffect = i_spellProto->GetSpellEffect(SpellEffectIndex(j));
if(!iSpellEffect)
continue;
if (iSpellEffect->EffectTriggerSpell == spellId)
is_triggered_by_spell = true;
}
// prevent triggered aura of removing aura that triggering it (triggered effect early some aura of parent spell
for (int j = 0; j < MAX_EFFECT_INDEX; ++j)
if (spellProto->EffectTriggerSpell[j] == i_spellId)
for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
{
SpellEffectEntry const* spellEffect = i_spellProto->GetSpellEffect(SpellEffectIndex(j));
if(!spellEffect)
continue;
if (spellEffect->EffectTriggerSpell == i_spellId)
is_triggered_by_spell = true;
}
if (is_triggered_by_spell)
continue;
@ -4318,7 +4335,7 @@ bool Unit::RemoveNoStackAurasDueToAuraHolder(SpellAuraHolder* holder)
}
// Potions stack aura by aura (elixirs/flask already checked)
if (spellProto->SpellFamilyName == SPELLFAMILY_POTION && i_spellProto->SpellFamilyName == SPELLFAMILY_POTION)
if( spellProto->GetSpellFamilyName() == SPELLFAMILY_POTION && i_spellProto->GetSpellFamilyName() == SPELLFAMILY_POTION )
{
if (IsNoStackAuraDueToAura(spellId, i_spellId))
{
@ -4396,10 +4413,11 @@ void Unit::RemoveSingleAuraFromSpellAuraHolder(uint32 spellId, SpellEffectIndex
void Unit::RemoveAuraHolderDueToSpellByDispel(uint32 spellId, uint32 stackAmount, ObjectGuid casterGuid, Unit* dispeller)
{
SpellEntry const* spellEntry = sSpellStore.LookupEntry(spellId);
SpellClassOptionsEntry const* classOptions = spellEntry->GetSpellClassOptions();
// Custom dispel case
// Unstable Affliction
if (spellEntry->SpellFamilyName == SPELLFAMILY_WARLOCK && (spellEntry->SpellFamilyFlags & UI64LIT(0x010000000000)))
if(classOptions && classOptions->SpellFamilyName == SPELLFAMILY_WARLOCK && (classOptions->SpellFamilyFlags & UI64LIT(0x010000000000)))
{
if (Aura* dotAura = GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_WARLOCK, UI64LIT(0x010000000000), 0x00000000, casterGuid))
{
@ -4416,7 +4434,7 @@ void Unit::RemoveAuraHolderDueToSpellByDispel(uint32 spellId, uint32 stackAmount
}
}
// Lifebloom
else if (spellEntry->SpellFamilyName == SPELLFAMILY_DRUID && (spellEntry->SpellFamilyFlags & UI64LIT(0x0000001000000000)))
else if (classOptions && classOptions->SpellFamilyName == SPELLFAMILY_DRUID && (classOptions->SpellFamilyFlags & UI64LIT(0x0000001000000000)))
{
if (Aura* dotAura = GetAura(SPELL_AURA_DUMMY, SPELLFAMILY_DRUID, UI64LIT(0x0000001000000000), 0x00000000, casterGuid))
{
@ -4425,13 +4443,13 @@ void Unit::RemoveAuraHolderDueToSpellByDispel(uint32 spellId, uint32 stackAmount
if (Unit* caster = dotAura->GetCaster())
{
int32 returnmana = (spellEntry->ManaCostPercentage * caster->GetCreateMana() / 100) * stackAmount / 2;
int32 returnmana = (spellEntry->GetManaCostPercentage() * caster->GetCreateMana() / 100) * stackAmount / 2;
caster->CastCustomSpell(caster, 64372, &returnmana, NULL, NULL, true, NULL, dotAura, casterGuid);
}
}
}
// Flame Shock
else if (spellEntry->SpellFamilyName == SPELLFAMILY_SHAMAN && (spellEntry->SpellFamilyFlags & UI64LIT(0x10000000)))
else if (classOptions && classOptions->SpellFamilyName == SPELLFAMILY_SHAMAN && (classOptions->SpellFamilyFlags & UI64LIT(0x10000000)))
{
Unit* caster = NULL;
uint32 triggeredSpell = 0;
@ -4464,7 +4482,7 @@ void Unit::RemoveAuraHolderDueToSpellByDispel(uint32 spellId, uint32 stackAmount
return;
}
// Vampiric touch (first dummy aura)
else if (spellEntry->SpellFamilyName == SPELLFAMILY_PRIEST && spellEntry->SpellFamilyFlags & UI64LIT(0x0000040000000000))
else if (classOptions && classOptions->SpellFamilyName == SPELLFAMILY_PRIEST && classOptions->SpellFamilyFlags & UI64LIT(0x0000040000000000))
{
if (Aura* dot = GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, UI64LIT(0x0000040000000000), 0x00000000, casterGuid))
{
@ -4550,7 +4568,7 @@ void Unit::RemoveAurasWithDispelType(DispelType type, ObjectGuid casterGuid)
for (SpellAuraHolderMap::iterator itr = auras.begin(); itr != auras.end();)
{
SpellEntry const* spell = itr->second->GetSpellProto();
if (((1 << spell->Dispel) & dispelMask) && (!casterGuid || casterGuid == itr->second->GetCasterGuid()))
if (((1<<spell->GetDispel()) & dispelMask) && (!casterGuid || casterGuid == itr->second->GetCasterGuid()))
{
// Dispel aura
RemoveAurasDueToSpell(spell->Id);
@ -4618,7 +4636,7 @@ void Unit::RemoveAurasWithInterruptFlags(uint32 flags)
{
for (SpellAuraHolderMap::iterator iter = m_spellAuraHolders.begin(); iter != m_spellAuraHolders.end();)
{
if (iter->second->GetSpellProto()->AuraInterruptFlags & flags)
if (iter->second->GetSpellProto()->GetAuraInterruptFlags() & flags)
{
RemoveSpellAuraHolder(iter->second);
iter = m_spellAuraHolders.begin();
@ -5886,7 +5904,7 @@ void Unit::ModifyAuraState(AuraState flag, bool apply)
if (itr->second.state == PLAYERSPELL_REMOVED) continue;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(itr->first);
if (!spellInfo || !IsPassiveSpell(spellInfo)) continue;
if (AuraState(spellInfo->CasterAuraState) == flag)
if (AuraState(spellInfo->GetCasterAuraState()) == flag)
CastSpell(this, itr->first, true, NULL);
}
}
@ -5904,7 +5922,7 @@ void Unit::ModifyAuraState(AuraState flag, bool apply)
for (Unit::SpellAuraHolderMap::iterator itr = tAuras.begin(); itr != tAuras.end();)
{
SpellEntry const* spellProto = (*itr).second->GetSpellProto();
if (AuraState(spellProto->CasterAuraState) == flag)
if (AuraState(spellProto->GetCasterAuraState()) == flag)
{
RemoveSpellAuraHolder(itr->second);
itr = tAuras.begin();
@ -6167,7 +6185,7 @@ Unit* Unit::SelectMagnetTarget(Unit* victim, Spell* spell, SpellEffectIndex eff)
return NULL;
// Magic case
if (spell && spell->m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC)
if (spell && (spell->m_spellInfo->GetDmgClass() == SPELL_DAMAGE_CLASS_NONE || spell->m_spellInfo->GetDmgClass() == SPELL_DAMAGE_CLASS_MAGIC))
{
Unit::AuraList const& magnetAuras = victim->GetAurasByType(SPELL_AURA_SPELL_MAGNET);
for (Unit::AuraList::const_iterator itr = magnetAuras.begin(); itr != magnetAuras.end(); ++itr)
@ -6251,7 +6269,7 @@ int32 Unit::SpellBonusWithCoeffs(SpellEntry const* spellProto, int32 total, int3
float ap_bonus = damagetype == DOT ? bonus->ap_dot_bonus : bonus->ap_bonus;
// Impurity
if (GetTypeId() == TYPEID_PLAYER && spellProto->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT)
if (GetTypeId() == TYPEID_PLAYER && spellProto->GetSpellFamilyName() == SPELLFAMILY_DEATHKNIGHT)
{
if (SpellEntry const* spell = ((Player*)this)->GetKnownTalentRankById(2005))
ap_bonus += ((spell->CalculateSimpleValue(EFFECT_INDEX_0) * ap_bonus) / 100.0f);
@ -6308,11 +6326,12 @@ uint32 Unit::SpellDamageBonusDone(Unit* pVictim, SpellEntry const* spellProto, u
AuraList const& mModDamagePercentDone = GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
for (AuraList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
{
if (((*i)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spellProto)) &&
(*i)->GetSpellProto()->EquippedItemClass == -1 &&
// -1 == any item class (not wand then)
(*i)->GetSpellProto()->EquippedItemInventoryTypeMask == 0)
// 0 == any inventory type (not wand then)
SpellEquippedItemsEntry const* spellEquip = (*i)->GetSpellProto()->GetSpellEquippedItems();
if( ((*i)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spellProto)) &&
spellEquip && spellEquip->EquippedItemClass == -1 &&
// -1 == any item class (not wand then)
spellEquip->EquippedItemInventoryTypeMask == 0 )
// 0 == any inventory type (not wand then)
{
DoneTotalMod *= ((*i)->GetModifier()->m_amount + 100.0f) / 100.0f;
}
@ -6367,7 +6386,8 @@ uint32 Unit::SpellDamageBonusDone(Unit* pVictim, SpellEntry const* spellProto, u
for (SpellAuraHolderMap::const_iterator itr = victimAuras.begin(); itr != victimAuras.end(); ++itr)
{
SpellEntry const* m_spell = itr->second->GetSpellProto();
if (m_spell->SpellFamilyName != SPELLFAMILY_WARLOCK || !(m_spell->SpellFamilyFlags & UI64LIT(0x0004071B8044C402)))
SpellClassOptionsEntry const* itrClassOptions = m_spell->GetSpellClassOptions();
if (itrClassOptions && (itrClassOptions->SpellFamilyName != SPELLFAMILY_WARLOCK || !(itrClassOptions->SpellFamilyFlags & UI64LIT(0x0004071B8044C402))))
continue;
modPercent += stepPercent * itr->second->GetStackAmount();
if (modPercent >= maxPercent)
@ -6449,8 +6469,10 @@ uint32 Unit::SpellDamageBonusDone(Unit* pVictim, SpellEntry const* spellProto, u
}
}
// Custom scripted damage
switch (spellProto->SpellFamilyName)
SpellClassOptionsEntry const* classOptions = spellProto->GetSpellClassOptions();
// Custom scripted damage
switch(spellProto->GetSpellFamilyName())
{
case SPELLFAMILY_MAGE:
{
@ -6471,8 +6493,8 @@ uint32 Unit::SpellDamageBonusDone(Unit* pVictim, SpellEntry const* spellProto, u
}
}
// Torment the weak affected (Arcane Barrage, Arcane Blast, Frostfire Bolt, Arcane Missiles, Fireball)
if ((spellProto->SpellFamilyFlags & UI64LIT(0x0000900020200021)) &&
(pVictim->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED) || pVictim->HasAuraType(SPELL_AURA_HASTE_ALL)))
if (classOptions && (classOptions->SpellFamilyFlags & UI64LIT(0x0000900020200021)) &&
(pVictim->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED) || pVictim->HasAuraType(SPELL_AURA_HASTE_ALL)))
{
// Search for Torment the weak dummy aura
Unit::AuraList const& ttw = GetAurasByType(SPELL_AURA_DUMMY);
@ -6490,7 +6512,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* pVictim, SpellEntry const* spellProto, u
case SPELLFAMILY_WARLOCK:
{
// Drain Soul
if (spellProto->SpellFamilyFlags & UI64LIT(0x0000000000004000))
if (classOptions && classOptions->SpellFamilyFlags & UI64LIT(0x0000000000004000))
{
if (pVictim->GetHealth() * 100 / pVictim->GetMaxHealth() <= 25)
DoneTotalMod *= 4;
@ -6525,7 +6547,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* pVictim, SpellEntry const* spellProto, u
case SPELLFAMILY_DRUID:
{
// Improved Insect Swarm (Wrath part)
if (spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000001))
if (classOptions && classOptions->SpellFamilyFlags & UI64LIT(0x0000000000000001))
{
// if Insect Swarm on target
if (pVictim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, UI64LIT(0x000000000200000), 0, GetObjectGuid()))
@ -6546,14 +6568,14 @@ uint32 Unit::SpellDamageBonusDone(Unit* pVictim, SpellEntry const* spellProto, u
case SPELLFAMILY_DEATHKNIGHT:
{
// Icy Touch and Howling Blast
if (spellProto->SpellFamilyFlags & UI64LIT(0x0000000200000002))
if (classOptions && classOptions->SpellFamilyFlags & UI64LIT(0x0000000200000002))
{
// search disease
bool found = false;
Unit::SpellAuraHolderMap const& auras = pVictim->GetSpellAuraHolderMap();
for (Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
if (itr->second->GetSpellProto()->Dispel == DISPEL_DISEASE)
if(itr->second->GetSpellProto()->GetDispel() == DISPEL_DISEASE)
{
found = true;
break;
@ -6566,7 +6588,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* pVictim, SpellEntry const* spellProto, u
Unit::AuraList const& dummyAuras = GetAurasByType(SPELL_AURA_DUMMY);
for (Unit::AuraList::const_iterator i = dummyAuras.begin(); i != dummyAuras.end(); ++i)
{
if ((*i)->GetSpellProto()->EffectMiscValue[(*i)->GetEffIndex()] == 7244)
if ((*i)->GetSpellProto()->GetEffectMiscValue((*i)->GetEffIndex()) == 7244)
{
DoneTotalMod *= ((*i)->GetModifier()->m_amount + 100.0f) / 100.0f;
break;
@ -6574,7 +6596,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* pVictim, SpellEntry const* spellProto, u
}
}
// Death Coil (bonus from Item - Death Knight T8 DPS Relic)
else if (spellProto->SpellFamilyFlags & UI64LIT(0x00002000))
else if (classOptions && classOptions->SpellFamilyFlags & UI64LIT(0x00002000))
{
if (Aura* sigil = GetDummyAura(64962))
DoneTotal += sigil->GetModifier()->m_amount;
@ -6693,10 +6715,11 @@ int32 Unit::SpellBaseDamageBonusDone(SpellSchoolMask schoolMask)
AuraList const& mDamageDone = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE);
for (AuraList::const_iterator i = mDamageDone.begin(); i != mDamageDone.end(); ++i)
{
SpellEquippedItemsEntry const* spellEquip = (*i)->GetSpellProto()->GetSpellEquippedItems();
if (((*i)->GetModifier()->m_miscvalue & schoolMask) != 0 &&
(*i)->GetSpellProto()->EquippedItemClass == -1 && // -1 == any item class (not wand then)
(*i)->GetSpellProto()->EquippedItemInventoryTypeMask == 0) // 0 == any inventory type (not wand then)
DoneAdvertisedBenefit += (*i)->GetModifier()->m_amount;
spellEquip && spellEquip->EquippedItemClass == -1 && // -1 == any item class (not wand then)
spellEquip->EquippedItemInventoryTypeMask == 0) // 0 == any inventory type (not wand then)
DoneAdvertisedBenefit += (*i)->GetModifier()->m_amount;
}
if (GetTypeId() == TYPEID_PLAYER)
@ -6749,7 +6772,7 @@ bool Unit::IsSpellCrit(Unit* pVictim, SpellEntry const* spellProto, SpellSchoolM
return false;
float crit_chance = 0.0f;
switch (spellProto->DmgClass)
switch(spellProto->GetDmgClass())
{
case SPELL_DAMAGE_CLASS_NONE:
return false;
@ -6813,8 +6836,9 @@ bool Unit::IsSpellCrit(Unit* pVictim, SpellEntry const* spellProto, SpellSchoolM
}
}
SpellClassOptionsEntry const* classOptions = spellProto->GetSpellClassOptions();
// Custom crit by class
switch (spellProto->SpellFamilyName)
switch(spellProto->GetSpellFamilyName())
{
case SPELLFAMILY_MAGE:
{
@ -6838,8 +6862,8 @@ bool Unit::IsSpellCrit(Unit* pVictim, SpellEntry const* spellProto, SpellSchoolM
for (AuraList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i)
{
// Improved Flash Heal
if ((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_PRIEST &&
(*i)->GetSpellProto()->SpellIconID == 2542)
if ((*i)->GetSpellProto()->GetSpellFamilyName() == SPELLFAMILY_PRIEST &&
(*i)->GetSpellProto()->SpellIconID == 2542)
{
crit_chance += (*i)->GetModifier()->m_amount;
break;
@ -6868,14 +6892,14 @@ bool Unit::IsSpellCrit(Unit* pVictim, SpellEntry const* spellProto, SpellSchoolM
break;
case SPELLFAMILY_PALADIN:
// Sacred Shield
if (spellProto->SpellFamilyFlags & UI64LIT(0x0000000040000000))
if (classOptions && classOptions->SpellFamilyFlags & UI64LIT(0x0000000040000000))
{
Aura* aura = pVictim->GetDummyAura(58597);
if (aura && aura->GetCasterGuid() == GetObjectGuid())
crit_chance += aura->GetModifier()->m_amount;
}
// Exorcism
else if (spellProto->Category == 19)
else if (spellProto->GetCategory() == 19)
{
if (pVictim->GetCreatureTypeMask() & CREATURE_TYPEMASK_DEMON_OR_UNDEAD)
return true;
@ -6921,7 +6945,7 @@ uint32 Unit::SpellCriticalDamageBonus(SpellEntry const* spellProto, uint32 damag
{
// Calculate critical bonus
int32 crit_bonus;
switch (spellProto->DmgClass)
switch(spellProto->GetDmgClass())
{
case SPELL_DAMAGE_CLASS_MELEE: // for melee based spells is 100%
case SPELL_DAMAGE_CLASS_RANGED:
@ -6940,7 +6964,7 @@ uint32 Unit::SpellCriticalDamageBonus(SpellEntry const* spellProto, uint32 damag
return damage += crit_bonus;
int32 critPctDamageMod = 0;
if (spellProto->DmgClass >= SPELL_DAMAGE_CLASS_MELEE)
if(spellProto->GetDmgClass() >= SPELL_DAMAGE_CLASS_MELEE)
{
if (GetWeaponAttackType(spellProto) == RANGED_ATTACK)
critPctDamageMod += pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE);
@ -6968,7 +6992,7 @@ uint32 Unit::SpellCriticalHealingBonus(SpellEntry const* spellProto, uint32 dama
{
// Calculate critical bonus
int32 crit_bonus;
switch (spellProto->DmgClass)
switch(spellProto->GetDmgClass())
{
case SPELL_DAMAGE_CLASS_MELEE: // for melee based spells is 100%
case SPELL_DAMAGE_CLASS_RANGED:
@ -7006,7 +7030,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* pVictim, SpellEntry const* spellProto,
return owner->SpellHealingBonusDone(pVictim, spellProto, healamount, damagetype, stack);
// No heal amount for this class spells
if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE)
if (spellProto->GetDmgClass() == SPELL_DAMAGE_CLASS_NONE)
return healamount < 0 ? 0 : healamount;
// Healing Done
@ -7058,9 +7082,9 @@ uint32 Unit::SpellHealingBonusDone(Unit* pVictim, SpellEntry const* spellProto,
int ownHotCount = 0; // counted HoT types amount, not stacks
Unit::AuraList const& RejorRegr = pVictim->GetAurasByType(SPELL_AURA_PERIODIC_HEAL);
for (Unit::AuraList::const_iterator i = RejorRegr.begin(); i != RejorRegr.end(); ++i)
if ((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID &&
(*i)->GetCasterGuid() == GetObjectGuid())
for(Unit::AuraList::const_iterator i = RejorRegr.begin(); i != RejorRegr.end(); ++i)
if ((*i)->GetSpellProto()->GetSpellFamilyName() == SPELLFAMILY_DRUID &&
(*i)->GetCasterGuid() == GetObjectGuid())
++ownHotCount;
if (ownHotCount)
@ -7078,25 +7102,23 @@ uint32 Unit::SpellHealingBonusDone(Unit* pVictim, SpellEntry const* spellProto,
}
}
if (spellProto->SpellFamilyName == SPELLFAMILY_DRUID)
// Nourish 20% of heal increase if target is affected by Druids HOTs
SpellClassOptionsEntry const* classOptions = spellProto->GetSpellClassOptions();
if (classOptions && classOptions->SpellFamilyName == SPELLFAMILY_DRUID && (classOptions->SpellFamilyFlags & UI64LIT(0x0200000000000000)))
{
// Nourish 20% of heal increase if target is affected by Druids HOTs
if (spellProto->SpellFamilyFlags & UI64LIT(0x0200000000000000))
int ownHotCount = 0; // counted HoT types amount, not stacks
Unit::AuraList const& RejorRegr = pVictim->GetAurasByType(SPELL_AURA_PERIODIC_HEAL);
for(Unit::AuraList::const_iterator i = RejorRegr.begin(); i != RejorRegr.end(); ++i)
if ((*i)->GetSpellProto()->GetSpellFamilyName() == SPELLFAMILY_DRUID &&
(*i)->GetCasterGuid() == GetObjectGuid())
++ownHotCount;
if (ownHotCount)
{
int ownHotCount = 0; // counted HoT types amount, not stacks
Unit::AuraList const& RejorRegr = pVictim->GetAurasByType(SPELL_AURA_PERIODIC_HEAL);
for (Unit::AuraList::const_iterator i = RejorRegr.begin(); i != RejorRegr.end(); ++i)
if ((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID &&
(*i)->GetCasterGuid() == GetObjectGuid())
++ownHotCount;
DoneTotalMod *= 1.2f; // base bonus at HoTs
if (ownHotCount)
{
DoneTotalMod *= 1.2f; // base bonus at HoTs
if (Aura* glyph = GetAura(62971, EFFECT_INDEX_0))// Glyph of Nourish
DoneTotalMod *= (glyph->GetModifier()->m_amount * ownHotCount + 100.0f) / 100.0f;
}
if (Aura* glyph = GetAura(62971, EFFECT_INDEX_0))// Glyph of Nourish
DoneTotalMod *= (glyph->GetModifier()->m_amount * ownHotCount + 100.0f) / 100.0f;
}
// Lifebloom
else if (spellProto->IsFitToFamilyMask(UI64LIT(0x0000001000000000)))
@ -7155,7 +7177,7 @@ uint32 Unit::SpellHealingBonusTaken(Unit* pCaster, SpellEntry const* spellProto,
TakenTotalMod *= (100.0f + maxval) / 100.0f;
// No heal amount for this class spells
if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE)
if (spellProto->GetDmgClass() == SPELL_DAMAGE_CLASS_NONE)
{
healamount = int32(healamount * TakenTotalMod);
return healamount < 0 ? 0 : healamount;
@ -7202,7 +7224,7 @@ int32 Unit::SpellBaseHealingBonusDone(SpellSchoolMask schoolMask)
for (AuraList::const_iterator i = mHealingDoneOfStatPercent.begin(); i != mHealingDoneOfStatPercent.end(); ++i)
{
// stat used dependent from misc value (stat index)
Stats usedStat = Stats((*i)->GetSpellProto()->EffectMiscValue[(*i)->GetEffIndex()]);
Stats usedStat = Stats((*i)->GetSpellProto()->GetEffectMiscValue((*i)->GetEffIndex()));
AdvertisedBenefit += int32(GetStat(usedStat) * (*i)->GetModifier()->m_amount / 100.0f);
}
@ -7252,8 +7274,8 @@ bool Unit::IsImmuneToSpell(SpellEntry const* spellInfo)
// SpellImmuneList const& dispelList = m_spellImmune[IMMUNITY_EFFECT];
SpellImmuneList const& dispelList = m_spellImmune[IMMUNITY_DISPEL];
for (SpellImmuneList::const_iterator itr = dispelList.begin(); itr != dispelList.end(); ++itr)
if (itr->type == spellInfo->Dispel)
for(SpellImmuneList::const_iterator itr = dispelList.begin(); itr != dispelList.end(); ++itr)
if (itr->type == spellInfo->GetDispel())
return true;
if (!spellInfo->HasAttribute(SPELL_ATTR_EX_UNAFFECTED_BY_SCHOOL_IMMUNE) && // unaffected by school immunity
@ -7266,7 +7288,7 @@ bool Unit::IsImmuneToSpell(SpellEntry const* spellInfo)
return true;
}
if (uint32 mechanic = spellInfo->Mechanic)
if(uint32 mechanic = spellInfo->GetMechanic())
{
SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC];
for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
@ -7284,14 +7306,18 @@ bool Unit::IsImmuneToSpell(SpellEntry const* spellInfo)
bool Unit::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index) const
{
// If m_immuneToEffect type contain this effect type, IMMUNE effect.
uint32 effect = spellInfo->Effect[index];
//If m_immuneToEffect type contain this effect type, IMMUNE effect.
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(index);
if(!spellEffect)
return false;
uint32 effect = spellEffect->Effect;
SpellImmuneList const& effectList = m_spellImmune[IMMUNITY_EFFECT];
for (SpellImmuneList::const_iterator itr = effectList.begin(); itr != effectList.end(); ++itr)
if (itr->type == effect)
return true;
if (uint32 mechanic = spellInfo->EffectMechanic[index])
if(uint32 mechanic = spellEffect->EffectMechanic)
{
SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC];
for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
@ -7304,7 +7330,7 @@ bool Unit::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex i
return true;
}
if (uint32 aura = spellInfo->EffectApplyAuraName[index])
if(uint32 aura = spellEffect->EffectApplyAuraName)
{
SpellImmuneList const& list = m_spellImmune[IMMUNITY_STATE];
for (SpellImmuneList::const_iterator itr = list.begin(); itr != list.end(); ++itr)
@ -7314,8 +7340,8 @@ bool Unit::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex i
// Check for immune to application of harmful magical effects
AuraList const& immuneAuraApply = GetAurasByType(SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL);
if (!immuneAuraApply.empty() &&
spellInfo->Dispel == DISPEL_MAGIC && // Magic debuff)
!IsPositiveEffect(spellInfo, index)) // Harmful
spellInfo->GetDispel() == DISPEL_MAGIC && // Magic debuff)
!IsPositiveEffect(spellInfo, index)) // Harmful
{
// Check school
SpellSchoolMask schoolMask = GetSpellSchoolMask(spellInfo);
@ -7354,10 +7380,10 @@ uint32 Unit::MeleeDamageBonusDone(Unit* pVictim, uint32 pdamage, WeaponAttackTyp
AuraList const& mModDamageDone = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE);
for (AuraList::const_iterator i = mModDamageDone.begin(); i != mModDamageDone.end(); ++i)
{
if ((*i)->GetModifier()->m_miscvalue & schoolMask && // schoolmask has to fit with the intrinsic spell school
(*i)->GetModifier()->m_miscvalue & GetMeleeDamageSchoolMask() && // AND schoolmask has to fit with weapon damage school (essential for non-physical spells)
(((*i)->GetSpellProto()->EquippedItemClass == -1) || // general, weapon independent
(pWeapon && pWeapon->IsFitToSpellRequirements((*i)->GetSpellProto())))) // OR used weapon fits aura requirements
if (((*i)->GetModifier()->m_miscvalue & schoolMask && // schoolmask has to fit with the intrinsic spell school
(*i)->GetModifier()->m_miscvalue & GetMeleeDamageSchoolMask() && // AND schoolmask has to fit with weapon damage school (essential for non-physical spells)
((*i)->GetSpellProto()->GetEquippedItemClass() == -1) || // general, weapon independent
(pWeapon && pWeapon->IsFitToSpellRequirements((*i)->GetSpellProto())))) // OR used weapon fits aura requirements
{
DoneFlat += (*i)->GetModifier()->m_amount;
}
@ -7393,10 +7419,10 @@ uint32 Unit::MeleeDamageBonusDone(Unit* pVictim, uint32 pdamage, WeaponAttackTyp
AuraList const& mModDamagePercentDone = GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
for (AuraList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
{
if ((*i)->GetModifier()->m_miscvalue & schoolMask && // schoolmask has to fit with the intrinsic spell school
(*i)->GetModifier()->m_miscvalue & GetMeleeDamageSchoolMask() && // AND schoolmask has to fit with weapon damage school (essential for non-physical spells)
(((*i)->GetSpellProto()->EquippedItemClass == -1) || // general, weapon independent
(pWeapon && pWeapon->IsFitToSpellRequirements((*i)->GetSpellProto())))) // OR used weapon fits aura requirements
if (((*i)->GetModifier()->m_miscvalue & schoolMask && // schoolmask has to fit with the intrinsic spell school
(*i)->GetModifier()->m_miscvalue & GetMeleeDamageSchoolMask() && // AND schoolmask has to fit with weapon damage school (essential for non-physical spells)
((*i)->GetSpellProto()->GetEquippedItemClass()) == -1 || // general, weapon independent
(pWeapon && pWeapon->IsFitToSpellRequirements((*i)->GetSpellProto())))) // OR used weapon fits aura requirements
{
DonePercent *= ((*i)->GetModifier()->m_amount + 100.0f) / 100.0f;
}
@ -7493,15 +7519,17 @@ uint32 Unit::MeleeDamageBonusDone(Unit* pVictim, uint32 pdamage, WeaponAttackTyp
if (spellProto)
{
SpellClassOptionsEntry const* classOptions = spellProto->GetSpellClassOptions();
// Frost Strike
if (spellProto->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && spellProto->SpellFamilyFlags & UI64LIT(0x0000000400000000))
if (classOptions && classOptions->IsFitToFamily(SPELLFAMILY_DEATHKNIGHT, UI64LIT(0x0000000400000000)))
{
// search disease
bool found = false;
Unit::SpellAuraHolderMap const& auras = pVictim->GetSpellAuraHolderMap();
for (Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
if (itr->second->GetSpellProto()->Dispel == DISPEL_DISEASE)
if(itr->second->GetSpellProto()->GetDispel() == DISPEL_DISEASE)
{
found = true;
break;
@ -7514,7 +7542,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit* pVictim, uint32 pdamage, WeaponAttackTyp
Unit::AuraList const& dummyAuras = GetAurasByType(SPELL_AURA_DUMMY);
for (Unit::AuraList::const_iterator i = dummyAuras.begin(); i != dummyAuras.end(); ++i)
{
if ((*i)->GetSpellProto()->EffectMiscValue[(*i)->GetEffIndex()] == 7244)
if ((*i)->GetSpellProto()->GetEffectMiscValue((*i)->GetEffIndex()) == 7244)
{
DonePercent *= ((*i)->GetModifier()->m_amount + 100.0f) / 100.0f;
break;
@ -7523,7 +7551,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit* pVictim, uint32 pdamage, WeaponAttackTyp
}
}
// Glyph of Steady Shot (Steady Shot check)
else if (spellProto->SpellFamilyName == SPELLFAMILY_HUNTER && spellProto->SpellFamilyFlags & UI64LIT(0x0000000100000000))
else if (classOptions && classOptions->IsFitToFamily(SPELLFAMILY_HUNTER, UI64LIT(0x0000000100000000)))
{
// search for glyph dummy aura
if (Aura* aur = GetDummyAura(56826))
@ -7598,8 +7626,9 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* pCaster, uint32 pdamage, WeaponAttackTy
uint32 mechanicMask = spellProto ? GetAllSpellMechanicMask(spellProto) : 0;
// Shred also have bonus as MECHANIC_BLEED damages
if (spellProto && spellProto->SpellFamilyName == SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags & UI64LIT(0x00008000))
mechanicMask |= (1 << (MECHANIC_BLEED - 1));
SpellClassOptionsEntry const* classOptions = spellProto ? spellProto->GetSpellClassOptions() : NULL;
if (classOptions && classOptions->SpellFamilyName==SPELLFAMILY_DRUID && classOptions->SpellFamilyFlags & UI64LIT(0x00008000))
mechanicMask |= (1 << (MECHANIC_BLEED-1));
// FLAT damage bonus auras
// =======================
@ -8790,17 +8819,24 @@ int32 Unit::CalculateSpellDamage(Unit const* target, SpellEntry const* spellProt
uint8 comboPoints = unitPlayer ? unitPlayer->GetComboPoints() : 0;
int32 level = int32(getLevel());
if (level > (int32)spellProto->maxLevel && spellProto->maxLevel > 0)
level = (int32)spellProto->maxLevel;
else if (level < (int32)spellProto->baseLevel)
level = (int32)spellProto->baseLevel;
level -= (int32)spellProto->spellLevel;
uint32 maxLevel = spellProto->GetMaxLevel();
uint32 baseLevel = spellProto->GetBaseLevel();
uint32 spellLevel = spellProto->GetSpellLevel();
if (level > (int32)maxLevel && maxLevel > 0)
level = (int32)maxLevel;
else if (level < (int32)baseLevel)
level = (int32)baseLevel;
level-= (int32)spellLevel;
float basePointsPerLevel = spellProto->EffectRealPointsPerLevel[effect_index];
int32 basePoints = effBasePoints ? *effBasePoints - 1 : spellProto->EffectBasePoints[effect_index];
SpellEffectEntry const* spellEffect = spellProto->GetSpellEffect(effect_index);
if(!spellEffect)
return 0;
float basePointsPerLevel = spellEffect->EffectRealPointsPerLevel;
int32 basePoints = effBasePoints ? *effBasePoints - 1 : spellEffect->EffectBasePoints;
basePoints += int32(level * basePointsPerLevel);
int32 randomPoints = int32(spellProto->EffectDieSides[effect_index]);
float comboDamage = spellProto->EffectPointsPerComboPoint[effect_index];
int32 randomPoints = int32(spellEffect->EffectDieSides);
float comboDamage = spellEffect->EffectPointsPerComboPoint;
switch (randomPoints)
{
@ -8842,11 +8878,11 @@ int32 Unit::CalculateSpellDamage(Unit const* target, SpellEntry const* spellProt
}
}
if (spellProto->HasAttribute(SPELL_ATTR_LEVEL_DAMAGE_CALCULATION) && spellProto->spellLevel &&
spellProto->Effect[effect_index] != SPELL_EFFECT_WEAPON_PERCENT_DAMAGE &&
spellProto->Effect[effect_index] != SPELL_EFFECT_KNOCK_BACK &&
(spellProto->Effect[effect_index] != SPELL_EFFECT_APPLY_AURA || spellProto->EffectApplyAuraName[effect_index] != SPELL_AURA_MOD_DECREASE_SPEED))
value = int32(value * 0.25f * exp(getLevel() * (70 - spellProto->spellLevel) / 1000.0f));
if(spellProto->Attributes & SPELL_ATTR_LEVEL_DAMAGE_CALCULATION && spellLevel &&
spellEffect->Effect != SPELL_EFFECT_WEAPON_PERCENT_DAMAGE &&
spellEffect->Effect != SPELL_EFFECT_KNOCK_BACK &&
(spellEffect->Effect != SPELL_EFFECT_APPLY_AURA || spellEffect->EffectApplyAuraName != SPELL_AURA_MOD_DECREASE_SPEED))
value = int32(value*0.25f*exp(getLevel()*(70-spellLevel)/1000.0f));
return value;
}
@ -8875,8 +8911,8 @@ int32 Unit::CalculateAuraDuration(SpellEntry const* spellProto, uint32 effectMas
if (!IsPositiveSpell(spellProto))
{
dispelMod = GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL, spellProto->Dispel);
dmgClassMod = GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_DURATION_OF_MAGIC_EFFECTS, spellProto->DmgClass);
dispelMod = GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL, spellProto->GetDispel());
dmgClassMod = GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_DURATION_OF_MAGIC_EFFECTS, spellProto->GetDmgClass());
}
int32 durationMod = std::min(mechanicMod, std::min(dispelMod, dmgClassMod));
@ -8891,11 +8927,11 @@ int32 Unit::CalculateAuraDuration(SpellEntry const* spellProto, uint32 effectMas
if (caster == this)
{
switch (spellProto->SpellFamilyName)
switch(spellProto->GetSpellFamilyName())
{
case SPELLFAMILY_DRUID:
// Thorns
if (spellProto->SpellIconID == 53 && (spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000100)))
if (spellProto->SpellIconID == 53 && spellProto->IsFitToFamilyMask(UI64LIT(0x0000000000000100)))
{
// Glyph of Thorns
if (Aura* aur = GetAura(57862, EFFECT_INDEX_0))
@ -8904,14 +8940,14 @@ int32 Unit::CalculateAuraDuration(SpellEntry const* spellProto, uint32 effectMas
break;
case SPELLFAMILY_PALADIN:
// Blessing of Might
if (spellProto->SpellIconID == 298 && spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000002))
if (spellProto->SpellIconID == 298 && spellProto->IsFitToFamilyMask(UI64LIT(0x0000000000000002)))
{
// Glyph of Blessing of Might
if (Aura* aur = GetAura(57958, EFFECT_INDEX_0))
duration += aur->GetModifier()->m_amount * MINUTE * IN_MILLISECONDS;
}
// Blessing of Wisdom
else if (spellProto->SpellIconID == 306 && spellProto->SpellFamilyFlags & UI64LIT(0x0000000000010000))
else if (spellProto->SpellIconID == 306 && spellProto->IsFitToFamilyMask(UI64LIT(0x0000000000010000)))
{
// Glyph of Blessing of Wisdom
if (Aura* aur = GetAura(57979, EFFECT_INDEX_0))
@ -9240,14 +9276,14 @@ float Unit::GetTotalAttackPowerValue(WeaponAttackType attType) const
{
if (attType == RANGED_ATTACK)
{
int32 ap = GetInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER) + GetInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER_MODS);
int32 ap = GetInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER) + GetInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER_MOD_POS);
if (ap < 0)
return 0.0f;
return ap * (1.0f + GetFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER));
}
else
{
int32 ap = GetInt32Value(UNIT_FIELD_ATTACK_POWER) + GetInt32Value(UNIT_FIELD_ATTACK_POWER_MODS);
int32 ap = GetInt32Value(UNIT_FIELD_ATTACK_POWER) + GetInt32Value(UNIT_FIELD_ATTACK_POWER_MOD_POS);
if (ap < 0)
return 0.0f;
return ap * (1.0f + GetFloatValue(UNIT_FIELD_ATTACK_POWER_MULTIPLIER));
@ -9456,11 +9492,17 @@ uint32 Unit::GetCreatePowers(Powers power) const
case POWER_HEALTH: return 0; // is it really should be here?
case POWER_MANA: return GetCreateMana();
case POWER_RAGE: return 1000;
case POWER_FOCUS: return (GetTypeId() == TYPEID_PLAYER || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 100);
case POWER_FOCUS:
if(GetTypeId() == TYPEID_PLAYER && ((Player const*)this)->getClass() == CLASS_HUNTER)
return 100;
return (GetTypeId() == TYPEID_PLAYER || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 100);
case POWER_ENERGY: return 100;
case POWER_HAPPINESS: return (GetTypeId() == TYPEID_PLAYER || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 1050000);
case POWER_RUNE: return (GetTypeId() == TYPEID_PLAYER && ((Player const*)this)->getClass() == CLASS_DEATH_KNIGHT ? 8 : 0);
case POWER_RUNIC_POWER: return (GetTypeId() == TYPEID_PLAYER && ((Player const*)this)->getClass() == CLASS_DEATH_KNIGHT ? 1000 : 0);
case POWER_SOUL_SHARDS: return 0; // TODO: fix me
case POWER_ECLIPSE: return 0; // TODO: fix me
case POWER_HOLY_POWER: return 0;
}
return 0;
@ -9597,7 +9639,10 @@ void CharmInfo::InitCharmCreateSpells()
if (!spellInfo) onlyselfcast = false;
for (uint32 i = 0; i < 3 && onlyselfcast; ++i) // nonexistent spell will not make any problems as onlyselfcast would be false -> break right away
{
if (spellInfo->EffectImplicitTargetA[i] != TARGET_SELF && spellInfo->EffectImplicitTargetA[i] != 0)
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(SpellEffectIndex(i));
if(!spellEffect)
continue;
if(spellEffect->EffectImplicitTargetA != TARGET_SELF && spellEffect->EffectImplicitTargetA != 0)
onlyselfcast = false;
}
@ -9890,6 +9935,10 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag,
if (!triggeredByAura)
continue;
SpellEffectEntry const* spellEffect = triggeredByHolder->GetSpellProto()->GetSpellEffect(SpellEffectIndex(i));
if (!spellEffect)
continue;
if (procSpell)
{
if (spellProcEvent)
@ -9918,7 +9967,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag,
continue;
}
SpellAuraProcResult procResult = (*this.*AuraProcHandler[triggeredByHolder->GetSpellProto()->EffectApplyAuraName[i]])(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown);
SpellAuraProcResult procResult = (*this.*AuraProcHandler[spellEffect->EffectApplyAuraName])(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown);
switch (procResult)
{
case SPELL_AURA_PROC_CANT_TRIGGER:
@ -10398,7 +10447,7 @@ bool Unit::hasNegativeAuraWithInterruptFlag(uint32 flag)
{
for (SpellAuraHolderMap::const_iterator iter = m_spellAuraHolders.begin(); iter != m_spellAuraHolders.end(); ++iter)
{
if (!iter->second->IsPositive() && iter->second->GetSpellProto()->AuraInterruptFlags & flag)
if (!iter->second->IsPositive() && iter->second->GetSpellProto()->GetAuraInterruptFlags() & flag)
return true;
}
return false;