diff --git a/src/game/DBCStores.cpp b/src/game/DBCStores.cpp index 8211200a4..80d84e5cd 100644 --- a/src/game/DBCStores.cpp +++ b/src/game/DBCStores.cpp @@ -624,11 +624,11 @@ void LoadDBCStores(const std::string& dataPath) // Check loaded DBC files proper version if( !sAreaStore.LookupEntry(3617) || // last area (areaflag) added in 3.3.3a !sCharTitlesStore.LookupEntry(177) || // last char title added in 3.3.3a - !sGemPropertiesStore.LookupEntry(1629) || // last added spell in 3.3.3a - !sItemStore.LookupEntry(54860) || // last gem property added in 3.3.3a + !sGemPropertiesStore.LookupEntry(1629) || // last gem property added in 3.3.3a + !sItemStore.LookupEntry(54860) || // last client known item added in 3.3.3a !sItemExtendedCostStore.LookupEntry(2997) || // last item extended cost added in 3.3.3a !sMapStore.LookupEntry(724) || // last map added in 3.3.3a - !sSpellStore.LookupEntry(76567) ) // last client known item added in 3.3.3a + !sSpellStore.LookupEntry(76567) ) // last added spell in 3.3.3a { sLog.outError("\nYou have mixed version DBC files. Please re-extract DBC files for one from client build: %s",AcceptableClientBuildsListStr().c_str()); exit(1); diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 646fc8c18..b0acd3705 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -3023,7 +3023,8 @@ void Spell::finish(bool ok) SpellEntry const *auraSpellInfo = (*i)->GetSpellProto(); SpellEffectIndex 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); + int32 auraBasePoints = (*i)->GetBasePoints(); + int32 chance = m_caster->CalculateSpellDamage(unit, auraSpellInfo, auraSpellIdx, &auraBasePoints); if(roll_chance_i(chance)) m_caster->CastSpell(unit, auraSpellInfo->EffectTriggerSpell[auraSpellIdx], true, NULL, (*i)); } diff --git a/src/game/Spell.h b/src/game/Spell.h index 85174e460..2e0df308a 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -386,7 +386,7 @@ class Spell SpellCastResult CheckOrTakeRunePower(bool take); SpellCastResult CheckCasterAuras() const; - int32 CalculateDamage(SpellEffectIndex i, Unit* target) { return m_caster->CalculateSpellDamage(m_spellInfo,i,m_currentBasePoints[i],target); } + int32 CalculateDamage(SpellEffectIndex i, Unit* target) { return m_caster->CalculateSpellDamage(target, m_spellInfo, i, &m_currentBasePoints[i]); } int32 CalculatePowerCost(); bool HaveTargetsForEffect(SpellEffectIndex effect) const; diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index de4e5e8a0..35362de59 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -404,7 +404,7 @@ m_isRemovedOnShapeLost(true), m_in_use(0), m_deleted(false) { m_caster_guid = caster->GetGUID(); - damage = caster->CalculateSpellDamage(m_spellProto,m_effIndex,m_currentBasePoints,target); + damage = caster->CalculateSpellDamage(target, m_spellProto, m_effIndex, &m_currentBasePoints); m_maxduration = caster->CalculateSpellDuration(m_spellProto, m_effIndex, target); if (!damage && castItem && castItem->GetItemSuffixFactor()) @@ -1272,7 +1272,7 @@ void Aura::SetStackAmount(uint8 stackAmount) if (stackAmount != m_stackAmount) { m_stackAmount = stackAmount; - int32 amount = m_stackAmount * caster->CalculateSpellDamage(m_spellProto, m_effIndex, m_currentBasePoints, target); + int32 amount = m_stackAmount * caster->CalculateSpellDamage(target, m_spellProto, m_effIndex, &m_currentBasePoints); // Reapply if amount change if (amount!=m_modifier.m_amount) { @@ -3215,7 +3215,7 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) if(itr->second.state == PLAYERSPELL_REMOVED) continue; SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139) - Rage_val += m_target->CalculateSpellDamage(spellInfo, EFFECT_INDEX_0, spellInfo->EffectBasePoints[EFFECT_INDEX_0], m_target) * 10; + Rage_val += m_target->CalculateSpellDamage(m_target, spellInfo, EFFECT_INDEX_0) * 10; } } @@ -6999,7 +6999,7 @@ void Aura::PeriodicTick() { uint32 percent = GetEffIndex() < EFFECT_INDEX_2 && GetSpellProto()->Effect[GetEffIndex()] == SPELL_EFFECT_DUMMY ? - pCaster->CalculateSpellDamage(GetSpellProto(), SpellEffectIndex(GetEffIndex() + 1), GetSpellProto()->EffectBasePoints[GetEffIndex() + 1], m_target) : + pCaster->CalculateSpellDamage(m_target, GetSpellProto(), SpellEffectIndex(GetEffIndex() + 1)) : 100; if(m_target->GetHealth() * 100 >= m_target->GetMaxHealth() * percent ) { @@ -7841,7 +7841,7 @@ void Aura::PeriodicDummyTick() if (rage == 0) return; int32 mod = (rage < 100) ? rage : 100; - int32 points = m_target->CalculateSpellDamage(spell, EFFECT_INDEX_1, spell->EffectBasePoints[EFFECT_INDEX_1], m_target); + int32 points = m_target->CalculateSpellDamage(m_target, spell, EFFECT_INDEX_1); int32 regen = m_target->GetMaxHealth() * (mod * points / 10) / 1000; m_target->CastCustomSpell(m_target, 22845, ®en, NULL, NULL, true, NULL, this); m_target->SetPower(POWER_RAGE, rage-mod); @@ -7977,7 +7977,7 @@ void Aura::PeriodicDummyTick() { // Increases your attack power by $s1 for every $s2 armor value you have. // Calculate AP bonus (from 1 efect of this spell) - int32 apBonus = m_modifier.m_amount * m_target->GetArmor() / m_target->CalculateSpellDamage(spell, EFFECT_INDEX_1, spell->EffectBasePoints[EFFECT_INDEX_1], m_target); + int32 apBonus = m_modifier.m_amount * m_target->GetArmor() / m_target->CalculateSpellDamage(m_target, spell, EFFECT_INDEX_1); m_target->CastCustomSpell(m_target, 61217, &apBonus, &apBonus, NULL, true, NULL, this); return; } diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index f7f97ef5b..819db6158 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -417,7 +417,7 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx) // Shockwave ${$m3/100*$AP} else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000800000000000)) { - int32 pct = m_caster->CalculateSpellDamage(m_spellInfo, EFFECT_INDEX_2, m_spellInfo->EffectBasePoints[EFFECT_INDEX_2], unitTarget); + int32 pct = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, EFFECT_INDEX_2); if (pct > 0) damage+= int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * pct / 100); break; @@ -736,7 +736,7 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx) { // Add main hand dps * effect[2] amount float average = (m_caster->GetFloatValue(UNIT_FIELD_MINDAMAGE) + m_caster->GetFloatValue(UNIT_FIELD_MAXDAMAGE)) / 2; - int32 count = m_caster->CalculateSpellDamage(m_spellInfo, EFFECT_INDEX_2, m_spellInfo->EffectBasePoints[EFFECT_INDEX_2], unitTarget); + int32 count = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, EFFECT_INDEX_2); damage += count * int32(average * IN_MILLISECONDS) / m_caster->GetAttackTime(BASE_ATTACK); } // Shield of Righteousness diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 9ccb1ca33..cf73bfe43 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -6645,7 +6645,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return false; } - int32 extra_attack_power = CalculateSpellDamage(windfurySpellEntry, EFFECT_INDEX_1, windfurySpellEntry->EffectBasePoints[EFFECT_INDEX_1], pVictim); + int32 extra_attack_power = CalculateSpellDamage(pVictim, windfurySpellEntry, EFFECT_INDEX_1); // Off-Hand case if (castItem->GetSlot() == EQUIPMENT_SLOT_OFFHAND) @@ -8925,7 +8925,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 // effect 1 m_amount int32 maxPercent = (*i)->GetModifier()->m_amount; // effect 0 m_amount - int32 stepPercent = CalculateSpellDamage((*i)->GetSpellProto(), EFFECT_INDEX_0, (*i)->GetSpellProto()->EffectBasePoints[EFFECT_INDEX_0], this); + int32 stepPercent = CalculateSpellDamage(this, (*i)->GetSpellProto(), EFFECT_INDEX_0); // count affliction effects and calc additional damage in percentage int32 modPercent = 0; AuraMap const& victimAuras = pVictim->GetAuras(); @@ -11291,7 +11291,7 @@ bool Unit::SelectHostileTarget() //====================================================================== //====================================================================== -int32 Unit::CalculateSpellDamage(SpellEntry const* spellProto, SpellEffectIndex effect_index, int32 effBasePoints, Unit const* target) +int32 Unit::CalculateSpellDamage(Unit const* target, SpellEntry const* spellProto, SpellEffectIndex effect_index, int32 const* effBasePoints) { Player* unitPlayer = (GetTypeId() == TYPEID_PLAYER) ? (Player*)this : NULL; @@ -11305,7 +11305,8 @@ int32 Unit::CalculateSpellDamage(SpellEntry const* spellProto, SpellEffectIndex level-= (int32)spellProto->spellLevel; float basePointsPerLevel = spellProto->EffectRealPointsPerLevel[effect_index]; - int32 basePoints = int32(effBasePoints + level * basePointsPerLevel); + int32 basePoints = effBasePoints ? *effBasePoints - 1 : spellProto->EffectBasePoints[effect_index]; + basePoints += int32(level * basePointsPerLevel); int32 randomPoints = int32(spellProto->EffectDieSides[effect_index]); float comboDamage = spellProto->EffectPointsPerComboPoint[effect_index]; diff --git a/src/game/Unit.h b/src/game/Unit.h index faabc2ad2..4d75d334d 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1757,7 +1757,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject void _RemoveAllAuraMods(); void _ApplyAllAuraMods(); - int32 CalculateSpellDamage(SpellEntry const* spellProto, SpellEffectIndex effect_index, int32 basePoints, Unit const* target); + int32 CalculateSpellDamage(Unit const* target, SpellEntry const* spellProto, SpellEffectIndex effect_index, int32 const* basePoints = NULL); uint32 CalcNotIgnoreAbsorbDamage( uint32 damage, SpellSchoolMask damageSchoolMask, SpellEntry const* spellInfo = NULL); uint32 CalcNotIgnoreDamageRedunction( uint32 damage, SpellSchoolMask damageSchoolMask); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 7ee0bf0ac..b77a9bad8 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9700" + #define REVISION_NR "9701" #endif // __REVISION_NR_H__