Core/Spells: ported SpellModOp definitions from master branch
This commit is contained in:
1 parent
3de0b005d5
commit
ef3632109d
20 files changed
+179
-229
No files matched your search
@@ -0,0 +1 @@
|
||||
DELETE FROM `spell_script_names` WHERE `ScriptName`= 'spell_hun_fire';
|
||||
@@ -53,7 +53,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 = _victimGUID ? ObjectAccessor::GetUnit(*me, _victimGUID) : nullptr;
|
||||
|
||||
@@ -609,7 +609,7 @@ void ThreatManager::ProcessAIUpdates()
|
||||
threat *= threatEntry->pctMod;
|
||||
|
||||
if (Player* modOwner = victim->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(spell->Id, SPELLMOD_THREAT, threat);
|
||||
modOwner->ApplySpellMod(spell->Id, SpellModOp::Hate, threat);
|
||||
}
|
||||
|
||||
// modifiers by effect school
|
||||
|
||||
@@ -2430,17 +2430,17 @@ float WorldObject::ApplyEffectModifiers(SpellInfo const* spellProto, uint8 effec
|
||||
{
|
||||
if (Player* modOwner = GetSpellModOwner())
|
||||
{
|
||||
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_ALL_EFFECTS, value);
|
||||
modOwner->ApplySpellMod(spellProto->Id, SpellModOp::Points, value);
|
||||
switch (effect_index)
|
||||
{
|
||||
case EFFECT_0:
|
||||
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_EFFECT1, value);
|
||||
modOwner->ApplySpellMod(spellProto->Id, SpellModOp::PointsIndex0, value);
|
||||
break;
|
||||
case EFFECT_1:
|
||||
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_EFFECT2, value);
|
||||
modOwner->ApplySpellMod(spellProto->Id, SpellModOp::PointsIndex1, value);
|
||||
break;
|
||||
case EFFECT_2:
|
||||
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_EFFECT3, value);
|
||||
modOwner->ApplySpellMod(spellProto->Id, SpellModOp::PointsIndex2, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2537,7 +2537,7 @@ void WorldObject::ModSpellCastTime(SpellInfo const* spellInfo, int32& castTime,
|
||||
|
||||
// called from caster
|
||||
if (Player* modOwner = GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CASTING_TIME, castTime, spell);
|
||||
modOwner->ApplySpellMod(spellInfo->Id, SpellModOp::ChangeCastTime, castTime, spell);
|
||||
|
||||
Unit const* unitCaster = ToUnit();
|
||||
if (!unitCaster)
|
||||
@@ -2562,7 +2562,7 @@ void WorldObject::ModSpellDurationTime(SpellInfo const* spellInfo, int32& durati
|
||||
|
||||
// called from caster
|
||||
if (Player* modOwner = GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CASTING_TIME, duration, spell);
|
||||
modOwner->ApplySpellMod(spellInfo->Id, SpellModOp::ChangeCastTime, duration, spell);
|
||||
|
||||
Unit const* unitCaster = ToUnit();
|
||||
if (!unitCaster)
|
||||
@@ -2627,9 +2627,9 @@ SpellMissInfo WorldObject::MagicSpellHitResult(Unit* victim, SpellInfo const* sp
|
||||
else
|
||||
modHitChance = 97 - levelBasedHitDiff;
|
||||
|
||||
// Spellmod from SPELLMOD_RESIST_MISS_CHANCE
|
||||
// Spellmod from SpellModOp::HitChance
|
||||
if (Player* modOwner = GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_RESIST_MISS_CHANCE, modHitChance);
|
||||
modOwner->ApplySpellMod(spellInfo->Id, SpellModOp::HitChance, modHitChance);
|
||||
|
||||
// Spells with SPELL_ATTR3_ALWAYS_HIT will ignore target's avoidance effects
|
||||
if (!spellInfo->HasAttribute(SPELL_ATTR3_ALWAYS_HIT))
|
||||
|
||||
@@ -8085,7 +8085,7 @@ void Player::CastItemCombatSpell(DamageInfo const& damageInfo, Item* item, ItemT
|
||||
}
|
||||
|
||||
// Apply spell mods
|
||||
ApplySpellMod(pEnchant->EffectArg[s], SPELLMOD_CHANCE_OF_SUCCESS, chance);
|
||||
ApplySpellMod(pEnchant->EffectArg[s], SpellModOp::ProcChance, chance);
|
||||
|
||||
// Shiv has 100% chance to apply the poison
|
||||
if (FindCurrentSpellBySpellId(5938) && e_slot == TEMP_ENCHANTMENT_SLOT)
|
||||
@@ -21460,7 +21460,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);
|
||||
@@ -21482,10 +21482,10 @@ void Player::ApplySpellMod(uint32 spellId, SpellModOp op, T& basevalue, Spell* s
|
||||
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;
|
||||
@@ -21506,10 +21506,10 @@ void Player::ApplySpellMod(uint32 spellId, SpellModOp op, T& basevalue, Spell* s
|
||||
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;
|
||||
@@ -21533,7 +21533,7 @@ void Player::ApplySpellMod(uint32 spellId, SpellModOp op, T& basevalue, Spell* s
|
||||
break;
|
||||
}
|
||||
|
||||
for (SpellModifier* mod : m_spellMods[op][SPELLMOD_FLAT])
|
||||
for (SpellModifier* mod : m_spellMods[AsUnderlyingType(op)][SPELLMOD_FLAT])
|
||||
{
|
||||
if (!IsAffectedBySpellmod(spellInfo, mod, spell))
|
||||
continue;
|
||||
@@ -21545,7 +21545,7 @@ void Player::ApplySpellMod(uint32 spellId, SpellModOp op, T& basevalue, Spell* s
|
||||
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;
|
||||
@@ -21558,7 +21558,7 @@ void Player::ApplySpellMod(uint32 spellId, SpellModOp op, T& basevalue, Spell* s
|
||||
continue;
|
||||
|
||||
// special case (skip > 10sec spell casts for instant cast setting)
|
||||
if (mod->op == SPELLMOD_CASTING_TIME && basevalue >= T(10000) && mod->value <= -100)
|
||||
if (mod->op == SpellModOp::ChangeCastTime && basevalue >= T(10000) && mod->value <= -100)
|
||||
continue;
|
||||
|
||||
totalmul *= 1.0f + CalculatePct(1.0f, mod->value);
|
||||
@@ -21578,9 +21578,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())
|
||||
@@ -21593,7 +21593,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 (uint8 eff = 0; eff < 96; ++eff)
|
||||
{
|
||||
@@ -21606,16 +21606,16 @@ void Player::AddSpellMod(SpellModifier* mod, bool apply)
|
||||
if (mod->type == SPELLMOD_FLAT)
|
||||
{
|
||||
modData.ModifierValue = 0.0f;
|
||||
for (SpellModifier* mod : m_spellMods[mod->op][SPELLMOD_FLAT])
|
||||
if (mod->mask & mask)
|
||||
modData.ModifierValue += mod->value;
|
||||
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* mod : m_spellMods[mod->op][SPELLMOD_PCT])
|
||||
if (mod->mask & mask)
|
||||
modData.ModifierValue *= 1.0f + CalculatePct(1.0f, mod->value);
|
||||
for (SpellModifier* spellMod : m_spellMods[AsUnderlyingType(mod->op)][SPELLMOD_PCT])
|
||||
if (spellMod->mask & mask)
|
||||
modData.ModifierValue *= 1.0f + CalculatePct(1.0f, spellMod->value);
|
||||
}
|
||||
|
||||
modData.ClassIndex = eff;
|
||||
|
||||
@@ -94,7 +94,6 @@ typedef std::deque<Mail*> PlayerMails;
|
||||
#define PLAYER_MAX_DAILY_QUESTS 25
|
||||
#define PLAYER_EXPLORED_ZONES_SIZE 156
|
||||
|
||||
// Note: SPELLMOD_* values is aura types in fact
|
||||
enum SpellModType : uint8
|
||||
{
|
||||
SPELLMOD_FLAT = 0, // SPELL_AURA_ADD_FLAT_MODIFIER
|
||||
@@ -187,7 +186,7 @@ uint32 const ArmorSpecializationIds[MAX_ARMOR_SPECIALIZATION_IDS] = { 86530, 865
|
||||
// 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;
|
||||
|
||||
@@ -1062,7 +1062,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->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
|
||||
modOwner->ApplySpellMod(spellInfo->Id, SpellModOp::CritDamageAndHealing, crit_bonus);
|
||||
damage += crit_bonus;
|
||||
|
||||
// Apply SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE or SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE
|
||||
@@ -1225,7 +1225,7 @@ void Unit::CalculateMeleeDamage(Unit* victim, CalcDamageInfo* damageInfo, Weapon
|
||||
uint32 damage = 0;
|
||||
damage += CalculateDamage(damageInfo->AttackType, false, true);
|
||||
// Add melee damage bonus
|
||||
damage = MeleeDamageBonusDone(damageInfo->Target, damage, damageInfo->AttackType, nullptr, true, SpellSchoolMask(damageInfo->DamageSchoolMask));
|
||||
damage = MeleeDamageBonusDone(damageInfo->Target, damage, damageInfo->AttackType, DIRECT_DAMAGE, nullptr, true, SpellSchoolMask(damageInfo->DamageSchoolMask));
|
||||
damage = damageInfo->Target->MeleeDamageBonusTaken(this, damage, damageInfo->AttackType, nullptr, SpellSchoolMask(damageInfo->DamageSchoolMask));
|
||||
|
||||
// Script Hook For CalculateMeleeDamage -- Allow scripts to change the Damage pre class mitigation calculations
|
||||
@@ -1554,7 +1554,7 @@ static float GetArmorReduction(float armor, uint8 attackerLevel)
|
||||
|
||||
if (spellInfo)
|
||||
if (Player* modOwner = attacker->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_IGNORE_ARMOR, armor);
|
||||
modOwner->ApplySpellMod(spellInfo->Id, SpellModOp::TargetResistance, armor);
|
||||
|
||||
for (AuraEffect const* aurEff : attacker->GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST))
|
||||
{
|
||||
@@ -6354,7 +6354,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
|
||||
if (Player* modOwner = GetSpellModOwner())
|
||||
{
|
||||
spellPowerCoeff *= 100.0f;
|
||||
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, spellPowerCoeff);
|
||||
modOwner->ApplySpellMod(spellProto->Id, SpellModOp::BonusCoefficient, spellPowerCoeff);
|
||||
spellPowerCoeff /= 100.0f;
|
||||
}
|
||||
|
||||
@@ -6365,7 +6365,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
|
||||
|
||||
// apply spellmod to Done damage (flat and pct)
|
||||
if (Player* modOwner = GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, tmpDamage);
|
||||
modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SpellModOp::PeriodicHealingAndDamage : SpellModOp::HealingAndDamage, tmpDamage);
|
||||
|
||||
return uint32(std::max(tmpDamage, 0.0f));
|
||||
}
|
||||
@@ -6722,7 +6722,7 @@ float Unit::SpellCritChanceDone(SpellInfo const* spellInfo, SpellSchoolMask scho
|
||||
// percent done
|
||||
// only players use intelligence for critical chance computations
|
||||
if (Player* modOwner = GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CRITICAL_CHANCE, crit_chance);
|
||||
modOwner->ApplySpellMod(spellInfo->Id, SpellModOp::CritChance, crit_chance);
|
||||
|
||||
return std::max(crit_chance, 0.0f);
|
||||
}
|
||||
@@ -6964,7 +6964,7 @@ float Unit::SpellCritChanceTaken(Unit const* caster, SpellInfo const* spellInfo,
|
||||
{
|
||||
// adds additional damage to critBonus (from talents)
|
||||
if (Player* modOwner = caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
|
||||
modOwner->ApplySpellMod(spellProto->Id, SpellModOp::CritDamageAndHealing, crit_bonus);
|
||||
}
|
||||
|
||||
crit_bonus += damage;
|
||||
@@ -7069,7 +7069,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
|
||||
if (Player* modOwner = GetSpellModOwner())
|
||||
{
|
||||
coeff *= 100.0f;
|
||||
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
|
||||
modOwner->ApplySpellMod(spellProto->Id, SpellModOp::BonusCoefficient, coeff);
|
||||
coeff /= 100.0f;
|
||||
}
|
||||
|
||||
@@ -7094,7 +7094,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
|
||||
|
||||
// apply spellmod to Done amount
|
||||
if (Player* modOwner = GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, heal);
|
||||
modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SpellModOp::PeriodicHealingAndDamage : SpellModOp::HealingAndDamage, heal);
|
||||
|
||||
return uint32(std::max(heal, 0.0f));
|
||||
}
|
||||
@@ -7484,9 +7484,9 @@ bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index, Worl
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType attType, SpellInfo const* spellProto /*= nullptr*/, bool useSpellBonusData /*= true*/, SpellSchoolMask damageSchoolMask /*= SPELL_SCHOOL_MASK_NORMAL*/)
|
||||
uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 damage, WeaponAttackType attType, DamageEffectType damagetype, SpellInfo const* spellProto /*= nullptr*/, bool useSpellBonusData /*= true*/, SpellSchoolMask damageSchoolMask /*= SPELL_SCHOOL_MASK_NORMAL*/)
|
||||
{
|
||||
if (!victim || pdamage == 0)
|
||||
if (!victim || damage == 0)
|
||||
return 0;
|
||||
|
||||
uint32 creatureTypeMask = victim->GetCreatureTypeMask();
|
||||
@@ -7544,23 +7544,20 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
|
||||
if (!(schoolMask & SPELL_SCHOOL_MASK_NORMAL))
|
||||
{
|
||||
// Some spells don't benefit from pct done mods
|
||||
// mods for SPELL_SCHOOL_MASK_NORMAL are already factored in base melee damage calculation
|
||||
if (!spellProto || !spellProto->HasAttribute(SPELL_ATTR6_LIMIT_PCT_DAMAGE_MODS))
|
||||
{
|
||||
// mods for SPELL_SCHOOL_MASK_NORMAL are already factored in base melee damage calculation
|
||||
if (!(spellProto->GetSchoolMask() & SPELL_SCHOOL_MASK_NORMAL))
|
||||
float maxModDamagePercentSchool = 0.0f;
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
float maxModDamagePercentSchool = 0.0f;
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
for (uint32 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
|
||||
if (schoolMask & (1 << i))
|
||||
maxModDamagePercentSchool = std::max(maxModDamagePercentSchool, GetFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT + i));
|
||||
}
|
||||
else
|
||||
maxModDamagePercentSchool = GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, spellProto->GetSchoolMask());
|
||||
|
||||
DoneTotalMod *= maxModDamagePercentSchool;
|
||||
for (uint32 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
|
||||
if (schoolMask & (1 << i))
|
||||
maxModDamagePercentSchool = std::max(maxModDamagePercentSchool, GetFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT + i));
|
||||
}
|
||||
else
|
||||
maxModDamagePercentSchool = GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, spellProto->GetSchoolMask());
|
||||
|
||||
DoneTotalMod *= maxModDamagePercentSchool;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7591,14 +7588,17 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
|
||||
}));
|
||||
}
|
||||
|
||||
// done scripted mod (take it from owner)
|
||||
// Unit* owner = GetOwner() ? GetOwner() : this;
|
||||
// AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
|
||||
float damageF = damage;
|
||||
|
||||
float tmpDamage = float(int32(pdamage) + DoneFlatBenefit) * DoneTotalMod;
|
||||
// apply spellmod to Done damage
|
||||
if (spellProto)
|
||||
if (Player* modOwner = GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SpellModOp::PeriodicHealingAndDamage : SpellModOp::HealingAndDamage, damageF);
|
||||
|
||||
damageF = (damageF + DoneFlatBenefit) * DoneTotalMod;
|
||||
|
||||
// bonus result can be negative
|
||||
return uint32(std::max(tmpDamage, 0.0f));
|
||||
return uint32(std::max(damageF, 0.0f));
|
||||
}
|
||||
|
||||
uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const* spellProto /*= nullptr*/, SpellSchoolMask damageSchoolMask /*= SPELL_SCHOOL_MASK_NORMAL*/)
|
||||
@@ -7779,7 +7779,7 @@ float Unit::GetPPMProcChance(uint32 WeaponSpeed, float PPM, SpellInfo const* spe
|
||||
// Apply chance modifer aura
|
||||
if (spellProto)
|
||||
if (Player* modOwner = GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_PROC_PER_MINUTE, PPM);
|
||||
modOwner->ApplySpellMod(spellProto->Id, SpellModOp::ProcFrequency, PPM);
|
||||
|
||||
return std::floor((WeaponSpeed * PPM) / 600.0f); // result is chance in percents (probability = Speed_in_sec * (PPM / 60))
|
||||
}
|
||||
@@ -12078,11 +12078,11 @@ float Unit::MeleeSpellMissChance(Unit const* victim, WeaponAttackType attType, S
|
||||
if (!spellInfo && haveOffhandWeapon())
|
||||
missChance += 19.f;
|
||||
|
||||
// Spellmod from SPELLMOD_RESIST_MISS_CHANCE
|
||||
// Spellmod from SpellModOp::HitChance
|
||||
float resistMissChance = 100.0f;
|
||||
if (spellInfo)
|
||||
if (Player* modOwner = GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_RESIST_MISS_CHANCE, resistMissChance);
|
||||
modOwner->ApplySpellMod(spellInfo->Id, SpellModOp::HitChance, resistMissChance);
|
||||
|
||||
missChance -= resistMissChance - 100.0f;
|
||||
|
||||
|
||||
@@ -1603,7 +1603,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) const;
|
||||
|
||||
uint32 MeleeDamageBonusDone(Unit* pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const* spellProto = nullptr, bool useSpellBonusData = true, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL);
|
||||
uint32 MeleeDamageBonusDone(Unit* pVictim, uint32 damage, WeaponAttackType attType, DamageEffectType damagetype, SpellInfo const* spellProto = nullptr, bool useSpellBonusData = true, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL);
|
||||
uint32 MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const* spellProto = nullptr, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL);
|
||||
|
||||
bool IsBlockCritical() const;
|
||||
|
||||
@@ -695,7 +695,7 @@ void AuraEffect::CalculatePeriodic(Unit* caster, bool resetPeriodicTimer, bool l
|
||||
{
|
||||
// Apply periodic time mod
|
||||
if (modOwner)
|
||||
modOwner->ApplySpellMod(GetSpellInfo()->Id, SPELLMOD_ACTIVATION_TIME, _period);
|
||||
modOwner->ApplySpellMod(GetSpellInfo()->Id, SpellModOp::Period, _period);
|
||||
|
||||
if (caster)
|
||||
{
|
||||
@@ -856,54 +856,44 @@ 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:
|
||||
{
|
||||
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 (modOp == SPELLMOD_EFFECT3)
|
||||
{
|
||||
if (AuraEffect* aurEff = aura->GetEffect(2))
|
||||
aurEff->RecalculateAmount();
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (recalculateEffectMask.any())
|
||||
{
|
||||
ObjectGuid guid = target->GetGUID();
|
||||
Unit::AuraApplicationMap& auras = target->GetAppliedAuras();
|
||||
for (auto 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))
|
||||
for (size_t i = 0; i < recalculateEffectMask.size(); ++i)
|
||||
if (recalculateEffectMask[i])
|
||||
if (AuraEffect* aurEff = aura->GetEffect(i))
|
||||
aurEff->RecalculateAmount();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AuraEffect::Update(uint32 diff, Unit* caster)
|
||||
|
||||
@@ -881,7 +881,7 @@ int32 Aura::CalcMaxDuration(Unit* caster) const
|
||||
|
||||
// IsPermanent() checks max duration (which we are supposed to calculate here)
|
||||
if (maxDuration != -1 && modOwner)
|
||||
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_DURATION, maxDuration);
|
||||
modOwner->ApplySpellMod(spellInfo->Id, SpellModOp::Duration, maxDuration);
|
||||
|
||||
return maxDuration;
|
||||
}
|
||||
@@ -891,7 +891,7 @@ void Aura::SetDuration(int32 duration, bool withMods)
|
||||
if (withMods)
|
||||
if (Unit* caster = GetCaster())
|
||||
if (Player* modOwner = caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(GetId(), SPELLMOD_DURATION, duration);
|
||||
modOwner->ApplySpellMod(GetId(), SpellModOp::Duration, duration);
|
||||
|
||||
m_duration = duration;
|
||||
SetNeedClientUpdateForTargets();
|
||||
@@ -967,7 +967,7 @@ uint8 Aura::CalcMaxCharges(Unit* caster) const
|
||||
|
||||
if (caster)
|
||||
if (Player* modOwner = caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(GetId(), SPELLMOD_CHARGES, maxProcCharges);
|
||||
modOwner->ApplySpellMod(GetId(), SpellModOp::ProcCharges, maxProcCharges);
|
||||
|
||||
return uint8(maxProcCharges);
|
||||
}
|
||||
@@ -1250,7 +1250,7 @@ int32 Aura::CalcDispelChance(Unit const* auraTarget, bool offensive) const
|
||||
// Apply dispel mod from aura caster
|
||||
if (Unit* caster = GetCaster())
|
||||
if (Player* modOwner = caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(GetId(), SPELLMOD_RESIST_DISPEL_CHANCE, resistChance);
|
||||
modOwner->ApplySpellMod(GetId(), SpellModOp::DispelResistance, resistChance);
|
||||
|
||||
// Dispel resistance from target SPELL_AURA_MOD_DISPEL_RESIST
|
||||
// Only affects offensive dispels
|
||||
@@ -1843,12 +1843,6 @@ void Aura::AddProcCooldown(SpellProcEntry const* procEntry, std::chrono::steady_
|
||||
// cooldowns should be added to the whole aura (see 51698 area aura)
|
||||
int32 procCooldown = procEntry->Cooldown.count();
|
||||
|
||||
/*
|
||||
if (Unit* caster = GetCaster())
|
||||
if (Player* modOwner = caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(GetSpellInfo(), SpellModOp::ProcCooldown, procCooldown);
|
||||
*/
|
||||
|
||||
m_procCooldown = now + Milliseconds(procCooldown);
|
||||
}
|
||||
|
||||
@@ -2042,7 +2036,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(GetId(), SPELLMOD_CHANCE_OF_SUCCESS, chance);
|
||||
modOwner->ApplySpellMod(GetId(), SpellModOp::ProcChance, chance);
|
||||
}
|
||||
|
||||
// proc chance is reduced by an additional 3.333% per level past 60
|
||||
|
||||
@@ -1711,7 +1711,7 @@ void Spell::SelectImplicitChainTargets(SpellEffIndex effIndex, SpellImplicitTarg
|
||||
{
|
||||
uint32 maxTargets = m_spellInfo->Effects[effIndex].ChainTarget;
|
||||
if (Player* modOwner = m_caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_JUMP_TARGETS, maxTargets, this);
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SpellModOp::ChainTargets, maxTargets, this);
|
||||
|
||||
if (maxTargets > 1)
|
||||
{
|
||||
@@ -3154,7 +3154,7 @@ bool Spell::UpdateChanneledTargetList()
|
||||
{
|
||||
range = m_spellInfo->GetMaxRange(IsPositive());
|
||||
if (Player* modOwner = m_caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, 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
|
||||
@@ -3754,7 +3754,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->Id, SPELLMOD_DURATION, duration);
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SpellModOp::Duration, duration);
|
||||
|
||||
// Apply haste mods
|
||||
m_caster->ModSpellDurationTime(m_spellInfo, duration, this);
|
||||
@@ -5157,7 +5157,7 @@ void Spell::TakePower()
|
||||
hit = false;
|
||||
//lower spell cost on fail (by talent aura)
|
||||
if (Player* modOwner = unitCaster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_SPELL_COST_REFUND_ON_FAIL, m_powerCost);
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SpellModOp::PowerCostOnMiss, m_powerCost);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5223,7 +5223,7 @@ SpellCastResult Spell::CheckRuneCost(uint32 runeCostID) const
|
||||
{
|
||||
runeCost[i] = src->RuneCost[i];
|
||||
if (Player* modOwner = m_caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, runeCost[i], const_cast<Spell*>(this));
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SpellModOp::PowerCost0, runeCost[i], const_cast<Spell*>(this));
|
||||
}
|
||||
|
||||
runeCost[RUNE_DEATH] = MAX_RUNES; // calculated later
|
||||
@@ -5265,7 +5265,7 @@ void Spell::TakeRunePower(SpellMissInfo hitInfo)
|
||||
{
|
||||
runeCost[i] = runeCostData->RuneCost[i];
|
||||
if (Player* modOwner = m_caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, runeCost[i], const_cast<Spell*>(this));
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SpellModOp::PowerCost0, runeCost[i], const_cast<Spell*>(this));
|
||||
}
|
||||
|
||||
bool consumeRunes = false;
|
||||
@@ -5348,7 +5348,7 @@ void Spell::TakeRunePower(SpellMissInfo hitInfo)
|
||||
|
||||
// Apply runic power gain modifiers
|
||||
if (Player* modOwner = m_caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, runicPowerGain, const_cast<Spell*>(this));
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SpellModOp::PowerCost0, runicPowerGain, const_cast<Spell*>(this));
|
||||
|
||||
player->ModifyPower(POWER_RUNIC_POWER, std::max(0, runicPowerGain));
|
||||
}
|
||||
@@ -5484,7 +5484,7 @@ void Spell::HandleHolyPower(Player* caster)
|
||||
// The spell did hit the target, apply aura cost mods if there are any.
|
||||
if (hit)
|
||||
{
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, m_powerCost, this);
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SpellModOp::PowerCost0, m_powerCost, this);
|
||||
caster->ModifyPower(POWER_HOLY_POWER, -m_powerCost);
|
||||
}
|
||||
}
|
||||
@@ -6930,7 +6930,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->Id, SPELLMOD_RANGE, maxRange, const_cast<Spell*>(this));
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SpellModOp::Range, maxRange, const_cast<Spell*>(this));
|
||||
|
||||
maxRange += rangeMod;
|
||||
|
||||
@@ -7470,7 +7470,7 @@ void Spell::Delayed() // only called in DealDamage()
|
||||
|
||||
int32 delayReduce = 100; // must be initialized to 100 for percent modifiers
|
||||
if (Player* player = playerCaster->GetSpellModOwner())
|
||||
player->ApplySpellMod(m_spellInfo->Id, SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this);
|
||||
player->ApplySpellMod(m_spellInfo->Id, SpellModOp::ResistPushback, delayReduce, this);
|
||||
delayReduce += playerCaster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100;
|
||||
if (delayReduce >= 100)
|
||||
return;
|
||||
@@ -7511,7 +7511,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
|
||||
if (Player* player = playerCaster->GetSpellModOwner())
|
||||
player->ApplySpellMod(m_spellInfo->Id, SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this);
|
||||
player->ApplySpellMod(m_spellInfo->Id, SpellModOp::ResistPushback, delayReduce, this);
|
||||
delayReduce += playerCaster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100;
|
||||
if (delayReduce >= 100)
|
||||
return;
|
||||
@@ -8478,7 +8478,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->Id, SPELLMOD_GLOBAL_COOLDOWN, gcd, this);
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SpellModOp::StartCooldown, gcd, this);
|
||||
|
||||
// Apply haste rating
|
||||
if (m_spellInfo->StartRecoveryCategory == 133 && m_spellInfo->StartRecoveryTime == 1500 &&
|
||||
|
||||
@@ -103,43 +103,43 @@ enum class SpellAuraInterruptFlags2 : uint32
|
||||
|
||||
DEFINE_ENUM_FLAG(SpellAuraInterruptFlags2);
|
||||
|
||||
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,
|
||||
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,
|
||||
|
||||
MAX_SPELLMOD
|
||||
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
|
||||
};
|
||||
|
||||
#define MAX_SPELLMOD 32
|
||||
|
||||
enum SpellValueMod : uint8
|
||||
{
|
||||
SPELLVALUE_BASE_POINT0,
|
||||
|
||||
@@ -1931,7 +1931,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
|
||||
|
||||
int32 duration = m_spellInfo->GetDuration();
|
||||
if (Player* modOwner = caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DURATION, duration);
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SpellModOp::Duration, duration);
|
||||
|
||||
SummonCreatureExtraArgs extraArgs;
|
||||
extraArgs.SummonProperties = properties;
|
||||
@@ -2921,15 +2921,11 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
|
||||
|
||||
weaponDamage = int32(weaponDamage * totalDamagePercentMod);
|
||||
|
||||
// apply spellmod to Done damage
|
||||
if (Player* modOwner = m_caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DAMAGE, weaponDamage);
|
||||
|
||||
// prevent negative damage
|
||||
weaponDamage = std::max(weaponDamage, 0);
|
||||
|
||||
// Add melee damage bonuses (also check for negative)
|
||||
weaponDamage = unitCaster->MeleeDamageBonusDone(unitTarget, weaponDamage, m_attackType, m_spellInfo, !useWeaponDamage);
|
||||
weaponDamage = unitCaster->MeleeDamageBonusDone(unitTarget, weaponDamage, m_attackType, SPELL_DIRECT_DAMAGE, m_spellInfo, !useWeaponDamage);
|
||||
m_damage += unitTarget->MeleeDamageBonusTaken(unitCaster, weaponDamage, m_attackType, m_spellInfo);
|
||||
}
|
||||
|
||||
|
||||
@@ -303,10 +303,10 @@ void SpellHistory::StartCooldown(SpellInfo const* spellInfo, uint32 itemId, Spel
|
||||
if (Player* modOwner = _owner->GetSpellModOwner())
|
||||
{
|
||||
if (cooldown >= 0)
|
||||
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_COOLDOWN, cooldown, spell);
|
||||
modOwner->ApplySpellMod(spellInfo->Id, SpellModOp::Cooldown, cooldown, spell);
|
||||
|
||||
if (categoryCooldown >= 0 && !spellInfo->HasAttribute(SPELL_ATTR6_IGNORE_CATEGORY_COOLDOWN_MODS))
|
||||
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_COOLDOWN, categoryCooldown, spell);
|
||||
modOwner->ApplySpellMod(spellInfo->Id, SpellModOp::Cooldown, categoryCooldown, spell);
|
||||
}
|
||||
|
||||
if (_owner->HasAuraTypeWithAffectMask(SPELL_AURA_MOD_SPELL_COOLDOWN_BY_HASTE, spellInfo))
|
||||
|
||||
@@ -433,7 +433,7 @@ uint32 SpellEffectInfo::CalcPeriod(WorldObject const* caster, Spell* spell /* =
|
||||
if (caster != nullptr)
|
||||
{
|
||||
if (Player* modOwner = caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(_spellInfo->Id, SPELLMOD_ACTIVATION_TIME, period, spell);
|
||||
modOwner->ApplySpellMod(_spellInfo->Id, SpellModOp::Period, period, spell);
|
||||
|
||||
if (caster->IsUnit() && _spellInfo->HasAttribute(SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC) && !_spellInfo->HasAttribute(SPELL_ATTR3_IGNORE_CASTER_MODIFIERS))
|
||||
period = int32(period * caster->ToUnit()->GetFloatValue(UNIT_MOD_CAST_HASTE));
|
||||
@@ -612,7 +612,7 @@ float SpellEffectInfo::CalcValueMultiplier(WorldObject* caster, Spell* spell) co
|
||||
{
|
||||
float multiplier = Amplitude;
|
||||
if (Player* modOwner = (caster ? caster->GetSpellModOwner() : nullptr))
|
||||
modOwner->ApplySpellMod(_spellInfo->Id, SPELLMOD_VALUE_MULTIPLIER, multiplier, spell);
|
||||
modOwner->ApplySpellMod(_spellInfo->Id, SpellModOp::Amplitude, multiplier, spell);
|
||||
return multiplier;
|
||||
}
|
||||
|
||||
@@ -620,7 +620,7 @@ float SpellEffectInfo::CalcDamageMultiplier(WorldObject* caster, Spell* spell) c
|
||||
{
|
||||
float multiplierPercent = DamageMultiplier * 100.0f;
|
||||
if (Player* modOwner = (caster ? caster->GetSpellModOwner() : nullptr))
|
||||
modOwner->ApplySpellMod(_spellInfo->Id, SPELLMOD_DAMAGE_MULTIPLIER, multiplierPercent, spell);
|
||||
modOwner->ApplySpellMod(_spellInfo->Id, SpellModOp::ChainAmplitude, multiplierPercent, spell);
|
||||
return multiplierPercent / 100.0f;
|
||||
}
|
||||
|
||||
@@ -652,7 +652,7 @@ float SpellEffectInfo::CalcRadius(WorldObject* caster, Spell* spell) const
|
||||
radius = std::min(radius, entry->RadiusMax);
|
||||
|
||||
if (Player* modOwner = caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(_spellInfo->Id, SPELLMOD_RADIUS, radius, spell);
|
||||
modOwner->ApplySpellMod(_spellInfo->Id, SpellModOp::Radius, radius, spell);
|
||||
}
|
||||
|
||||
return radius;
|
||||
@@ -3338,7 +3338,7 @@ float SpellInfo::GetMaxRange(bool positive, WorldObject* caster, Spell* spell) c
|
||||
range = RangeEntry->RangeMax[0];
|
||||
if (caster)
|
||||
if (Player* modOwner = caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(Id, SPELLMOD_RANGE, range, spell);
|
||||
modOwner->ApplySpellMod(Id, SpellModOp::Range, range, spell);
|
||||
return range;
|
||||
}
|
||||
|
||||
@@ -3362,7 +3362,7 @@ int32 SpellInfo::CalcDuration(WorldObject const* caster /*= nullptr*/) const
|
||||
|
||||
if (caster)
|
||||
if (Player* modOwner = caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(Id, SPELLMOD_DURATION, duration);
|
||||
modOwner->ApplySpellMod(Id, SpellModOp::Duration, duration);
|
||||
|
||||
return duration;
|
||||
}
|
||||
@@ -3545,7 +3545,7 @@ int32 SpellInfo::CalcPowerCost(WorldObject const* caster, SpellSchoolMask school
|
||||
|
||||
// Apply cost mod by spell
|
||||
if (Player* modOwner = caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(Id, SPELLMOD_COST, powerCost, spell);
|
||||
modOwner->ApplySpellMod(Id, SpellModOp::PowerCost0, powerCost, spell);
|
||||
|
||||
if (!unitCaster->IsControlledByPlayer())
|
||||
{
|
||||
@@ -4125,32 +4125,32 @@ bool _isPositiveEffectImpl(SpellInfo const* spellInfo, uint8 effIndex, std::unor
|
||||
case SPELL_AURA_ADD_FLAT_MODIFIER: // mods
|
||||
case SPELL_AURA_ADD_PCT_MODIFIER:
|
||||
{
|
||||
switch (spellInfo->Effects[effIndex].MiscValue)
|
||||
switch (SpellModOp(spellInfo->Effects[effIndex].MiscValue))
|
||||
{
|
||||
case SPELLMOD_CASTING_TIME: // dependent from basepoint sign (positive -> negative)
|
||||
case SPELLMOD_ACTIVATION_TIME:
|
||||
case SPELLMOD_SPELL_COST_REFUND_ON_FAIL:
|
||||
case SPELLMOD_GLOBAL_COOLDOWN:
|
||||
case SpellModOp::ChangeCastTime: // dependent from basepoint sign (positive -> negative)
|
||||
case SpellModOp::Period:
|
||||
case SpellModOp::PowerCostOnMiss:
|
||||
case SpellModOp::StartCooldown:
|
||||
if (bp > 0)
|
||||
return false;
|
||||
break;
|
||||
case SPELLMOD_COOLDOWN:
|
||||
case SPELLMOD_COST:
|
||||
case SpellModOp::Cooldown:
|
||||
case SpellModOp::PowerCost0:
|
||||
if (!spellInfo->IsPositive() && bp > 0) // dependent on prev effects too (ex Arcane Power)
|
||||
return false;
|
||||
break;
|
||||
case SPELLMOD_EFFECT1: // always positive
|
||||
case SPELLMOD_EFFECT2:
|
||||
case SPELLMOD_EFFECT3:
|
||||
case SPELLMOD_ALL_EFFECTS:
|
||||
case SPELLMOD_THREAT:
|
||||
case SPELLMOD_DAMAGE_MULTIPLIER:
|
||||
case SPELLMOD_VALUE_MULTIPLIER:
|
||||
case SpellModOp::PointsIndex0: // always positive
|
||||
case SpellModOp::PointsIndex1:
|
||||
case SpellModOp::PointsIndex2:
|
||||
case SpellModOp::Points:
|
||||
case SpellModOp::Hate:
|
||||
case SpellModOp::ChainAmplitude:
|
||||
case SpellModOp::Amplitude:
|
||||
return true;
|
||||
case SPELLMOD_DURATION:
|
||||
case SPELLMOD_CRITICAL_CHANCE:
|
||||
case SPELLMOD_DAMAGE:
|
||||
case SPELLMOD_JUMP_TARGETS:
|
||||
case SpellModOp::Duration:
|
||||
case SpellModOp::CritChance:
|
||||
case SpellModOp::HealingAndDamage:
|
||||
case SpellModOp::ChainTargets:
|
||||
if (!spellInfo->IsPositive() && bp < 0) // dependent on prev effects too
|
||||
return false;
|
||||
break;
|
||||
|
||||
@@ -549,7 +549,7 @@ class spell_dru_idol_lifebloom : public AuraScript
|
||||
if (!spellMod)
|
||||
{
|
||||
spellMod = new SpellModifier(GetAura());
|
||||
spellMod->op = SPELLMOD_DOT;
|
||||
spellMod->op = SpellModOp::PeriodicHealingAndDamage;
|
||||
spellMod->type = SPELLMOD_FLAT;
|
||||
spellMod->spellId = GetId();
|
||||
spellMod->mask = GetSpellInfo()->Effects[aurEff->GetEffIndex()].SpellClassMask;
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
enum HunterSpells
|
||||
{
|
||||
SPELL_HUNTER_AIMED_SHOT = 19434,
|
||||
SPELL_HUNTER_AIMED_SHOT_INSTANT = 82928,
|
||||
SPELL_HUNTER_BESTIAL_WRATH = 19574,
|
||||
SPELL_HUNTER_CALL_PET_1 = 883,
|
||||
SPELL_HUNTER_CALL_PET_2 = 83242,
|
||||
@@ -242,34 +241,6 @@ class spell_hun_disengage : public SpellScript
|
||||
}
|
||||
};
|
||||
|
||||
// 82926 - Fire!
|
||||
class spell_hun_fire : public AuraScript
|
||||
{
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_HUNTER_AIMED_SHOT_INSTANT });
|
||||
}
|
||||
|
||||
void HandleEffectCalcSpellMod(AuraEffect const* aurEff, SpellModifier*& spellMod)
|
||||
{
|
||||
if (!spellMod)
|
||||
{
|
||||
spellMod = new SpellModifier(GetAura());
|
||||
spellMod->op = SPELLMOD_CASTING_TIME;
|
||||
spellMod->type = SPELLMOD_PCT;
|
||||
spellMod->spellId = GetId();
|
||||
spellMod->mask = GetSpellInfo()->Effects[aurEff->GetEffIndex()].SpellClassMask;
|
||||
}
|
||||
|
||||
spellMod->value = -aurEff->GetAmount();
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
DoEffectCalcSpellMod.Register(&spell_hun_fire::HandleEffectCalcSpellMod, EFFECT_0, SPELL_AURA_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
// -19572 - Improved Mend Pet
|
||||
class spell_hun_improved_mend_pet : public AuraScript
|
||||
{
|
||||
@@ -1477,7 +1448,6 @@ void AddSC_hunter_spell_scripts()
|
||||
RegisterSpellScript(spell_hun_crouching_tiger_hidden_chimera);
|
||||
RegisterSpellScript(spell_hun_disengage);
|
||||
RegisterSpellScript(spell_hun_fervor);
|
||||
RegisterSpellScript(spell_hun_fire);
|
||||
RegisterSpellAndAuraScriptPair(spell_hun_focus_fire, spell_hun_focus_fire_AuraScript);
|
||||
RegisterSpellScript(spell_hun_frenzy_effect);
|
||||
RegisterSpellScript(spell_hun_glyph_of_kill_shot);
|
||||
|
||||
@@ -426,7 +426,7 @@ class spell_pal_exorcism_and_holy_wrath_damage : public AuraScript
|
||||
if (!spellMod)
|
||||
{
|
||||
spellMod = new SpellModifier(aurEff->GetBase());
|
||||
spellMod->op = SPELLMOD_DAMAGE;
|
||||
spellMod->op = SpellModOp::HealingAndDamage;
|
||||
spellMod->type = SPELLMOD_FLAT;
|
||||
spellMod->spellId = GetId();
|
||||
spellMod->mask[1] = 0x200002;
|
||||
|
||||
@@ -611,7 +611,7 @@ class spell_warl_health_funnel : public AuraScript
|
||||
uint32 damage = caster->CountPctFromMaxHealth(aurEff->GetBaseAmount());
|
||||
|
||||
if (Player* modOwner = caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(GetId(), SPELLMOD_COST, damage);
|
||||
modOwner->ApplySpellMod(GetId(), SpellModOp::PowerCost0, damage);
|
||||
|
||||
SpellNonMeleeDamage damageInfo(caster, caster, GetSpellInfo()->Id, GetSpellInfo()->SchoolMask);
|
||||
damageInfo.damage = damage;
|
||||
|
||||
@@ -733,7 +733,7 @@ class spell_warr_victory_rush : public SpellScript
|
||||
|
||||
// Glyph: Victory Rush
|
||||
if (Player* modOwner = caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(m_scriptSpellId, SPELLMOD_EFFECT3, damage);
|
||||
modOwner->ApplySpellMod(m_scriptSpellId, SpellModOp::PointsIndex2, damage);
|
||||
|
||||
SetEffectValue(damage);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user