aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2021-03-15 21:03:06 +0100
committerShauren <shauren.trinity@gmail.com>2021-03-15 21:03:06 +0100
commit6585666e6e34ade0333e4c23876acdf847d169c0 (patch)
treecab5db79bd4008efcbff0e0db20eb3d5547a369f /src/server
parent8313053a3bbf8950daf3a1c134dde8a25edf0bd2 (diff)
Core/Spells: Define all spell modifier types and implement ProcCooldown mod and PeriodicHealingAndDamage for melee periodic damage
Diffstat (limited to 'src/server')
-rw-r--r--src/server/game/AI/CoreAI/TotemAI.cpp2
-rw-r--r--src/server/game/Combat/ThreatManager.cpp2
-rw-r--r--src/server/game/Entities/Player/Player.cpp28
-rw-r--r--src/server/game/Entities/Player/Player.h3
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp84
-rw-r--r--src/server/game/Entities/Unit/Unit.h84
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp93
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.cpp19
-rw-r--r--src/server/game/Spells/Spell.cpp20
-rw-r--r--src/server/game/Spells/SpellEffects.cpp2
-rw-r--r--src/server/game/Spells/SpellHistory.cpp4
-rw-r--r--src/server/game/Spells/SpellInfo.cpp22
-rw-r--r--src/server/scripts/Spells/spell_druid.cpp2
-rw-r--r--src/server/scripts/Spells/spell_warlock.cpp2
-rw-r--r--src/server/scripts/World/duel_reset.cpp4
15 files changed, 184 insertions, 187 deletions
diff --git a/src/server/game/AI/CoreAI/TotemAI.cpp b/src/server/game/AI/CoreAI/TotemAI.cpp
index 14bda813d48..fc499414587 100644
--- a/src/server/game/AI/CoreAI/TotemAI.cpp
+++ b/src/server/game/AI/CoreAI/TotemAI.cpp
@@ -60,7 +60,7 @@ void TotemAI::UpdateAI(uint32 /*diff*/)
// Get spell range
float max_range = spellInfo->GetMaxRange(false);
- // SPELLMOD_RANGE not applied in this place just because not existence range mods for attacking totems
+ // SpellModOp::Range not applied in this place just because not existence range mods for attacking totems
// pointer to appropriate target if found any
Unit* victim = !i_victimGuid.IsEmpty() ? ObjectAccessor::GetUnit(*me, i_victimGuid) : nullptr;
diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp
index 320b1f62e63..0e9b871c8e5 100644
--- a/src/server/game/Combat/ThreatManager.cpp
+++ b/src/server/game/Combat/ThreatManager.cpp
@@ -45,7 +45,7 @@ float ThreatCalcHelper::calcThreat(Unit* hatedUnit, Unit* /*hatingUnit*/, float
return threat;
if (Player* modOwner = hatedUnit->GetSpellModOwner())
- modOwner->ApplySpellMod(threatSpell, SPELLMOD_THREAT, threat);
+ modOwner->ApplySpellMod(threatSpell, SpellModOp::Hate, threat);
}
return hatedUnit->ApplyTotalThreatModifier(threat, schoolMask);
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 38dda675437..6dd5de7275f 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -8345,7 +8345,7 @@ void Player::CastItemCombatSpell(DamageInfo const& damageInfo, Item* item, ItemT
}
// Apply spell mods
- ApplySpellMod(spellInfo, SPELLMOD_CHANCE_OF_SUCCESS, chance);
+ ApplySpellMod(spellInfo, SpellModOp::ProcChance, chance);
// Shiv has 100% chance to apply the poison
if (FindCurrentSpellBySpellId(5938) && e_slot == TEMP_ENCHANTMENT_SLOT)
@@ -22416,7 +22416,7 @@ bool Player::IsAffectedBySpellmod(SpellInfo const* spellInfo, SpellModifier* mod
return false;
// +duration to infinite duration spells making them limited
- if (mod->op == SPELLMOD_DURATION && spellInfo->GetDuration() == -1)
+ if (mod->op == SpellModOp::Duration && spellInfo->GetDuration() == -1)
return false;
return spellInfo->IsAffectedBySpellMod(mod);
@@ -22437,10 +22437,10 @@ void Player::GetSpellModValues(SpellInfo const* spellInfo, SpellModOp op, Spell*
switch (op)
{
// special case, if a mod makes spell instant, only consume that mod
- case SPELLMOD_CASTING_TIME:
+ case SpellModOp::ChangeCastTime:
{
SpellModifier* modInstantSpell = nullptr;
- for (SpellModifier* mod : m_spellMods[op][SPELLMOD_PCT])
+ for (SpellModifier* mod : m_spellMods[AsUnderlyingType(op)][SPELLMOD_PCT])
{
if (!IsAffectedBySpellmod(spellInfo, mod, spell))
continue;
@@ -22461,10 +22461,10 @@ void Player::GetSpellModValues(SpellInfo const* spellInfo, SpellModOp op, Spell*
break;
}
// special case if two mods apply 100% critical chance, only consume one
- case SPELLMOD_CRITICAL_CHANCE:
+ case SpellModOp::CritChance:
{
SpellModifier* modCritical = nullptr;
- for (SpellModifier* mod : m_spellMods[op][SPELLMOD_FLAT])
+ for (SpellModifier* mod : m_spellMods[AsUnderlyingType(op)][SPELLMOD_FLAT])
{
if (!IsAffectedBySpellmod(spellInfo, mod, spell))
continue;
@@ -22488,7 +22488,7 @@ void Player::GetSpellModValues(SpellInfo const* spellInfo, SpellModOp op, Spell*
break;
}
- for (SpellModifier* mod : m_spellMods[op][SPELLMOD_FLAT])
+ for (SpellModifier* mod : m_spellMods[AsUnderlyingType(op)][SPELLMOD_FLAT])
{
if (!IsAffectedBySpellmod(spellInfo, mod, spell))
continue;
@@ -22497,7 +22497,7 @@ void Player::GetSpellModValues(SpellInfo const* spellInfo, SpellModOp op, Spell*
Player::ApplyModToSpell(mod, spell);
}
- for (SpellModifier* mod : m_spellMods[op][SPELLMOD_PCT])
+ for (SpellModifier* mod : m_spellMods[AsUnderlyingType(op)][SPELLMOD_PCT])
{
if (!IsAffectedBySpellmod(spellInfo, mod, spell))
continue;
@@ -22507,7 +22507,7 @@ void Player::GetSpellModValues(SpellInfo const* spellInfo, SpellModOp op, Spell*
continue;
// special case (skip > 10sec spell casts for instant cast setting)
- if (op == SPELLMOD_CASTING_TIME)
+ if (op == SpellModOp::ChangeCastTime)
{
if (base >= T(10000) && mod->value <= -100)
continue;
@@ -22543,9 +22543,9 @@ void Player::AddSpellMod(SpellModifier* mod, bool apply)
/// First, manipulate our spellmodifier container
if (apply)
- m_spellMods[mod->op][mod->type].insert(mod);
+ m_spellMods[AsUnderlyingType(mod->op)][mod->type].insert(mod);
else
- m_spellMods[mod->op][mod->type].erase(mod);
+ m_spellMods[AsUnderlyingType(mod->op)][mod->type].erase(mod);
/// Now, send spellmodifier packet
if (!IsLoading())
@@ -22558,7 +22558,7 @@ void Player::AddSpellMod(SpellModifier* mod, bool apply)
packet.Modifiers.resize(1);
WorldPackets::Spells::SpellModifier& spellMod = packet.Modifiers[0];
- spellMod.ModIndex = mod->op;
+ spellMod.ModIndex = AsUnderlyingType(mod->op);
for (int eff = 0; eff < 128; ++eff)
{
@@ -22571,14 +22571,14 @@ void Player::AddSpellMod(SpellModifier* mod, bool apply)
if (mod->type == SPELLMOD_FLAT)
{
modData.ModifierValue = 0.0f;
- for (SpellModifier* spellMod : m_spellMods[mod->op][SPELLMOD_FLAT])
+ for (SpellModifier* spellMod : m_spellMods[AsUnderlyingType(mod->op)][SPELLMOD_FLAT])
if (spellMod->mask & mask)
modData.ModifierValue += spellMod->value;
}
else
{
modData.ModifierValue = 1.0f;
- for (SpellModifier* spellMod : m_spellMods[mod->op][SPELLMOD_PCT])
+ for (SpellModifier* spellMod : m_spellMods[AsUnderlyingType(mod->op)][SPELLMOD_PCT])
if (spellMod->mask & mask)
modData.ModifierValue *= 1.0f + CalculatePct(1.0f, spellMod->value);
}
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 867d754452c..2db8594e0d2 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -134,7 +134,6 @@ enum SkillFieldOffset : uint16
#define PLAYER_EXPLORED_ZONES_SIZE 192
-// Note: SPELLMOD_* values is aura types in fact
enum SpellModType : uint8
{
SPELLMOD_FLAT = 0, // SPELL_AURA_ADD_FLAT_MODIFIER
@@ -230,7 +229,7 @@ enum SpecResetType
// Spell modifier (used for modify other spells)
struct SpellModifier
{
- SpellModifier(Aura* _ownerAura) : op(SPELLMOD_DAMAGE), type(SPELLMOD_FLAT), value(0), mask(), spellId(0), ownerAura(_ownerAura) { }
+ SpellModifier(Aura* _ownerAura) : op(SpellModOp::HealingAndDamage), type(SPELLMOD_FLAT), value(0), mask(), spellId(0), ownerAura(_ownerAura) { }
SpellModOp op;
SpellModType type;
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index f11b233d7d0..23afeffd8cb 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -1137,7 +1137,7 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 dama
uint32 crit_bonus = damage;
// Apply crit_damage bonus for melee spells
if (Player* modOwner = GetSpellModOwner())
- modOwner->ApplySpellMod(spellInfo, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
+ modOwner->ApplySpellMod(spellInfo, SpellModOp::CritDamageAndHealing, crit_bonus);
damage += crit_bonus;
// Increase crit damage from SPELL_AURA_MOD_CRIT_DAMAGE_BONUS
@@ -1287,7 +1287,7 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam
damage += CalculateDamage(damageInfo->attackType, false, true);
// Add melee damage bonus
- damage = MeleeDamageBonusDone(damageInfo->target, damage, damageInfo->attackType);
+ damage = MeleeDamageBonusDone(damageInfo->target, damage, damageInfo->attackType, DIRECT_DAMAGE);
damage = damageInfo->target->MeleeDamageBonusTaken(this, damage, damageInfo->attackType, DIRECT_DAMAGE);
// Script Hook For CalculateMeleeDamage -- Allow scripts to change the Damage pre class mitigation calculations
@@ -1608,7 +1608,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* attacker, Unit* victim, const uint32 d
if (spellInfo)
if (Player* modOwner = GetSpellModOwner())
- modOwner->ApplySpellMod(spellInfo, SPELLMOD_IGNORE_ARMOR, armor);
+ modOwner->ApplySpellMod(spellInfo, SpellModOp::TargetResistance, armor);
AuraEffectList const& resIgnoreAuras = GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST);
for (AuraEffectList::const_iterator j = resIgnoreAuras.begin(); j != resIgnoreAuras.end(); ++j)
@@ -2556,9 +2556,9 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spellInfo
else
modHitChance = 97 - levelBasedHitDiff;
- // Spellmod from SPELLMOD_RESIST_MISS_CHANCE
+ // Spellmod from SpellModOp::HitChance
if (Player* modOwner = GetSpellModOwner())
- modOwner->ApplySpellMod(spellInfo, SPELLMOD_RESIST_MISS_CHANCE, modHitChance);
+ modOwner->ApplySpellMod(spellInfo, SpellModOp::HitChance, modHitChance);
// Spells with SPELL_ATTR3_IGNORE_HIT_RESULT will ignore target's avoidance effects
if (!spellInfo->HasAttribute(SPELL_ATTR3_IGNORE_HIT_RESULT))
@@ -6698,7 +6698,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
if (Player* modOwner = GetSpellModOwner())
{
ApCoeffMod *= 100.0f;
- modOwner->ApplySpellMod(spellProto, SPELLMOD_BONUS_MULTIPLIER, ApCoeffMod);
+ modOwner->ApplySpellMod(spellProto, SpellModOp::BonusCoefficient, ApCoeffMod);
ApCoeffMod /= 100.0f;
}
@@ -6724,7 +6724,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
if (Player* modOwner = GetSpellModOwner())
{
coeff *= 100.0f;
- modOwner->ApplySpellMod(spellProto, SPELLMOD_BONUS_MULTIPLIER, coeff);
+ modOwner->ApplySpellMod(spellProto, SpellModOp::BonusCoefficient, coeff);
coeff /= 100.0f;
}
DoneTotal += int32(DoneAdvertisedBenefit * coeff * stack);
@@ -6736,9 +6736,9 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
if (Player* modOwner = GetSpellModOwner())
{
if (damagetype == DOT)
- modOwner->ApplySpellMod(spellProto, SPELLMOD_DOT, tmpDamage);
+ modOwner->ApplySpellMod(spellProto, SpellModOp::PeriodicHealingAndDamage, tmpDamage);
else
- modOwner->ApplySpellMod(spellProto, SPELLMOD_DAMAGE, tmpDamage);
+ modOwner->ApplySpellMod(spellProto, SpellModOp::HealingAndDamage, tmpDamage);
}
return uint32(std::max(tmpDamage, 0.0f));
@@ -6893,7 +6893,7 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui
if (Player* modOwner = GetSpellModOwner())
{
coeff *= 100.0f;
- modOwner->ApplySpellMod(spellProto, SPELLMOD_BONUS_MULTIPLIER, coeff);
+ modOwner->ApplySpellMod(spellProto, SpellModOp::BonusCoefficient, coeff);
coeff /= 100.0f;
}
TakenTotal += int32(TakenAdvertisedBenefit * coeff * stack);
@@ -7077,7 +7077,7 @@ float Unit::GetUnitSpellCriticalChance(Unit* victim, SpellInfo const* spellProto
// percent done
// only players use intelligence for critical chance computations
if (Player* modOwner = GetSpellModOwner())
- modOwner->ApplySpellMod(spellProto, SPELLMOD_CRITICAL_CHANCE, crit_chance);
+ modOwner->ApplySpellMod(spellProto, SpellModOp::CritChance, crit_chance);
// for this types the bonus was already added in GetUnitCriticalChance, do not add twice
if (spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE && spellProto->DmgClass != SPELL_DAMAGE_CLASS_RANGED)
@@ -7126,7 +7126,7 @@ uint32 Unit::SpellCriticalDamageBonus(SpellInfo const* spellProto, uint32 damage
// adds additional damage to critBonus (from talents)
if (Player* modOwner = GetSpellModOwner())
- modOwner->ApplySpellMod(spellProto, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
+ modOwner->ApplySpellMod(spellProto, SpellModOp::CritDamageAndHealing, crit_bonus);
crit_bonus += damage;
@@ -7140,7 +7140,7 @@ uint32 Unit::SpellCriticalHealingBonus(SpellInfo const* spellProto, uint32 damag
// adds additional damage to critBonus (from talents)
if (Player* modOwner = GetSpellModOwner())
- modOwner->ApplySpellMod(spellProto, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
+ modOwner->ApplySpellMod(spellProto, SpellModOp::CritDamageAndHealing, crit_bonus);
damage += crit_bonus;
@@ -7202,7 +7202,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
if (Player* modOwner = GetSpellModOwner())
{
coeff *= 100.0f;
- modOwner->ApplySpellMod(spellProto, SPELLMOD_BONUS_MULTIPLIER, coeff);
+ modOwner->ApplySpellMod(spellProto, SpellModOp::BonusCoefficient, coeff);
coeff /= 100.0f;
}
@@ -7231,9 +7231,9 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
if (Player* modOwner = GetSpellModOwner())
{
if (damagetype == DOT)
- modOwner->ApplySpellMod(spellProto, SPELLMOD_DOT, heal);
+ modOwner->ApplySpellMod(spellProto, SpellModOp::PeriodicHealingAndDamage, heal);
else
- modOwner->ApplySpellMod(spellProto, SPELLMOD_DAMAGE, heal);
+ modOwner->ApplySpellMod(spellProto, SpellModOp::HealingAndDamage, heal);
}
return uint32(std::max(heal, 0.0f));
@@ -7331,7 +7331,7 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u
if (Player* modOwner = GetSpellModOwner())
{
coeff *= 100.0f;
- modOwner->ApplySpellMod(spellProto, SPELLMOD_BONUS_MULTIPLIER, coeff);
+ modOwner->ApplySpellMod(spellProto, SpellModOp::BonusCoefficient, coeff);
coeff /= 100.0f;
}
@@ -7617,12 +7617,12 @@ bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index, Unit
return false;
}
-uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType attType, SpellInfo const* spellProto)
+uint32 Unit::MeleeDamageBonusDone(Unit* pVictim, uint32 damage, WeaponAttackType attType, DamageEffectType damagetype, SpellInfo const* spellProto /*= nullptr*/)
{
- if (!victim || pdamage == 0)
+ if (!pVictim || damage == 0)
return 0;
- uint32 creatureTypeMask = victim->GetCreatureTypeMask();
+ uint32 creatureTypeMask = pVictim->GetCreatureTypeMask();
// Done fixed damage bonus auras
int32 DoneFlatBenefit = 0;
@@ -7638,14 +7638,14 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
if (attType == RANGED_ATTACK)
{
- APbonus += victim->GetTotalAuraModifier(SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS);
+ APbonus += pVictim->GetTotalAuraModifier(SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS);
// ..done (base at attack power and creature type)
APbonus += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS, creatureTypeMask);
}
else
{
- APbonus += victim->GetTotalAuraModifier(SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS);
+ APbonus += pVictim->GetTotalAuraModifier(SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS);
// ..done (base at attack power and creature type)
APbonus += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS, creatureTypeMask);
@@ -7689,9 +7689,9 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
DoneTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS, creatureTypeMask);
// bonus against aurastate
- DoneTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE, [victim](AuraEffect const* aurEff) -> bool
+ DoneTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE, [pVictim](AuraEffect const* aurEff) -> bool
{
- if (victim->HasAuraState(AuraStateType(aurEff->GetMiscValue())))
+ if (pVictim->HasAuraState(AuraStateType(aurEff->GetMiscValue())))
return true;
return false;
});
@@ -7700,12 +7700,19 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
if (spellProto)
AddPct(DoneTotalMod, GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_DAMAGE_DONE_FOR_MECHANIC, spellProto->Mechanic));
- float tmpDamage = float(int32(pdamage) + DoneFlatBenefit) * DoneTotalMod;
+ float tmpDamage = float(int32(damage) + DoneFlatBenefit) * DoneTotalMod;
// apply spellmod to Done damage
if (spellProto)
+ {
if (Player* modOwner = GetSpellModOwner())
- modOwner->ApplySpellMod(spellProto, SPELLMOD_DAMAGE, tmpDamage);
+ {
+ if (damagetype == DOT)
+ modOwner->ApplySpellMod(spellProto, SpellModOp::PeriodicHealingAndDamage, tmpDamage);
+ else
+ modOwner->ApplySpellMod(spellProto, SpellModOp::HealingAndDamage, tmpDamage);
+ }
+ }
// bonus result can be negative
return uint32(std::max(tmpDamage, 0.0f));
@@ -7851,7 +7858,7 @@ float Unit::GetPPMProcChance(uint32 WeaponSpeed, float PPM, SpellInfo const* spe
// Apply chance modifer aura
if (spellProto)
if (Player* modOwner = GetSpellModOwner())
- modOwner->ApplySpellMod(spellProto, SPELLMOD_PROC_PER_MINUTE, PPM);
+ modOwner->ApplySpellMod(spellProto, SpellModOp::ProcFrequency, PPM);
return std::floor((WeaponSpeed * PPM) / 600.0f); // result is chance in percents (probability = Speed_in_sec * (PPM / 60))
}
@@ -9121,23 +9128,23 @@ float Unit::ApplyEffectModifiers(SpellInfo const* spellProto, uint8 effect_index
{
if (Player* modOwner = GetSpellModOwner())
{
- modOwner->ApplySpellMod(spellProto, SPELLMOD_ALL_EFFECTS, value);
+ modOwner->ApplySpellMod(spellProto, SpellModOp::Points, value);
switch (effect_index)
{
case EFFECT_0:
- modOwner->ApplySpellMod(spellProto, SPELLMOD_EFFECT1, value);
+ modOwner->ApplySpellMod(spellProto, SpellModOp::PointsIndex0, value);
break;
case EFFECT_1:
- modOwner->ApplySpellMod(spellProto, SPELLMOD_EFFECT2, value);
+ modOwner->ApplySpellMod(spellProto, SpellModOp::PointsIndex1, value);
break;
case EFFECT_2:
- modOwner->ApplySpellMod(spellProto, SPELLMOD_EFFECT3, value);
+ modOwner->ApplySpellMod(spellProto, SpellModOp::PointsIndex2, value);
break;
case EFFECT_3:
- modOwner->ApplySpellMod(spellProto, SPELLMOD_EFFECT4, value);
+ modOwner->ApplySpellMod(spellProto, SpellModOp::PointsIndex3, value);
break;
case EFFECT_4:
- modOwner->ApplySpellMod(spellProto, SPELLMOD_EFFECT5, value);
+ modOwner->ApplySpellMod(spellProto, SpellModOp::PointsIndex4, value);
break;
}
}
@@ -9256,7 +9263,7 @@ void Unit::ModSpellCastTime(SpellInfo const* spellInfo, int32 & castTime, Spell*
// called from caster
if (Player* modOwner = GetSpellModOwner())
- modOwner->ApplySpellMod(spellInfo, SPELLMOD_CASTING_TIME, castTime, spell);
+ modOwner->ApplySpellMod(spellInfo, SpellModOp::ChangeCastTime, castTime, spell);
if (!(spellInfo->HasAttribute(SPELL_ATTR0_ABILITY) || spellInfo->HasAttribute(SPELL_ATTR0_TRADESPELL) || spellInfo->HasAttribute(SPELL_ATTR3_NO_DONE_BONUS)) &&
((GetTypeId() == TYPEID_PLAYER && spellInfo->SpellFamilyName) || GetTypeId() == TYPEID_UNIT))
@@ -9277,7 +9284,7 @@ void Unit::ModSpellDurationTime(SpellInfo const* spellInfo, int32 & duration, Sp
// called from caster
if (Player* modOwner = GetSpellModOwner())
- modOwner->ApplySpellMod(spellInfo, SPELLMOD_CASTING_TIME, duration, spell);
+ modOwner->ApplySpellMod(spellInfo, SpellModOp::ChangeCastTime, duration, spell);
if (!(spellInfo->HasAttribute(SPELL_ATTR0_ABILITY) || spellInfo->HasAttribute(SPELL_ATTR0_TRADESPELL) || spellInfo->HasAttribute(SPELL_ATTR3_NO_DONE_BONUS)) &&
((GetTypeId() == TYPEID_PLAYER && spellInfo->SpellFamilyName) || GetTypeId() == TYPEID_UNIT))
@@ -12605,13 +12612,12 @@ float Unit::MeleeSpellMissChance(Unit const* victim, WeaponAttackType attType, S
if (!spellInfo && haveOffhandWeapon() && !IsInFeralForm())
missChance += 19.0f;
- // Spellmod from SPELLMOD_RESIST_MISS_CHANCE
+ // Spellmod from SpellModOp::HitChance
float resistMissChance = 100.0f;
if (spellInfo)
- {
if (Player* modOwner = GetSpellModOwner())
- modOwner->ApplySpellMod(spellInfo, SPELLMOD_RESIST_MISS_CHANCE, resistMissChance);
- }
+ modOwner->ApplySpellMod(spellInfo, SpellModOp::HitChance, resistMissChance);
+
missChance -= resistMissChance - 100.0f;
if (attType == RANGED_ATTACK)
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 71f82e27baf..208f47f81ab 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -38,48 +38,48 @@
#define SPELL_DH_DOUBLE_JUMP 196055
#define DISPLAYID_HIDDEN_MOUNT 73200
-enum SpellModOp : uint8
+enum class SpellModOp : uint8
{
- SPELLMOD_DAMAGE = 0,
- SPELLMOD_DURATION = 1,
- SPELLMOD_THREAT = 2,
- SPELLMOD_EFFECT1 = 3,
- SPELLMOD_CHARGES = 4,
- SPELLMOD_RANGE = 5,
- SPELLMOD_RADIUS = 6,
- SPELLMOD_CRITICAL_CHANCE = 7,
- SPELLMOD_ALL_EFFECTS = 8,
- SPELLMOD_NOT_LOSE_CASTING_TIME = 9,
- SPELLMOD_CASTING_TIME = 10,
- SPELLMOD_COOLDOWN = 11,
- SPELLMOD_EFFECT2 = 12,
- SPELLMOD_IGNORE_ARMOR = 13,
- SPELLMOD_COST = 14, // Used when SpellPowerEntry::PowerIndex == 0
- SPELLMOD_CRIT_DAMAGE_BONUS = 15,
- SPELLMOD_RESIST_MISS_CHANCE = 16,
- SPELLMOD_JUMP_TARGETS = 17,
- SPELLMOD_CHANCE_OF_SUCCESS = 18,
- SPELLMOD_ACTIVATION_TIME = 19,
- SPELLMOD_DAMAGE_MULTIPLIER = 20,
- SPELLMOD_GLOBAL_COOLDOWN = 21,
- SPELLMOD_DOT = 22,
- SPELLMOD_EFFECT3 = 23,
- SPELLMOD_BONUS_MULTIPLIER = 24,
- // spellmod 25
- SPELLMOD_PROC_PER_MINUTE = 26,
- SPELLMOD_VALUE_MULTIPLIER = 27,
- SPELLMOD_RESIST_DISPEL_CHANCE = 28,
- SPELLMOD_CRIT_DAMAGE_BONUS_2 = 29, //one not used spell
- SPELLMOD_SPELL_COST_REFUND_ON_FAIL = 30,
- SPELLMOD_STACK_AMOUNT = 31,
- SPELLMOD_EFFECT4 = 32,
- SPELLMOD_EFFECT5 = 33,
- SPELLMOD_SPELL_COST2 = 34, // Used when SpellPowerEntry::PowerIndex == 1
- SPELLMOD_JUMP_DISTANCE = 35,
- // spellmod 36
- SPELLMOD_MAX_STACK_AMOUNT = 37,
- // spellmod 38
- SPELLMOD_SPELL_COST3 = 39
+ HealingAndDamage = 0,
+ Duration = 1,
+ Hate = 2,
+ PointsIndex0 = 3,
+ ProcCharges = 4,
+ Range = 5,
+ Radius = 6,
+ CritChance = 7,
+ Points = 8,
+ ResistPushback = 9,
+ ChangeCastTime = 10,
+ Cooldown = 11,
+ PointsIndex1 = 12,
+ TargetResistance = 13,
+ PowerCost0 = 14, // Used when SpellPowerEntry::PowerIndex == 0
+ CritDamageAndHealing = 15,
+ HitChance = 16,
+ ChainTargets = 17,
+ ProcChance = 18,
+ Period = 19,
+ ChainAmplitude = 20,
+ StartCooldown = 21,
+ PeriodicHealingAndDamage = 22,
+ PointsIndex2 = 23,
+ BonusCoefficient = 24,
+ TriggerDamage = 25, // NYI
+ ProcFrequency = 26,
+ Amplitude = 27,
+ DispelResistance = 28,
+ CrowdDamage = 29, // NYI
+ PowerCostOnMiss = 30,
+ Doses = 31,
+ PointsIndex3 = 32,
+ PointsIndex4 = 33,
+ PowerCost1 = 34, // Used when SpellPowerEntry::PowerIndex == 1
+ ChainJumpDistance = 35,
+ AreaTriggerMaxSummons = 36, // NYI
+ MaxAuraStacks = 37,
+ ProcCooldown = 38,
+ PowerCost2 = 39, // Used when SpellPowerEntry::PowerIndex == 2
};
#define MAX_SPELLMOD 40
@@ -1861,7 +1861,7 @@ class TC_GAME_API Unit : public WorldObject
float SpellHealingPctDone(Unit* victim, SpellInfo const* spellProto) const;
uint32 SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, SpellEffectInfo const* effect, uint32 stack = 1) const;
- uint32 MeleeDamageBonusDone(Unit* pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const* spellProto = nullptr);
+ uint32 MeleeDamageBonusDone(Unit* pVictim, uint32 damage, WeaponAttackType attType, DamageEffectType damagetype, SpellInfo const* spellProto = nullptr);
uint32 MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackType attType, DamageEffectType damagetype, SpellInfo const* spellProto = nullptr);
bool isSpellBlocked(Unit* victim, SpellInfo const* spellProto, WeaponAttackType attackType = BASE_ATTACK);
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 797c0ce72bf..5c8370ec4de 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -734,7 +734,7 @@ void AuraEffect::CalculatePeriodic(Unit* caster, bool resetPeriodicTimer /*= tru
{
// Apply periodic time mod
if (modOwner)
- modOwner->ApplySpellMod(GetSpellInfo(), SPELLMOD_ACTIVATION_TIME, _period);
+ modOwner->ApplySpellMod(GetSpellInfo(), SpellModOp::Period, _period);
if (caster)
{
@@ -897,64 +897,49 @@ void AuraEffect::ApplySpellMod(Unit* target, bool apply)
// Auras with charges do not mod amount of passive auras
if (GetBase()->IsUsingCharges())
return;
+
// reapply some passive spells after add/remove related spellmods
// Warning: it is a dead loop if 2 auras each other amount-shouldn't happen
- switch (GetMiscValue())
+ std::bitset<MAX_SPELL_EFFECTS> recalculateEffectMask;
+ switch (SpellModOp(GetMiscValue()))
{
- case SPELLMOD_ALL_EFFECTS:
- case SPELLMOD_EFFECT1:
- case SPELLMOD_EFFECT2:
- case SPELLMOD_EFFECT3:
- case SPELLMOD_EFFECT4:
- case SPELLMOD_EFFECT5:
+ case SpellModOp::Points:
+ recalculateEffectMask.set();
+ break;
+ case SpellModOp::PointsIndex0:
+ recalculateEffectMask.set(EFFECT_0);
+ break;
+ case SpellModOp::PointsIndex1:
+ recalculateEffectMask.set(EFFECT_1);
+ break;
+ case SpellModOp::PointsIndex2:
+ recalculateEffectMask.set(EFFECT_2);
+ break;
+ case SpellModOp::PointsIndex3:
+ recalculateEffectMask.set(EFFECT_3);
+ break;
+ case SpellModOp::PointsIndex4:
+ recalculateEffectMask.set(EFFECT_4);
+ break;
+ default:
+ break;
+ }
+
+ if (recalculateEffectMask.any())
+ {
+ ObjectGuid guid = target->GetGUID();
+ Unit::AuraApplicationMap& auras = target->GetAppliedAuras();
+ for (auto iter = auras.begin(); iter != auras.end(); ++iter)
{
- ObjectGuid guid = target->GetGUID();
- Unit::AuraApplicationMap & auras = target->GetAppliedAuras();
- for (Unit::AuraApplicationMap::iterator iter = auras.begin(); iter != auras.end(); ++iter)
- {
- Aura* aura = iter->second->GetBase();
- // only passive and permament auras-active auras should have amount set on spellcast and not be affected
- // if aura is cast by others, it will not be affected
- if ((aura->IsPassive() || aura->IsPermanent()) && aura->GetCasterGUID() == guid && aura->GetSpellInfo()->IsAffectedBySpellMod(m_spellmod))
- {
- if (GetMiscValue() == SPELLMOD_ALL_EFFECTS)
- {
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- {
- if (AuraEffect* aurEff = aura->GetEffect(i))
- aurEff->RecalculateAmount();
- }
- }
- else if (GetMiscValue() == SPELLMOD_EFFECT1)
- {
- if (AuraEffect* aurEff = aura->GetEffect(0))
- aurEff->RecalculateAmount();
- }
- else if (GetMiscValue() == SPELLMOD_EFFECT2)
- {
- if (AuraEffect* aurEff = aura->GetEffect(1))
- aurEff->RecalculateAmount();
- }
- else if (GetMiscValue() == SPELLMOD_EFFECT3)
- {
- if (AuraEffect* aurEff = aura->GetEffect(2))
- aurEff->RecalculateAmount();
- }
- else if (GetMiscValue() == SPELLMOD_EFFECT4)
- {
- if (AuraEffect* aurEff = aura->GetEffect(3))
+ Aura* aura = iter->second->GetBase();
+ // only passive and permament auras-active auras should have amount set on spellcast and not be affected
+ // if aura is cast by others, it will not be affected
+ if ((aura->IsPassive() || aura->IsPermanent()) && aura->GetCasterGUID() == guid && aura->GetSpellInfo()->IsAffectedBySpellMod(m_spellmod))
+ for (size_t i = 0; i < recalculateEffectMask.size(); ++i)
+ if (recalculateEffectMask[i])
+ if (AuraEffect* aurEff = aura->GetEffect(i))
aurEff->RecalculateAmount();
- }
- else if (GetMiscValue() == SPELLMOD_EFFECT5)
- {
- if (AuraEffect* aurEff = aura->GetEffect(4))
- aurEff->RecalculateAmount();
- }
- }
- }
}
- default:
- break;
}
}
@@ -5183,7 +5168,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
int32 weaponDamage = CalculatePct(caster->CalculateDamage(attackType, false, true), GetAmount());
// Add melee damage bonuses (also check for negative)
- uint32 damageBonusDone = caster->MeleeDamageBonusDone(target, std::max(weaponDamage, 0), attackType, GetSpellInfo());
+ uint32 damageBonusDone = caster->MeleeDamageBonusDone(target, std::max(weaponDamage, 0), attackType, DOT, GetSpellInfo());
damage = target->MeleeDamageBonusTaken(caster, damageBonusDone, attackType, DOT, GetSpellInfo());
break;
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index bbabf96b85e..6fe71dc2fec 100644
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -765,7 +765,7 @@ int32 Aura::CalcMaxDuration(Unit* caster) const
// IsPermanent() checks max duration (which we are supposed to calculate here)
if (maxDuration != -1 && modOwner)
- modOwner->ApplySpellMod(GetSpellInfo(), SPELLMOD_DURATION, maxDuration);
+ modOwner->ApplySpellMod(GetSpellInfo(), SpellModOp::Duration, maxDuration);
return maxDuration;
}
@@ -775,7 +775,7 @@ void Aura::SetDuration(int32 duration, bool withMods)
if (withMods)
if (Unit* caster = GetCaster())
if (Player* modOwner = caster->GetSpellModOwner())
- modOwner->ApplySpellMod(GetSpellInfo(), SPELLMOD_DURATION, duration);
+ modOwner->ApplySpellMod(GetSpellInfo(), SpellModOp::Duration, duration);
m_duration = duration;
SetNeedClientUpdateForTargets();
@@ -851,7 +851,7 @@ uint8 Aura::CalcMaxCharges(Unit* caster) const
if (caster)
if (Player* modOwner = caster->GetSpellModOwner())
- modOwner->ApplySpellMod(GetSpellInfo(), SPELLMOD_CHARGES, maxProcCharges);
+ modOwner->ApplySpellMod(GetSpellInfo(), SpellModOp::ProcCharges, maxProcCharges);
return uint8(maxProcCharges);
}
@@ -937,7 +937,7 @@ uint32 Aura::CalcMaxStackAmount() const
int32 maxStackAmount = m_spellInfo->StackAmount;
if (Unit* caster = GetCaster())
if (Player* modOwner = caster->GetSpellModOwner())
- modOwner->ApplySpellMod(m_spellInfo, SPELLMOD_MAX_STACK_AMOUNT, maxStackAmount);
+ modOwner->ApplySpellMod(m_spellInfo, SpellModOp::MaxAuraStacks, maxStackAmount);
return maxStackAmount;
}
@@ -1079,7 +1079,7 @@ int32 Aura::CalcDispelChance(Unit const* /*auraTarget*/, bool /*offensive*/) con
// Apply dispel mod from aura caster
if (Unit* caster = GetCaster())
if (Player* modOwner = caster->GetSpellModOwner())
- modOwner->ApplySpellMod(GetSpellInfo(), SPELLMOD_RESIST_DISPEL_CHANCE, resistChance);
+ modOwner->ApplySpellMod(GetSpellInfo(), SpellModOp::DispelResistance, resistChance);
RoundToInterval(resistChance, 0, 100);
return 100 - resistChance;
@@ -1656,7 +1656,12 @@ void Aura::PrepareProcToTrigger(AuraApplication* aurApp, ProcEventInfo& eventInf
}
// cooldowns should be added to the whole aura (see 51698 area aura)
- AddProcCooldown(now + procEntry->Cooldown);
+ int32 procCooldown = procEntry->Cooldown.count();
+ if (Unit* caster = GetCaster())
+ if (Player* modOwner = caster->GetSpellModOwner())
+ modOwner->ApplySpellMod(GetSpellInfo(), SpellModOp::ProcCooldown, procCooldown);
+
+ AddProcCooldown(now + Milliseconds(procCooldown));
SetLastProcSuccessTime(now);
}
@@ -1801,7 +1806,7 @@ float Aura::CalcProcChance(SpellProcEntry const& procEntry, ProcEventInfo& event
// apply chance modifer aura, applies also to ppm chance (see improved judgement of light spell)
if (Player* modOwner = caster->GetSpellModOwner())
- modOwner->ApplySpellMod(GetSpellInfo(), SPELLMOD_CHANCE_OF_SUCCESS, chance);
+ modOwner->ApplySpellMod(GetSpellInfo(), SpellModOp::ProcChance, chance);
}
// proc chance is reduced by an additional 3.333% per level past 60
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index a57811aee0c..2458f505fde 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -550,7 +550,7 @@ m_spellValue(new SpellValue(m_spellInfo, caster)), _spellEvent(nullptr)
m_spellSchoolMask = SpellSchoolMask(1 << pItem->GetTemplate()->GetDamageType());
if (Player const* modOwner = caster->GetSpellModOwner())
- modOwner->ApplySpellMod(info, SPELLMOD_STACK_AMOUNT, m_spellValue->AuraStackAmount, this);
+ modOwner->ApplySpellMod(info, SpellModOp::Doses, m_spellValue->AuraStackAmount, this);
if (!originalCasterGUID.IsEmpty())
m_originalCasterGUID = originalCasterGUID;
@@ -1583,7 +1583,7 @@ void Spell::SelectImplicitChainTargets(SpellEffIndex effIndex, SpellImplicitTarg
uint32 maxTargets = effect->ChainTargets;
if (Player* modOwner = m_caster->GetSpellModOwner())
- modOwner->ApplySpellMod(m_spellInfo, SPELLMOD_JUMP_TARGETS, maxTargets, this);
+ modOwner->ApplySpellMod(m_spellInfo, SpellModOp::ChainTargets, maxTargets, this);
if (maxTargets > 1)
{
@@ -1901,7 +1901,7 @@ void Spell::SearchChainTargets(std::list<WorldObject*>& targets, uint32 chainTar
}
if (Player* modOwner = m_caster->GetSpellModOwner())
- modOwner->ApplySpellMod(m_spellInfo, SPELLMOD_JUMP_DISTANCE, jumpRadius, this);
+ modOwner->ApplySpellMod(m_spellInfo, SpellModOp::ChainJumpDistance, jumpRadius, this);
// chain lightning/heal spells and similar - allow to jump at larger distance and go out of los
bool isBouncingFar = (m_spellInfo->HasAttribute(SPELL_ATTR4_AREA_TARGET_CHAIN)
@@ -2870,7 +2870,7 @@ bool Spell::UpdateChanneledTargetList()
{
range = m_spellInfo->GetMaxRange(IsPositive());
if (Player* modOwner = m_caster->GetSpellModOwner())
- modOwner->ApplySpellMod(m_spellInfo, SPELLMOD_RANGE, range, this);
+ modOwner->ApplySpellMod(m_spellInfo, SpellModOp::Range, range, this);
// add little tolerance level
range += std::min(MAX_SPELL_RANGE_TOLERANCE, range*0.1f); // 10% but no more than MAX_SPELL_RANGE_TOLERANCE
@@ -3406,7 +3406,7 @@ void Spell::handle_immediate()
// First mod_duration then haste - see Missile Barrage
// Apply duration mod
if (Player* modOwner = m_caster->GetSpellModOwner())
- modOwner->ApplySpellMod(m_spellInfo, SPELLMOD_DURATION, duration);
+ modOwner->ApplySpellMod(m_spellInfo, SpellModOp::Duration, duration);
// Apply haste mods
m_caster->ModSpellDurationTime(m_spellInfo, duration, this);
@@ -4653,7 +4653,7 @@ void Spell::TakePower()
hit = false;
//lower spell cost on fail (by talent aura)
if (Player* modOwner = m_caster->ToPlayer()->GetSpellModOwner())
- modOwner->ApplySpellMod(m_spellInfo, SPELLMOD_SPELL_COST_REFUND_ON_FAIL, cost.Amount);
+ modOwner->ApplySpellMod(m_spellInfo, SpellModOp::PowerCostOnMiss, cost.Amount);
}
break;
}
@@ -6287,7 +6287,7 @@ std::pair<float, float> Spell::GetMinMaxRange(bool strict) const
maxRange *= ranged->GetTemplate()->GetRangedModRange() * 0.01f;
if (Player* modOwner = m_caster->GetSpellModOwner())
- modOwner->ApplySpellMod(m_spellInfo, SPELLMOD_RANGE, maxRange, const_cast<Spell*>(this));
+ modOwner->ApplySpellMod(m_spellInfo, SpellModOp::Range, maxRange, const_cast<Spell*>(this));
maxRange += rangeMod;
@@ -6888,7 +6888,7 @@ void Spell::Delayed() // only called in DealDamage()
//check pushback reduce
int32 delaytime = 500; // spellcasting delay is normally 500ms
int32 delayReduce = 100; // must be initialized to 100 for percent modifiers
- m_caster->ToPlayer()->ApplySpellMod(m_spellInfo, SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this);
+ m_caster->ToPlayer()->ApplySpellMod(m_spellInfo, SpellModOp::ResistPushback, delayReduce, this);
delayReduce += m_caster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100;
if (delayReduce >= 100)
return;
@@ -6926,7 +6926,7 @@ void Spell::DelayedChannel()
int32 delaytime = CalculatePct(duration, 25); // channeling delay is normally 25% of its time per hit
int32 delayReduce = 100; // must be initialized to 100 for percent modifiers
- m_caster->ToPlayer()->ApplySpellMod(m_spellInfo, SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this);
+ m_caster->ToPlayer()->ApplySpellMod(m_spellInfo, SpellModOp::ResistPushback, delayReduce, this);
delayReduce += m_caster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100;
if (delayReduce >= 100)
return;
@@ -7846,7 +7846,7 @@ void Spell::TriggerGlobalCooldown()
{
// gcd modifier auras are applied only to own spells and only players have such mods
if (Player* modOwner = m_caster->GetSpellModOwner())
- modOwner->ApplySpellMod(m_spellInfo, SPELLMOD_GLOBAL_COOLDOWN, gcd, this);
+ modOwner->ApplySpellMod(m_spellInfo, SpellModOp::StartCooldown, gcd, this);
bool isMeleeOrRangedSpell = m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE ||
m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED ||
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 0d3adf2ec1b..a27ff470485 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -2910,7 +2910,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
uint32 eff_damage(std::max(weaponDamage, 0));
// Add melee damage bonuses (also check for negative)
- uint32 damageBonusDone = m_caster->MeleeDamageBonusDone(unitTarget, eff_damage, m_attackType, m_spellInfo);
+ uint32 damageBonusDone = m_caster->MeleeDamageBonusDone(unitTarget, eff_damage, m_attackType, SPELL_DIRECT_DAMAGE, m_spellInfo);
m_damage += unitTarget->MeleeDamageBonusTaken(m_caster, damageBonusDone, m_attackType, SPELL_DIRECT_DAMAGE, m_spellInfo);
}
diff --git a/src/server/game/Spells/SpellHistory.cpp b/src/server/game/Spells/SpellHistory.cpp
index 3e374d9c0e8..e5e48812d2a 100644
--- a/src/server/game/Spells/SpellHistory.cpp
+++ b/src/server/game/Spells/SpellHistory.cpp
@@ -425,10 +425,10 @@ void SpellHistory::StartCooldown(SpellInfo const* spellInfo, uint32 itemId, Spel
if (Player* modOwner = _owner->GetSpellModOwner())
{
if (cooldown >= 0)
- modOwner->ApplySpellMod(spellInfo, SPELLMOD_COOLDOWN, cooldown, spell);
+ modOwner->ApplySpellMod(spellInfo, SpellModOp::Cooldown, cooldown, spell);
if (categoryCooldown >= 0 && !spellInfo->HasAttribute(SPELL_ATTR6_IGNORE_CATEGORY_COOLDOWN_MODS))
- modOwner->ApplySpellMod(spellInfo, SPELLMOD_COOLDOWN, categoryCooldown, spell);
+ modOwner->ApplySpellMod(spellInfo, SpellModOp::Cooldown, categoryCooldown, spell);
}
if (_owner->HasAuraTypeWithAffectMask(SPELL_AURA_MOD_SPELL_COOLDOWN_BY_HASTE, spellInfo))
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index 38ec721e822..1ecc9986355 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -614,7 +614,7 @@ float SpellEffectInfo::CalcValueMultiplier(Unit* caster, Spell* spell) const
{
float multiplier = Amplitude;
if (Player* modOwner = (caster ? caster->GetSpellModOwner() : nullptr))
- modOwner->ApplySpellMod(_spellInfo, SPELLMOD_VALUE_MULTIPLIER, multiplier, spell);
+ modOwner->ApplySpellMod(_spellInfo, SpellModOp::Amplitude, multiplier, spell);
return multiplier;
}
@@ -622,7 +622,7 @@ float SpellEffectInfo::CalcDamageMultiplier(Unit* caster, Spell* spell) const
{
float multiplierPercent = ChainAmplitude * 100.0f;
if (Player* modOwner = (caster ? caster->GetSpellModOwner() : nullptr))
- modOwner->ApplySpellMod(_spellInfo, SPELLMOD_DAMAGE_MULTIPLIER, multiplierPercent, spell);
+ modOwner->ApplySpellMod(_spellInfo, SpellModOp::ChainAmplitude, multiplierPercent, spell);
return multiplierPercent / 100.0f;
}
@@ -656,7 +656,7 @@ float SpellEffectInfo::CalcRadius(Unit* caster, Spell* spell) const
radius += entry->RadiusPerLevel * caster->getLevel();
radius = std::min(radius, entry->RadiusMax);
if (Player* modOwner = caster->GetSpellModOwner())
- modOwner->ApplySpellMod(_spellInfo, SPELLMOD_RADIUS, radius, spell);
+ modOwner->ApplySpellMod(_spellInfo, SpellModOp::Radius, radius, spell);
}
return radius;
@@ -3672,7 +3672,7 @@ float SpellInfo::GetMaxRange(bool positive, Unit* caster, Spell* spell) const
float range = RangeEntry->RangeMax[positive ? 1 : 0];
if (caster)
if (Player* modOwner = caster->GetSpellModOwner())
- modOwner->ApplySpellMod(this, SPELLMOD_RANGE, range, spell);
+ modOwner->ApplySpellMod(this, SpellModOp::Range, range, spell);
return range;
}
@@ -3683,7 +3683,7 @@ int32 SpellInfo::CalcDuration(Unit* caster /*= nullptr*/) const
if (caster)
if (Player* modOwner = caster->GetSpellModOwner())
- modOwner->ApplySpellMod(this, SPELLMOD_DURATION, duration);
+ modOwner->ApplySpellMod(this, SpellModOp::Duration, duration);
return duration;
}
@@ -3910,13 +3910,13 @@ Optional<SpellPowerCost> SpellInfo::CalcPowerCost(SpellPowerEntry const* power,
switch (power->OrderIndex)
{
case 0:
- mod = SPELLMOD_COST;
+ mod = SpellModOp::PowerCost0;
break;
case 1:
- mod = SPELLMOD_SPELL_COST2;
+ mod = SpellModOp::PowerCost1;
break;
case 2:
- mod = SPELLMOD_SPELL_COST3;
+ mod = SpellModOp::PowerCost2;
break;
default:
break;
@@ -4493,9 +4493,11 @@ bool SpellInfo::_IsPositiveEffect(uint32 effIndex, bool deep) const
case SPELL_AURA_ADD_PCT_MODIFIER:
{
// non-positive mods
- switch (effect->MiscValue)
+ switch (SpellModOp(effect->MiscValue))
{
- case SPELLMOD_COST: // dependent from bas point sign (negative -> positive)
+ case SpellModOp::PowerCost0: // dependent from bas point sign (negative -> positive)
+ case SpellModOp::PowerCost1:
+ case SpellModOp::PowerCost2:
if (effect->CalcValue() > 0)
{
if (!deep)
diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp
index c46909bdf13..f194156c321 100644
--- a/src/server/scripts/Spells/spell_druid.cpp
+++ b/src/server/scripts/Spells/spell_druid.cpp
@@ -516,7 +516,7 @@ public:
if (!spellMod)
{
spellMod = new SpellModifier(GetAura());
- spellMod->op = SPELLMOD_DOT;
+ spellMod->op = SpellModOp::PeriodicHealingAndDamage;
spellMod->type = SPELLMOD_FLAT;
spellMod->spellId = GetId();
spellMod->mask = aurEff->GetSpellEffectInfo()->SpellClassMask;
diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp
index 4f401a5823b..5ff9aa3145b 100644
--- a/src/server/scripts/Spells/spell_warlock.cpp
+++ b/src/server/scripts/Spells/spell_warlock.cpp
@@ -373,7 +373,7 @@ class spell_warl_health_funnel : public SpellScriptLoader
uint32 damage = caster->CountPctFromMaxHealth(aurEff->GetBaseAmount());
if (Player* modOwner = caster->GetSpellModOwner())
- modOwner->ApplySpellMod(GetSpellInfo(), SPELLMOD_COST, damage);
+ modOwner->ApplySpellMod(GetSpellInfo(), SpellModOp::PowerCost0, damage);
SpellNonMeleeDamage damageInfo(caster, caster, GetSpellInfo(), GetAura()->GetSpellVisual(), GetSpellInfo()->SchoolMask, GetAura()->GetCastGUID());
damageInfo.periodicLog = true;
diff --git a/src/server/scripts/World/duel_reset.cpp b/src/server/scripts/World/duel_reset.cpp
index 5ddd5f7a081..947d705cc80 100644
--- a/src/server/scripts/World/duel_reset.cpp
+++ b/src/server/scripts/World/duel_reset.cpp
@@ -98,13 +98,13 @@ class DuelResetScript : public PlayerScript
int32 totalCooldown = spellInfo->RecoveryTime;
int32 categoryCooldown = spellInfo->CategoryRecoveryTime;
- player->ApplySpellMod(spellInfo, SPELLMOD_COOLDOWN, totalCooldown, nullptr);
+ player->ApplySpellMod(spellInfo, SpellModOp::Cooldown, totalCooldown, nullptr);
if (int32 cooldownMod = player->GetTotalAuraModifier(SPELL_AURA_MOD_COOLDOWN))
totalCooldown += cooldownMod * IN_MILLISECONDS;
if (!spellInfo->HasAttribute(SPELL_ATTR6_IGNORE_CATEGORY_COOLDOWN_MODS))
- player->ApplySpellMod(spellInfo, SPELLMOD_COOLDOWN, categoryCooldown, nullptr);
+ player->ApplySpellMod(spellInfo, SpellModOp::Cooldown, categoryCooldown, nullptr);
return remainingCooldown > 0
&& !itr->second.OnHold