aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Commands
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2018-01-13 06:45:21 -0300
committerariel- <ariel-@users.noreply.github.com>2018-01-13 06:45:21 -0300
commitcb9e72e521d3cc415dd15bf6912c87f89e41b92a (patch)
treebe9e692f0ddf9f080f923c7396de19e4ca869c6f /src/server/scripts/Commands
parent1c60af632888433b29a27bee76e82e96632d4096 (diff)
Core/Auras: removed caster dependency from core
- Decoupled Unit logic: split of spell critical chance into done (caster bonuses) and taken (target bonuses), this allows to precalculate caster bonuses on aura apply and then check victim's auras on damage/healing calc - Made static a bunch of methods (they no longer have this pointer because they are now called from periodic handlers which may or may not have an active caster in world) - Simplified all AuraEffect bonuses into AuraEffect::_amount, no more duplicated code - Critical chance and whether or not caster is player owned unit (for resilience calcs) is now saved one level upper, on Aura itself (it's impossible as of 3.3.5 to have different effects with different critical chances) - Minor cleanup of SPELL_DAMAGE_CLASS_NONE and Arcane Potency (#18813) crit handling Closes #19876
Diffstat (limited to 'src/server/scripts/Commands')
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index f61400c6b4b..aa6f1c7b5f3 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -634,9 +634,9 @@ public:
if (target->IsAlive())
{
if (sWorld->getBoolConfig(CONFIG_DIE_COMMAND_MODE))
- handler->GetSession()->GetPlayer()->Kill(target);
+ Unit::Kill(handler->GetSession()->GetPlayer(), target);
else
- handler->GetSession()->GetPlayer()->DealDamage(target, target->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
+ Unit::DealDamage(handler->GetSession()->GetPlayer(), target, target->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
}
return true;
@@ -2334,7 +2334,7 @@ public:
// flat melee damage without resistence/etc reduction
if (!schoolStr)
{
- handler->GetSession()->GetPlayer()->DealDamage(target, damage, nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
+ Unit::DealDamage(handler->GetSession()->GetPlayer(), target, damage, nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
if (target != handler->GetSession()->GetPlayer())
handler->GetSession()->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_HIT, 0);
return true;
@@ -2347,7 +2347,7 @@ public:
SpellSchoolMask schoolmask = SpellSchoolMask(1 << school);
if (Unit::IsDamageReducedByArmor(schoolmask))
- damage = handler->GetSession()->GetPlayer()->CalcArmorReducedDamage(target, damage, nullptr, BASE_ATTACK);
+ damage = Unit::CalcArmorReducedDamage(handler->GetSession()->GetPlayer(), target, damage, nullptr, BASE_ATTACK);
char* spellStr = strtok((char*)nullptr, " ");
@@ -2356,7 +2356,7 @@ public:
{
Player* attacker = handler->GetSession()->GetPlayer();
DamageInfo dmgInfo(attacker, target, damage, nullptr, schoolmask, SPELL_DIRECT_DAMAGE, BASE_ATTACK);
- attacker->CalcAbsorbResist(dmgInfo);
+ Unit::CalcAbsorbResist(dmgInfo);
if (!dmgInfo.GetDamage())
return true;
@@ -2365,8 +2365,8 @@ public:
uint32 absorb = dmgInfo.GetAbsorb();
uint32 resist = dmgInfo.GetResist();
- attacker->DealDamageMods(target, damage, &absorb);
- attacker->DealDamage(target, damage, nullptr, DIRECT_DAMAGE, schoolmask, nullptr, false);
+ Unit::DealDamageMods(target, damage, &absorb);
+ Unit::DealDamage(attacker, target, damage, nullptr, DIRECT_DAMAGE, schoolmask, nullptr, false);
attacker->SendAttackStateUpdate(HITINFO_AFFECTS_VICTIM, target, 0, schoolmask, damage, absorb, resist, VICTIMSTATE_HIT, 0);
return true;
}
@@ -2384,11 +2384,11 @@ public:
Player* attacker = handler->GetSession()->GetPlayer();
SpellNonMeleeDamage dmgInfo(attacker, target, spellid, spellInfo->GetSchoolMask());
- damage = attacker->SpellDamageBonusDone(target, spellInfo, damage, SPELL_DIRECT_DAMAGE);
+ damage = attacker->SpellDamageBonusDone(target, spellInfo, damage, SPELL_DIRECT_DAMAGE, { });
damage = target->SpellDamageBonusTaken(attacker, spellInfo, damage, SPELL_DIRECT_DAMAGE);
attacker->CalculateSpellDamageTaken(&dmgInfo, damage, spellInfo);
- attacker->DealDamageMods(dmgInfo.target, dmgInfo.damage, &dmgInfo.absorb);
+ Unit::DealDamageMods(dmgInfo.target, dmgInfo.damage, &dmgInfo.absorb);
attacker->SendSpellNonMeleeDamageLog(&dmgInfo);
attacker->DealSpellDamage(&dmgInfo, true);
return true;