diff options
-rw-r--r-- | src/game/Player.cpp | 2 | ||||
-rw-r--r-- | src/game/Spell.cpp | 4 | ||||
-rw-r--r-- | src/game/Spell.h | 2 | ||||
-rw-r--r-- | src/game/SpellAuraEffects.cpp | 14 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 8 | ||||
-rw-r--r-- | src/game/Unit.cpp | 15 | ||||
-rw-r--r-- | src/game/Unit.h | 2 |
7 files changed, 24 insertions, 23 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 30581537df6..31e5f84d3e7 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -14294,7 +14294,7 @@ bool Player::SatisfyQuestLog(bool msg) GetSession()->SendPacket(&data); sLog.outDebug("WORLD: Sent SMSG_QUESTLOG_FULL"); } - return true; + return false; } bool Player::SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index c71402d41d2..680cdac0f36 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2959,8 +2959,8 @@ void Spell::cast(bool skipCheck) uint32 auraSpellIdx = (*i)->GetEffIndex(); if (SpellEntry const *spellInfo = sSpellStore.LookupEntry(auraSpellInfo->EffectTriggerSpell[auraSpellIdx])) { - // Calculate chance at that moment (can be depend for example from combo points) - int32 chance = m_caster->CalculateSpellDamage(auraSpellInfo, auraSpellIdx, (*i)->GetBaseAmount(), NULL); + int32 auraBaseAmount = (*i)->GetBaseAmount(); + int32 chance = m_caster->CalculateSpellDamage(NULL, auraSpellInfo, auraSpellIdx, &auraBaseAmount); m_ChanceTriggerSpells.push_back(std::make_pair(spellInfo, chance * (*i)->GetBase()->GetStackAmount())); } } diff --git a/src/game/Spell.h b/src/game/Spell.h index f3065f8c425..2793a31ba16 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -420,7 +420,7 @@ class Spell SpellCastResult CheckRuneCost(uint32 runeCostID); SpellCastResult CheckCasterAuras() const; - int32 CalculateDamage(uint8 i, Unit* target) { return m_caster->CalculateSpellDamage(m_spellInfo,i,m_currentBasePoints[i],target); } + int32 CalculateDamage(uint8 i, Unit* target) { return m_caster->CalculateSpellDamage(target, m_spellInfo, i, &m_currentBasePoints[i]); } bool HaveTargetsForEffect(uint8 effect) const; void Delayed(); diff --git a/src/game/SpellAuraEffects.cpp b/src/game/SpellAuraEffects.cpp index b632f79718a..66a4197c6db 100644 --- a/src/game/SpellAuraEffects.cpp +++ b/src/game/SpellAuraEffects.cpp @@ -407,7 +407,7 @@ int32 AuraEffect::CalculateAmount(Unit * caster) int32 amount; // default amount calculation if (caster) - amount = caster->CalculateSpellDamage(m_spellProto, m_effIndex, m_baseAmount, NULL); + amount = caster->CalculateSpellDamage(NULL, m_spellProto, m_effIndex); else amount = m_baseAmount + 1; @@ -842,7 +842,7 @@ void AuraEffect::CalculateSpellMod() m_spellmod->spellId = GetId(); m_spellmod->mask[1] = 0x0004000; } - m_spellmod->value = GetBase()->GetUnitOwner()->CalculateSpellDamage(GetSpellProto(), 1, GetSpellProto()->EffectBasePoints[1], GetBase()->GetUnitOwner()); + m_spellmod->value = GetBase()->GetUnitOwner()->CalculateSpellDamage(GetBase()->GetUnitOwner(), GetSpellProto(), 1); break; } break; @@ -1034,7 +1034,7 @@ void AuraEffect::UpdatePeriodic(Unit * caster) break; if (target->ToPlayer()->isMoving()) - m_amount = target->CalculateSpellDamage(m_spellProto,m_effIndex,m_baseAmount,target); + m_amount = target->CalculateSpellDamage(target, m_spellProto,m_effIndex); else --m_amount; break; @@ -1211,7 +1211,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const { uint32 percent = GetEffIndex() < 2 && GetSpellProto()->Effect[GetEffIndex()] == SPELL_EFFECT_DUMMY ? - caster->CalculateSpellDamage(GetSpellProto(),GetEffIndex()+1,GetSpellProto()->EffectBasePoints[GetEffIndex()+1],target) : + caster->CalculateSpellDamage(target, GetSpellProto(),GetEffIndex()+1) : 100; if (target->GetHealth()*100 >= target->GetMaxHealth()*percent) { @@ -1837,7 +1837,7 @@ void AuraEffect::PeriodicDummyTick(Unit * target, Unit * caster) const if (rage == 0) break; int32 mod = (rage < 100) ? rage : 100; - int32 points = target->CalculateSpellDamage(GetSpellProto(), 1, GetSpellProto()->EffectBasePoints[1], target); + int32 points = target->CalculateSpellDamage(target, GetSpellProto(), 1); int32 regen = target->GetMaxHealth() * (mod * points / 10) / 1000; target->CastCustomSpell(target, 22845, ®en, 0, 0, true, 0, this); target->SetPower(POWER_RAGE, rage-mod); @@ -2476,7 +2476,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit * target, bool apply) const // Survival of the Fittest if (AuraEffect const * aurEff = target->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE,SPELLFAMILY_DRUID, 961, 0)) { - int32 bp = target->CalculateSpellDamage(aurEff->GetSpellProto(),2,aurEff->GetSpellProto()->EffectBasePoints[2],target); + int32 bp = target->CalculateSpellDamage(target, GetSpellProto(),2); target->CastCustomSpell(target, 62069,&bp, NULL, NULL, true, 0, this); } break; @@ -2890,7 +2890,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const * aurApp, uint8 m if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled) continue; SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139) - Rage_val += target->CalculateSpellDamage(spellInfo,0,spellInfo->EffectBasePoints[0],target) * 10; + Rage_val += target->CalculateSpellDamage(target,spellInfo,0) * 10; } } if (target->GetPower(POWER_RAGE) > Rage_val) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 45c7fe1af60..d3c471975d1 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -450,7 +450,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) // Shockwave else if (m_spellInfo->Id == 46968) { - int32 pct = m_caster->CalculateSpellDamage(m_spellInfo, 2, m_spellInfo->EffectBasePoints[2], unitTarget); + int32 pct = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, 2); if (pct > 0) damage+= int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * pct / 100); break; @@ -704,7 +704,7 @@ void Spell::SpellDamageSchoolDmg(uint32 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, 2, m_spellInfo->EffectBasePoints[2], unitTarget); + int32 count = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, 2); damage += count * int32(average * IN_MILISECONDS) / m_caster->GetAttackTime(BASE_ATTACK); } // Shield of Righteousness @@ -2039,7 +2039,7 @@ void Spell::EffectDummy(uint32 i) int32 bp = count * m_caster->GetMaxHealth() * m_spellInfo->DmgMultiplier[0] / 100; // Improved Death Strike if (AuraEffect const * aurEff = m_caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, 2751, 0)) - bp = bp * (m_caster->CalculateSpellDamage(aurEff->GetSpellProto(), 2, aurEff->GetSpellProto()->EffectBasePoints[2], m_caster) + 100.0f) / 100.0f; + bp = bp * (m_caster->CalculateSpellDamage(m_caster, aurEff->GetSpellProto(), 2) + 100.0f) / 100.0f; m_caster->CastCustomSpell(m_caster, 45470, &bp, NULL, NULL, false); return; } @@ -5837,7 +5837,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) case CREATURE_FAMILY_VOIDWALKER: { SpellEntry const* spellInfo = sSpellStore.LookupEntry(54443); - int32 hp = unitTarget->GetMaxHealth() * m_caster->CalculateSpellDamage(spellInfo, 0, spellInfo->EffectBasePoints[0], unitTarget) /100; + int32 hp = unitTarget->GetMaxHealth() * m_caster->CalculateSpellDamage(unitTarget, spellInfo, 0) /100; unitTarget->CastCustomSpell(unitTarget, 54443,&hp, NULL, NULL,true); //unitTarget->CastSpell(unitTarget, 54441, true); break; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index c2c139fcc78..d44e9343f77 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -6869,7 +6869,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger return false; } - int32 extra_attack_power = CalculateSpellDamage(windfurySpellEntry, 1, windfurySpellEntry->EffectBasePoints[1], pVictim); + int32 extra_attack_power = CalculateSpellDamage(pVictim, windfurySpellEntry, 1); // Value gained from additional AP basepoints0 = int32(extra_attack_power/14.0f * GetAttackTime(BASE_ATTACK)/1000); @@ -7378,7 +7378,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger else continue; - basepoints0 = CalculateSpellDamage(procSpell,i,procSpell->EffectBasePoints[i],this) * 0.4f; + basepoints0 = CalculateSpellDamage(this, procSpell,i) * 0.4f; CastCustomSpell(this,triggered_spell_id,&basepoints0,NULL,NULL,true,NULL,triggeredByAura); } return true; @@ -7787,7 +7787,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig { if ((*i)->GetMiscValue() == SPELLMOD_CHANCE_OF_SUCCESS && (*i)->GetSpellProto()->SpellIconID == 113) { - int32 value2 = CalculateSpellDamage((*i)->GetSpellProto(),2,(*i)->GetSpellProto()->EffectBasePoints[2],this); + int32 value2 = CalculateSpellDamage(this, (*i)->GetSpellProto(),2); basepoints0 = value2 * GetMaxPower(POWER_MANA) / 100; // Drain Soul CastCustomSpell(this, 18371, &basepoints0, NULL, NULL, true, castItem, triggeredByAura); @@ -9719,7 +9719,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 // effect 1 m_amount int32 maxPercent = (*i)->GetAmount(); // effect 0 m_amount - int32 stepPercent = CalculateSpellDamage((*i)->GetSpellProto(), 0, (*i)->GetSpellProto()->EffectBasePoints[0], this); + int32 stepPercent = CalculateSpellDamage(this, (*i)->GetSpellProto(), 0); // count affliction effects and calc additional damage in percentage int32 modPercent = 0; AuraApplicationMap const &victimAuras = pVictim->GetAppliedAuras(); @@ -12230,7 +12230,7 @@ int32 Unit::ApplyEffectModifiers(SpellEntry const* spellProto, uint8 effect_inde return value; } -int32 Unit::CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_index, int32 effBasePoints, Unit const* /*target*/) +int32 Unit::CalculateSpellDamage(Unit const* target, SpellEntry const* spellProto, uint8 effect_index, int32 const* effBasePoints) { int32 level = int32(getLevel()); if (level > int32(spellProto->maxLevel) && spellProto->maxLevel > 0) @@ -12240,12 +12240,13 @@ int32 Unit::CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_inde 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]); switch(randomPoints) { - case 0: break; // not used + case 0: // not used case 1: basePoints += 1; break; // range 1..1 default: // range can have positive (1..rand) and negative (rand..1) values, so order its for irand diff --git a/src/game/Unit.h b/src/game/Unit.h index 6c62f1c1bfe..71ddc3bb5f0 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1839,7 +1839,7 @@ class Unit : public WorldObject bool isHover() const { return HasAuraType(SPELL_AURA_HOVER); } int32 ApplyEffectModifiers(SpellEntry const* spellProto, uint8 effect_index, int32 value); - int32 CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_index, int32 basePoints, Unit const* target); + int32 CalculateSpellDamage(Unit const* target, SpellEntry const* spellProto, uint8 effect_index, int32 const* basePoints = NULL); int32 CalcSpellDuration(SpellEntry const* spellProto); int32 ModSpellDuration(SpellEntry const* spellProto, Unit const* target, int32 duration, bool positive); void ModSpellCastTime(SpellEntry const* spellProto, int32 & castTime, Spell * spell=NULL); |