Skip to content

Commit

Permalink
NPCBots: Fix periodic damage ticks not being affected by bot damage d…
Browse files Browse the repository at this point in the history
…ealt mods

(cherry picked from commit ad5220b1b667363718a81712fcbe124cd350911e)

# Conflicts:
#	src/server/game/Spells/Auras/SpellAuraEffects.cpp
  • Loading branch information
trickerer committed Nov 18, 2024
1 parent d719c66 commit 1d5d058
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/server/game/Spells/Auras/SpellAuraEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
#include "Vehicle.h"
#include "WorldPacket.h"

//npcbot
#include "botmgr.h"
//end npcbot

/// @todo: this import is not necessary for compilation and marked as unused by the IDE
// however, for some reasons removing it would cause a damn linking issue
// there is probably some underlying problem with imports which should properly addressed
Expand Down Expand Up @@ -6778,6 +6782,20 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
if ((crit = roll_chance_f(GetCritChance())))
damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage, target);

//NpcBot mod: apply bot damage mods
if (caster->IsNPCBotOrPet())
{
SpellNonMeleeDamage damageInfo(caster, target, m_spellInfo, m_spellInfo->GetSchoolMask());
int32 idamage = damage;
caster->ToCreature()->ApplyBotDamageMultiplierSpell(idamage, damageInfo, m_spellInfo, BASE_ATTACK, crit);
damage = std::max<int32>(idamage, 0);
if (GetSpellInfo()->GetSchoolMask() & SPELL_SCHOOL_MASK_NORMAL)
damage *= BotMgr::IsWanderingWorldBot(caster->ToCreature()) ? BotMgr::GetBotWandererDamageMod() : BotMgr::GetBotDamageModPhysical();
else if (GetSpellInfo()->GetSchoolMask() & SPELL_SCHOOL_MASK_MAGIC)
damage *= BotMgr::IsWanderingWorldBot(caster->ToCreature()) ? BotMgr::GetBotWandererDamageMod() : BotMgr::GetBotDamageModSpell();
}
//End NpcBot

// Auras reducing damage from AOE spells
if (GetSpellInfo()->Effects[GetEffIndex()].IsAreaAuraEffect() || GetSpellInfo()->Effects[GetEffIndex()].IsTargetingArea() || GetSpellInfo()->Effects[GetEffIndex()].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA) // some persistent area auras have targets like A=53 B=28
{
Expand Down

0 comments on commit 1d5d058

Please sign in to comment.