Skip to content
Permalink
Browse files

Various Unit.cpp Fixes

Resolves ProcMask abilities with Interrupt flag not being interrupted (Sap, Wyvern Sting)
Resolves Eluna OnCreatureKill not firing
Aligns SetConfused logic with MangosTwo

Low-Risk warning: the below spell list are the spells with interrupt + procMask =/= 0. This change may (unlikely apart from fixing them) impact them:

1784    Stealth
1785    Stealth
1786    Stealth
1787    Stealth
1856    Vanish
1857    Vanish
2070    Sap
5215    Prowl
6770    Sap
6783    Prowl
7291    Food (TEST)
7331    Healing Aura (TEST)
7967    Naralex's Nightmare
9913    Prowl
19386    Wyvern Sting
24132    Wyvern Sting
24133    Wyvern Sting
24450    Prowl
24452    Prowl
24453    Prowl
26889    Vanish
27068    Wyvern Sting
30831    Stealth
30991    Stealth
42932    Prowl
  • Loading branch information...
ValeTheVioletMote authored and MadMaxMangos committed Jun 5, 2019
1 parent b44217d commit 4afa3be0eab05e6275e805af9e328628528a4011
Showing with 16 additions and 11 deletions.
  1. +16 −11 src/game/Object/Unit.cpp
@@ -955,7 +955,7 @@ uint32 Unit::DealDamage(Unit* pVictim, uint32 damage, CleanDamage const* cleanDa
next = i; ++next;
if (spellProto && spellProto->Id == se->Id) // Not drop auras added by self
{ continue; }
if (!se->procFlags && (se->AuraInterruptFlags & AURA_INTERRUPT_FLAG_DAMAGE))
if (se->AuraInterruptFlags & AURA_INTERRUPT_FLAG_DAMAGE) // if !se->procFlags && is applied, Sap/Wyvern Sting/other abilities with interrupt & non-empty procmask fail to break.
{
pVictim->RemoveAurasDueToSpell(i->second->GetId());
next = vAuras.begin();
@@ -1098,16 +1098,16 @@ void Unit::JustKilledCreature(Creature* victim, Player* responsiblePlayer)
if (InstanceData* mapInstance = victim->GetInstanceData())
{ mapInstance->OnCreatureDeath(victim); }

if (responsiblePlayer) // killedby Player, inform BG
if (responsiblePlayer)
{ // killedby Player, inform BG
if (BattleGround* bg = responsiblePlayer->GetBattleGround())
{
bg->HandleKillUnit(victim, responsiblePlayer);

// Used by Eluna
// Used by Eluna
#ifdef ENABLE_ELUNA
sEluna->OnCreatureKill(responsiblePlayer, victim);
sEluna->OnCreatureKill(responsiblePlayer, victim);
#endif /* ENABLE_ELUNA */
}
}

// Notify the outdoor pvp script
if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript(responsiblePlayer ? responsiblePlayer->GetCachedZoneId() : GetZoneId()))
@@ -2247,6 +2247,9 @@ void Unit::CalculateDamageAbsorbAndResist(Unit* pCaster, SpellSchoolMask schoolM

CleanDamage cleanDamage = CleanDamage(splitted, BASE_ATTACK, MELEE_HIT_NORMAL);
pCaster->DealDamage(caster, splitted, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*i)->GetSpellProto(), false);

// Break 'fear' and such - in MangosTwo but not MangosZero, was not originally in MangosOne. Leaving commented.
// pCaster->ProcDamageAndSpellFor(true, this, PROC_FLAG_TAKEN_NEGATIVE_SPELL_HIT, PROC_EX_NORMAL_HIT, BASE_ATTACK, (*i)->GetSpellProto(), splitted);
}
}

@@ -2340,9 +2343,9 @@ void Unit::AttackerStateUpdate(Unit* pVictim, WeaponAttackType attType, bool ext
}
return;
}

RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MELEE_ATTACK);

// attack can be redirected to another target
if (Unit* magnetTarget = SelectMagnetTarget(pVictim))
pVictim = magnetTarget;
@@ -8990,6 +8993,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag,
{ continue; }

SpellProcEventEntry const* spellProcEvent = NULL;
// check if that aura is triggered by proc event (then it will be managed by proc handler)
if (!IsTriggeredAtSpellProcEvent(pTarget, itr->second, procSpell, procFlag, procExtra, attType, isVictim, spellProcEvent))
{ continue; }

@@ -9224,9 +9228,10 @@ void Unit::SetConfused(bool apply, ObjectGuid casterGuid, uint32 spellID)
CastStop(GetObjectGuid() == casterGuid ? spellID : 0);

if (GetTypeId() == TYPEID_UNIT)
SetTargetGuid(ObjectGuid());

GetMotionMaster()->MoveConfused();
{
SetTargetGuid(ObjectGuid());
GetMotionMaster()->MoveConfused();
}
}
else
{

0 comments on commit 4afa3be

Please sign in to comment.
You can’t perform that action at this time.