aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/DBCStructure.h3
-rw-r--r--src/game/SpellEffects.cpp6
-rw-r--r--src/game/SpellMgr.cpp19
-rw-r--r--src/game/Unit.cpp2
4 files changed, 17 insertions, 13 deletions
diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h
index e9370c3e4ad..782982b3d03 100644
--- a/src/game/DBCStructure.h
+++ b/src/game/DBCStructure.h
@@ -1293,6 +1293,9 @@ struct SpellEntry
uint32 runeCostID; // 229 m_runeCostID
//uint32 spellMissileID; // 230 m_spellMissileID not used
+ // helpers
+ int32 CalculateSimpleValue(uint8 eff) const { return EffectBasePoints[eff]+int32(EffectBaseDice[eff]); }
+
private:
// prevent creating custom entries (copy data from original in fact)
SpellEntry(SpellEntry const&); // DON'T must have implementation
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 57b43c834bb..f741ee12f24 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -298,7 +298,7 @@ void Spell::EffectEnvirinmentalDMG(uint32 i)
// Note: this hack with damage replace required until GO casting not implemented
// environment damage spells already have around enemies targeting but this not help in case not existed GO casting support
// currently each enemy selected explicitly and self cast damage, we prevent apply self casted spell bonuses/etc
- damage = m_spellInfo->EffectBasePoints[i]+m_spellInfo->EffectBaseDice[i];
+ damage = m_spellInfo->CalculateSimpleValue(i);
m_caster->CalcAbsorbResist(m_caster,GetSpellSchoolMask(m_spellInfo), SPELL_DIRECT_DAMAGE, damage, &absorb, &resist, m_spellInfo);
@@ -4753,8 +4753,8 @@ void Spell::EffectScriptEffect(uint32 effIndex)
if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER || effIndex!=0)
return;
- uint32 spellID = m_spellInfo->EffectBasePoints[0] + 1;
- uint32 questID = m_spellInfo->EffectBasePoints[1] + 1;
+ uint32 spellID = m_spellInfo->CalculateSimpleValue(0);
+ uint32 questID = m_spellInfo->CalculateSimpleValue(1);
if( ((Player*)unitTarget)->GetQuestStatus(questID) == QUEST_STATUS_COMPLETE && !((Player*)unitTarget)->GetQuestRewardStatus (questID) )
unitTarget->CastSpell(unitTarget, spellID, true);
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index 36039c4c04c..46e6970e74b 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -314,7 +314,8 @@ int32 CompareAuraRanks(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, ui
if (spellId_1 == spellId_2) return 0;
int32 diff = spellInfo_1->EffectBasePoints[effIndex_1] - spellInfo_2->EffectBasePoints[effIndex_2];
- if (spellInfo_1->EffectBasePoints[effIndex_1]+1 < 0 && spellInfo_2->EffectBasePoints[effIndex_2]+1 < 0) return -diff;
+ if (spellInfo_1->CalculateSimpleValue(effIndex_1) < 0 && spellInfo_2->CalculateSimpleValue(effIndex_2) < 0)
+ return -diff;
else return diff;
}
@@ -602,7 +603,7 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex, bool deep)
case SPELL_AURA_MOD_HEALING_DONE:
case SPELL_AURA_MOD_DAMAGE_PERCENT_DONE:
{
- if(spellproto->EffectBasePoints[effIndex]+int32(spellproto->EffectBaseDice[effIndex]) < 0)
+ if(spellproto->CalculateSimpleValue(effIndex) < 0)
return false;
break;
}
@@ -700,7 +701,7 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex, bool deep)
switch(spellproto->EffectMiscValue[effIndex])
{
case SPELLMOD_COST: // dependent from bas point sign (negative -> positive)
- if(spellproto->EffectBasePoints[effIndex]+int32(spellproto->EffectBaseDice[effIndex]) > 0)
+ if(spellproto->CalculateSimpleValue(effIndex) > 0)
return false;
break;
default:
@@ -708,11 +709,11 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex, bool deep)
}
} break;
case SPELL_AURA_MOD_HEALING_PCT:
- if(spellproto->EffectBasePoints[effIndex]+int32(spellproto->EffectBaseDice[effIndex]) < 0)
+ if(spellproto->CalculateSimpleValue(effIndex) < 0)
return false;
break;
case SPELL_AURA_MOD_SKILL:
- if(spellproto->EffectBasePoints[effIndex]+int32(spellproto->EffectBaseDice[effIndex]) < 0)
+ if(spellproto->CalculateSimpleValue(effIndex) < 0)
return false;
break;
case SPELL_AURA_FORCE_REACTION:
@@ -1911,10 +1912,10 @@ void SpellMgr::LoadSpellLearnSkills()
SpellLearnSkillNode dbc_node;
dbc_node.skill = entry->EffectMiscValue[i];
if ( dbc_node.skill != SKILL_RIDING )
- dbc_node.value = 1;
+ dbc_node.value = 1;
else
- dbc_node.value = (entry->EffectBasePoints[i]+1)*75;
- dbc_node.maxvalue = (entry->EffectBasePoints[i]+1)*75;
+ dbc_node.value = entry->CalculateSimpleValue(i)*75;
+ dbc_node.maxvalue = entry->CalculateSimpleValue(i)*75;
SpellLearnSkillNode const* db_node = GetSpellLearnSkill(spell);
@@ -2236,7 +2237,7 @@ void SpellMgr::LoadSpellPetAuras()
continue;
}
- PetAura pa(pet, aura, spellInfo->EffectImplicitTargetA[i] == TARGET_PET, spellInfo->EffectBasePoints[i] + spellInfo->EffectBaseDice[i]);
+ PetAura pa(pet, aura, spellInfo->EffectImplicitTargetA[i] == TARGET_PET, spellInfo->CalculateSimpleValue(i));
mSpellPetAuraMap[spell] = pa;
}
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 5c08b728307..d10fbbc98da 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -7257,7 +7257,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
}
// percent stored in effect 1 (class scripts) base points
int32 cost = originalSpell->manaCost + originalSpell->ManaCostPercentage * GetCreateMana() / 100;
- basepoints0 = cost*(auraSpellInfo->EffectBasePoints[1]+1)/100;
+ basepoints0 = cost*auraSpellInfo->CalculateSimpleValue(1)/100;
trigger_spell_id = 20272;
target = this;
}