Core/Units: refactor rage generation to reflect patch 4.0.1 changes:

* melee attacks will now send their awarded rage within SMSG_ATTACKER_STATE_UPDATE and moved the rage reward mechnic from Unit::DealDamage into Unit::AttackerStateUpdate

* killed CleanDamage struct and provide plain unmitigated damage values instead as since patch 4.0.1 the rage gained from damage taken is fully normalized and ignores any kind of damage reduction or negation
This commit is contained in:
Ovahlord committed 2023-12-10 18:26:24 +01:00
1 parent 4f309c127a
commit 0f035fe940
11 files changed
+76 -92

No files matched your search

+1 -1
View File
@@ -710,7 +710,7 @@ uint32 Player::EnvironmentalDamage(EnviromentalDamage type, uint32 damage)
environmentalDamageLog.Resisted = resist;
SendMessageToSet(environmentalDamageLog.Write(), true);
uint32 final_damage = Unit::DealDamage(this, this, damage, nullptr, SELF_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
uint32 final_damage = Unit::DealDamage(this, this, damage, 0, SELF_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
if (!IsAlive())
{
+53 -56
View File
@@ -727,7 +727,7 @@ bool Unit::HasBreakableByDamageCrowdControlAura(Unit* excludeCasterChannel) cons
}
}
/*static*/ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellInfo const* spellProto, bool durabilityLoss)
/*static*/ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, uint32 unmitigatedDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellInfo const* spellProto, bool durabilityLoss)
{
// Sparring Checks
if (Creature* target = victim->ToCreature())
@@ -801,30 +801,7 @@ bool Unit::HasBreakableByDamageCrowdControlAura(Unit* excludeCasterChannel) cons
/// @todo check packets if damage is done by victim, or by attacker of victim
Unit::DealDamageMods(shareDamageTarget, share, nullptr);
Unit::DealDamage(attacker, shareDamageTarget, share, nullptr, NODAMAGE, spell->GetSchoolMask(), spell, false);
}
}
// Rage from Damage made (only from direct weapon damage)
if (attacker && cleanDamage && damagetype == DIRECT_DAMAGE && attacker != victim && attacker->GetPowerType() == POWER_RAGE)
{
uint32 rage = uint32((float)attacker->GetAttackTime(cleanDamage->attackType) / 1000 * 6.5f);
// Sentinel
if (victim->GetVictim() && victim->GetVictim() != attacker)
if (AuraEffect* aurEff = attacker->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_GENERIC, 1916, EFFECT_1))
rage += CalculatePct(rage, aurEff->GetAmount());
switch (cleanDamage->attackType)
{
case OFF_ATTACK:
rage /= 2;
[[fallthrough]];
case BASE_ATTACK:
attacker->RewardRage(rage, true);
break;
default:
break;
Unit::DealDamage(attacker, shareDamageTarget, share, 0, NODAMAGE, spell->GetSchoolMask(), spell, false);
}
}
@@ -930,7 +907,7 @@ bool Unit::HasBreakableByDamageCrowdControlAura(Unit* excludeCasterChannel) cons
// Rage from damage received
if (attacker != victim && victim->GetPowerType() == POWER_RAGE)
{
uint32 rageBaseReward = damage + (cleanDamage ? cleanDamage->absorbed_damage + cleanDamage->mitigated_damage : 0);
uint32 rageBaseReward = std::max(damage, unmitigatedDamage);
victim->RewardRage(rageBaseReward, false);
}
@@ -1148,8 +1125,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage* damageInfo, bool durabilityLoss)
}
// Call default DealDamage
CleanDamage cleanDamage(damageInfo->cleanDamage, damageInfo->absorb, BASE_ATTACK, MELEE_HIT_NORMAL);
Unit::DealDamage(this, victim, damageInfo->damage, &cleanDamage, SPELL_DIRECT_DAMAGE, SpellSchoolMask(damageInfo->schoolMask), spellProto, durabilityLoss);
Unit::DealDamage(this, victim, damageInfo->damage, damageInfo->unmitigatedDamage, SPELL_DIRECT_DAMAGE, SpellSchoolMask(damageInfo->schoolMask), spellProto, durabilityLoss);
}
/// @todo for melee need create structure as in
@@ -1171,8 +1147,9 @@ void Unit::CalculateMeleeDamage(Unit* victim, CalcDamageInfo* damageInfo, Weapon
damageInfo->AttackType = attackType;
damageInfo->ProcAttacker = PROC_FLAG_NONE;
damageInfo->ProcVictim = PROC_FLAG_NONE;
damageInfo->CleanDamage = 0;
damageInfo->UnmitigatedDamage = 0;
damageInfo->HitOutCome = MELEE_HIT_EVADE;
damageInfo->RageGained = 0;
if (!victim)
return;
@@ -1203,7 +1180,7 @@ void Unit::CalculateMeleeDamage(Unit* victim, CalcDamageInfo* damageInfo, Weapon
damageInfo->TargetState = VICTIMSTATE_IS_IMMUNE;
damageInfo->Damage = 0;
damageInfo->CleanDamage = 0;
damageInfo->UnmitigatedDamage = 0;
return;
}
@@ -1216,13 +1193,12 @@ void Unit::CalculateMeleeDamage(Unit* victim, CalcDamageInfo* damageInfo, Weapon
// Script Hook For CalculateMeleeDamage -- Allow scripts to change the Damage pre class mitigation calculations
sScriptMgr->ModifyMeleeDamage(damageInfo->Target, damageInfo->Attacker, damage);
// Store unmitigated damage to reward rage later
damageInfo->UnmitigatedDamage = damage;
// Calculate armor reduction
if (Unit::IsDamageReducedByArmor((SpellSchoolMask)(damageInfo->DamageSchoolMask)))
{
damageInfo->Damage = Unit::CalcArmorReducedDamage(damageInfo->Attacker, damageInfo->Target, damage, nullptr, damageInfo->AttackType);
damageInfo->CleanDamage += damage - damageInfo->Damage;
}
else
damageInfo->Damage = damage;
damageInfo->HitOutCome = RollMeleeOutcomeAgainst(damageInfo->Target, damageInfo->AttackType);
@@ -1235,7 +1211,6 @@ void Unit::CalculateMeleeDamage(Unit* victim, CalcDamageInfo* damageInfo, Weapon
damageInfo->OriginalDamage = damageInfo->Damage;
damageInfo->Damage = 0;
damageInfo->CleanDamage = 0;
return;
case MELEE_HIT_MISS:
damageInfo->HitInfo |= HITINFO_MISS;
@@ -1243,7 +1218,7 @@ void Unit::CalculateMeleeDamage(Unit* victim, CalcDamageInfo* damageInfo, Weapon
damageInfo->OriginalDamage = damageInfo->Damage;
damageInfo->Damage = 0;
damageInfo->CleanDamage = 0;
damageInfo->UnmitigatedDamage = 0;
break;
case MELEE_HIT_NORMAL:
damageInfo->TargetState = VICTIMSTATE_HIT;
@@ -1274,15 +1249,11 @@ void Unit::CalculateMeleeDamage(Unit* victim, CalcDamageInfo* damageInfo, Weapon
}
case MELEE_HIT_PARRY:
damageInfo->TargetState = VICTIMSTATE_PARRY;
damageInfo->CleanDamage += damageInfo->Damage;
damageInfo->OriginalDamage = damageInfo->Damage;
damageInfo->Damage = 0;
break;
case MELEE_HIT_DODGE:
damageInfo->TargetState = VICTIMSTATE_DODGE;
damageInfo->CleanDamage += damageInfo->Damage;
damageInfo->OriginalDamage = damageInfo->Damage;
damageInfo->Damage = 0;
break;
@@ -1296,7 +1267,6 @@ void Unit::CalculateMeleeDamage(Unit* victim, CalcDamageInfo* damageInfo, Weapon
damageInfo->OriginalDamage = damageInfo->Damage;
damageInfo->Damage -= damageInfo->Blocked;
damageInfo->CleanDamage += damageInfo->Blocked;
break;
case MELEE_HIT_GLANCING:
{
@@ -1308,7 +1278,6 @@ void Unit::CalculateMeleeDamage(Unit* victim, CalcDamageInfo* damageInfo, Weapon
damageInfo->OriginalDamage = damageInfo->Damage;
float reducePercent = 1.f - leveldif * 0.1f;
damageInfo->CleanDamage += damageInfo->Damage - uint32(reducePercent * damageInfo->Damage);
damageInfo->Damage = uint32(reducePercent * damageInfo->Damage);
break;
}
@@ -1332,7 +1301,6 @@ void Unit::CalculateMeleeDamage(Unit* victim, CalcDamageInfo* damageInfo, Weapon
Unit::ApplyResilience(victim, &resilienceReduction);
resilienceReduction = damageInfo->Damage - resilienceReduction;
damageInfo->Damage -= resilienceReduction;
damageInfo->CleanDamage += resilienceReduction;
// Calculate absorb resist
if (int32(damageInfo->Damage) > 0)
@@ -1397,8 +1365,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
}
// Call default DealDamage
CleanDamage cleanDamage(damageInfo->CleanDamage, damageInfo->Absorb, damageInfo->AttackType, damageInfo->HitOutCome);
Unit::DealDamage(this, victim, damageInfo->Damage, &cleanDamage, DIRECT_DAMAGE, SpellSchoolMask(damageInfo->DamageSchoolMask), nullptr, durabilityLoss);
Unit::DealDamage(this, victim, damageInfo->Damage, damageInfo->UnmitigatedDamage, DIRECT_DAMAGE, SpellSchoolMask(damageInfo->DamageSchoolMask), nullptr, durabilityLoss);
// If this is a creature and it attacks from behind it has a probability to daze it's victim
if ((damageInfo->HitOutCome == MELEE_HIT_CRIT || damageInfo->HitOutCome == MELEE_HIT_CRUSHING || damageInfo->HitOutCome == MELEE_HIT_NORMAL || damageInfo->HitOutCome == MELEE_HIT_GLANCING) &&
@@ -1477,7 +1444,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
damageShield.LogAbsorbed = dmgInfo.GetAbsorb();
victim->SendMessageToSet(damageShield.Write(), true);
Unit::DealDamage(victim, this, damage, nullptr, SPELL_DIRECT_DAMAGE, spellInfo->GetSchoolMask(), spellInfo, true);
Unit::DealDamage(victim, this, damage, 0, SPELL_DIRECT_DAMAGE, spellInfo->GetSchoolMask(), spellInfo, true);
}
}
}
@@ -1861,8 +1828,7 @@ static float GetArmorReduction(float armor, uint8 attackerLevel)
attacker->SendSpellNonMeleeDamageLog(caster, (*itr)->GetSpellInfo()->Id, splitDamage, damageInfo.GetSchoolMask(), split_absorb, 0, damageInfo.GetDamageType() == DOT, 0, false, true);
}
CleanDamage cleanDamage = CleanDamage(splitDamage, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
Unit::DealDamage(damageInfo.GetAttacker(), caster, splitDamage, &cleanDamage, DIRECT_DAMAGE, damageInfo.GetSchoolMask(), (*itr)->GetSpellInfo(), false);
Unit::DealDamage(damageInfo.GetAttacker(), caster, splitDamage, 0, DIRECT_DAMAGE, damageInfo.GetSchoolMask(), (*itr)->GetSpellInfo(), false);
// break 'Fear' and similar auras
Unit::ProcSkillsAndAuras(damageInfo.GetAttacker(), caster, PROC_FLAG_NONE, PROC_FLAG_TAKE_HARMFUL_SPELL, PROC_SPELL_TYPE_DAMAGE, PROC_SPELL_PHASE_HIT, PROC_HIT_NONE, nullptr, &damageInfo, nullptr);
@@ -1933,6 +1899,22 @@ static float GetArmorReduction(float armor, uint8 attackerLevel)
healInfo.AbsorbHeal(absorbAmount);
}
// Calculates the normalized rage amount per weapon swing
inline static uint32 CalcMeleeAttackRageGain(Unit const* attacker, Unit const* victim, WeaponAttackType attType)
{
uint32 rage = uint32((float)attacker->GetAttackTime(attType) / 1000 * 6.5f);
// Sentinel
if (victim->GetVictim() && victim->GetVictim() != attacker)
if (AuraEffect* aurEff = attacker->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_GENERIC, 1916, EFFECT_1))
rage += CalculatePct(rage, aurEff->GetAmount());
if (attType == OFF_ATTACK)
rage *= 0.5f;
return rage;
}
void Unit::AttackerStateUpdate(Unit* victim, WeaponAttackType attType, bool extra)
{
if (HasUnitState(UNIT_STATE_CANNOT_AUTOATTACK) || HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED))
@@ -2004,6 +1986,16 @@ void Unit::AttackerStateUpdate(Unit* victim, WeaponAttackType attType, bool extr
if (target->GetHealthPct() <= target->GetNoNpcDamageBelowPctHealthValue())
damageInfo.HitInfo |= HITINFO_FAKE_DAMAGE;
// Rage reward
if (this != victim && damageInfo.HitOutCome != MELEE_HIT_MISS && GetPowerType() == POWER_RAGE)
{
if (uint32 rageReward = CalcMeleeAttackRageGain(this, victim, attType))
{
damageInfo.HitInfo |= HITINFO_RAGE_GAIN;
damageInfo.RageGained = RewardRage(rageReward, true);
}
}
SendAttackStateUpdate(&damageInfo);
DealMeleeDamage(&damageInfo, true);
@@ -5141,15 +5133,19 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo* damageInfo)
int32 overkill = damageInfo->Damage - damageInfo->Target->GetHealth();
packet.OverDamage = (overkill < 0 ? -1 : overkill);
packet.SubDmg.emplace();
packet.SubDmg->SchoolMask = damageInfo->DamageSchoolMask; // School of sub damage
packet.SubDmg->FDamage = damageInfo->CleanDamage; // sub damage
packet.SubDmg->Damage = damageInfo->CleanDamage; // Sub Damage
packet.SubDmg->Absorbed = damageInfo->Absorb;
packet.SubDmg->Resisted = damageInfo->Resist;
if (damageInfo->Damage)
{
packet.SubDmg.emplace();
packet.SubDmg->SchoolMask = damageInfo->DamageSchoolMask; // School of sub damage
packet.SubDmg->FDamage = damageInfo->Damage; // sub damage
packet.SubDmg->Damage = damageInfo->Damage; // Sub Damage
packet.SubDmg->Absorbed = damageInfo->Absorb;
packet.SubDmg->Resisted = damageInfo->Resist;
}
packet.VictimState = damageInfo->TargetState;
packet.BlockAmount = damageInfo->Blocked;
packet.RageGained = damageInfo->RageGained;
SendMessageToSet(packet.Write(), true);
}
@@ -5166,6 +5162,7 @@ void Unit::SendAttackStateUpdate(uint32 HitInfo, Unit* target, uint8 /*SwingType
dmgInfo.Resist = Resist;
dmgInfo.TargetState = TargetState;
dmgInfo.Blocked = BlockedAmount;
dmgInfo.RageGained = 0;
SendAttackStateUpdate(&dmgInfo);
}
@@ -13435,7 +13432,7 @@ PlayerMovementPendingChange::PlayerMovementPendingChange()
}
// baseRage means damage taken when attacker = false
void Unit::RewardRage(uint32 baseRage, bool attacker)
int32 Unit::RewardRage(uint32 baseRage, bool attacker)
{
float addRage;
@@ -13456,7 +13453,7 @@ void Unit::RewardRage(uint32 baseRage, bool attacker)
}
addRage *= sWorld->getRate(RATE_POWER_RAGE_INCOME);
ModifyPower(POWER_RAGE, static_cast<uint32>(std::ceil(addRage) * 10));
return ModifyPower(POWER_RAGE, static_cast<uint32>(std::ceil(addRage) * 10), !attacker);
}
void Unit::StopAttackFaction(uint32 faction_id)
+6 -17
View File
@@ -414,18 +414,6 @@ class DispelInfo
uint8 _chargesRemoved;
};
struct CleanDamage
{
CleanDamage(uint32 mitigated, uint32 absorbed, WeaponAttackType _attackType, MeleeHitOutcome _hitOutCome) :
absorbed_damage(absorbed), mitigated_damage(mitigated), attackType(_attackType), hitOutCome(_hitOutCome) { }
uint32 absorbed_damage;
uint32 mitigated_damage;
WeaponAttackType attackType;
MeleeHitOutcome hitOutCome;
};
struct CalcDamageInfo;
struct SpellNonMeleeDamage;
@@ -547,12 +535,13 @@ struct CalcDamageInfo
uint32 Blocked;
uint32 HitInfo;
uint32 TargetState;
uint32 RageGained;
// Helpers
WeaponAttackType AttackType; //
uint32 ProcAttacker;
uint32 ProcVictim;
uint32 CleanDamage; // Used only for rage calculation
uint32 UnmitigatedDamage; // Used only for rage calculation
MeleeHitOutcome HitOutCome; /// @todo remove this field (need use TargetState)
};
@@ -561,7 +550,7 @@ struct TC_GAME_API SpellNonMeleeDamage
{
SpellNonMeleeDamage(Unit* _attacker, Unit* _target, uint32 _SpellID, uint32 _schoolMask)
: target(_target), attacker(_attacker), SpellID(_SpellID), damage(0), overkill(0), schoolMask(_schoolMask),
absorb(0), resist(0), periodicLog(false), unused(false), blocked(0), HitInfo(0), cleanDamage(0), fullBlock(false)
absorb(0), resist(0), periodicLog(false), unused(false), blocked(0), HitInfo(0), unmitigatedDamage(0), fullBlock(false)
{ }
Unit *target;
@@ -577,7 +566,7 @@ struct TC_GAME_API SpellNonMeleeDamage
uint32 blocked;
uint32 HitInfo;
// Used for help
uint32 cleanDamage;
uint32 unmitigatedDamage;
bool fullBlock;
};
@@ -1003,7 +992,7 @@ class TC_GAME_API Unit : public WorldObject
uint32 GetMaxSkillValueForLevel(Unit const* target = nullptr) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; }
static void DealDamageMods(Unit const* victim, uint32& damage, uint32* absorb);
static uint32 DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage = nullptr, DamageEffectType damagetype = DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* spellProto = nullptr, bool durabilityLoss = true);
static uint32 DealDamage(Unit* attacker, Unit* victim, uint32 damage, uint32 unmitigatedDamage = 0, DamageEffectType damagetype = DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* spellProto = nullptr, bool durabilityLoss = true);
static void Kill(Unit* attacker, Unit* victim, bool durabilityLoss = true);
void KillSelf(bool durabilityLoss = true) { Unit::Kill(this, this, durabilityLoss); }
static void DealHeal(HealInfo& healInfo);
@@ -1736,7 +1725,7 @@ class TC_GAME_API Unit : public WorldObject
PlayerMovementPendingChange const* GetPendingMovementChange(MovementChangeType changeType) const;
void PurgeAndApplyPendingMovementChanges(bool informObservers = true);
void RewardRage(uint32 baseRage, bool attacker);
int32 RewardRage(uint32 baseRage, bool attacker);
void OutDebugInfo() const;
virtual bool IsLoading() const { return false; }
@@ -5370,7 +5370,7 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const
{
case 49016: // Hysteria
uint32 damage = uint32(target->CountPctFromMaxHealth(1));
Unit::DealDamage(target, target, damage, nullptr, NODAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
Unit::DealDamage(target, target, damage, 0, NODAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
break;
}
// Blood of the North
@@ -5733,8 +5733,6 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
}
}
CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
// ignore negative values (can be result apply spellmods to aura damage
uint32 damage = std::max(GetAmount(), 0);
@@ -5798,11 +5796,12 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
if (crit)
damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage);
uint32 unmitigatedDamage = damage;
// Calculate armor mitigation
if (Unit::IsDamageReducedByArmor(GetSpellInfo()->GetSchoolMask(), GetSpellInfo()))
{
uint32 damageReducedArmor = Unit::CalcArmorReducedDamage(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetAttackType(), GetBase()->GetCasterLevel());
cleanDamage.mitigated_damage += damage - damageReducedArmor;
damage = damageReducedArmor;
}
@@ -5846,7 +5845,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
SpellPeriodicAuraLogInfo pInfo(this, damage, overkill, absorb, resist, 0.0f, crit);
target->SendPeriodicAuraLog(&pInfo);
Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
Unit::DealDamage(caster, target, damage, unmitigatedDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
Unit::ProcSkillsAndAuras(caster, target, procAttacker, procVictim, PROC_SPELL_TYPE_DAMAGE, PROC_SPELL_PHASE_HIT, hitMask, nullptr, &damageInfo, nullptr);
}
@@ -5866,8 +5865,6 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c
ASSERT_NOTNULL(caster)->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
return;
CleanDamage cleanDamage = CleanDamage(0, 0, GetSpellInfo()->GetAttackType(), MELEE_HIT_NORMAL);
// ignore negative values (can be result apply spellmods to aura damage
uint32 damage = std::max(GetAmount(), 0);
@@ -5888,11 +5885,12 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c
if (crit)
damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage);
uint32 unmitigatedDamage = damage;
// Calculate armor mitigation
if (Unit::IsDamageReducedByArmor(GetSpellInfo()->GetSchoolMask(), GetSpellInfo()))
{
uint32 damageReducedArmor = Unit::CalcArmorReducedDamage(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetAttackType(), GetBase()->GetCasterLevel());
cleanDamage.mitigated_damage += damage - damageReducedArmor;
damage = damageReducedArmor;
}
@@ -5931,7 +5929,7 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c
procVictim |= PROC_FLAG_TAKE_ANY_DAMAGE;
}
int32 new_damage = Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), false);
int32 new_damage = Unit::DealDamage(caster, target, damage, unmitigatedDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), false);
Unit::ProcSkillsAndAuras(caster, target, procAttacker, procVictim, PROC_SPELL_TYPE_DAMAGE, PROC_SPELL_PHASE_NONE, hitMask, nullptr, &damageInfo, nullptr);
// process caster heal from now on (must be in world)
+1 -1
View File
@@ -324,7 +324,7 @@ void Spell::EffectInstaKill(SpellEffIndex /*effIndex*/)
data << uint32(m_spellInfo->Id);
m_caster->SendMessageToSet(&data, true);
Unit::DealDamage(unitCaster, unitTarget, unitTarget->GetHealth(), nullptr, NODAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
Unit::DealDamage(unitCaster, unitTarget, unitTarget->GetHealth(), 0, NODAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
}
void Spell::EffectEnvironmentalDMG(SpellEffIndex /*effIndex*/)
+3 -3
View File
@@ -646,7 +646,7 @@ public:
if (sWorld->getBoolConfig(CONFIG_DIE_COMMAND_MODE))
Unit::Kill(handler->GetSession()->GetPlayer(), target);
else
Unit::DealDamage(handler->GetSession()->GetPlayer(), target, target->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
Unit::DealDamage(handler->GetSession()->GetPlayer(), target, target->GetHealth(), 0, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
}
return true;
@@ -2313,7 +2313,7 @@ public:
// flat melee damage without resistence/etc reduction
if (!schoolStr)
{
Unit::DealDamage(handler->GetSession()->GetPlayer(), target, damage, nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
Unit::DealDamage(handler->GetSession()->GetPlayer(), target, damage, 0, 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;
@@ -2345,7 +2345,7 @@ public:
uint32 absorb = dmgInfo.GetAbsorb();
uint32 resist = dmgInfo.GetResist();
Unit::DealDamageMods(target, damage, &absorb);
Unit::DealDamage(attacker, target, damage, nullptr, DIRECT_DAMAGE, schoolmask, nullptr, false);
Unit::DealDamage(attacker, target, damage, 0, DIRECT_DAMAGE, schoolmask, nullptr, false);
attacker->SendAttackStateUpdate(HITINFO_AFFECTS_VICTIM, target, 0, schoolmask, damage, absorb, resist, VICTIMSTATE_HIT, 0);
return true;
}
@@ -224,7 +224,7 @@ public:
summon->CastSpell(summon, SPELL_FOG_CHARM, true);
summon->CastSpell(summon, SPELL_FOG_CHARM2, true);
}
Unit::DealDamage(me, unitCaster, unitCaster->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
Unit::DealDamage(me, unitCaster, unitCaster->GetHealth(), 0, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
}
}
@@ -81,7 +81,7 @@ public:
if (me->IsWithinDistInMap(who, 20.0f))
{
Talk(SAY_BANISH);
Unit::DealDamage(me, who, who->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
Unit::DealDamage(me, who, who->GetHealth(), 0, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
}
}
@@ -84,7 +84,7 @@ public:
if (me->IsWithinDistInMap(who, 20.0f))
{
Talk(SAY_BANISH);
Unit::DealDamage(me, who, who->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
Unit::DealDamage(me, who, who->GetHealth(), 0, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
}
}
@@ -96,7 +96,7 @@ public:
{
Talk(SAY_BANISH);
Unit::DealDamage(me, who, who->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
Unit::DealDamage(me, who, who->GetHealth(), 0, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
}
}
@@ -1191,7 +1191,7 @@ class spell_algalon_collapse : public SpellScriptLoader
void HandlePeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
Unit::DealDamage(GetTarget(), GetTarget(), GetTarget()->CountPctFromMaxHealth(1), nullptr, NODAMAGE);
Unit::DealDamage(GetTarget(), GetTarget(), GetTarget()->CountPctFromMaxHealth(1), 0, NODAMAGE);
}
void Register() override