mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 10:05:32 +01:00
[svn] Set target in combat even if spell does not hit target.
Call AI function only when spell hits target. Move combat check from dealdamge to attackerstateupdate to remove redundant check. --HG-- branch : trunk
This commit is contained in:
@@ -519,9 +519,6 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
if(!pVictim->isInCombat() && ((Creature*)pVictim)->AI())
|
||||
((Creature*)pVictim)->AI()->AttackStart(this);
|
||||
}
|
||||
|
||||
DEBUG_LOG("DealDamageStart");
|
||||
@@ -539,15 +536,6 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
||||
|
||||
duel_hasEnded = true;
|
||||
}
|
||||
//Get in CombatState
|
||||
if(pVictim != this && damagetype != DOT)
|
||||
{
|
||||
SetInCombatWith(pVictim);
|
||||
pVictim->SetInCombatWith(this);
|
||||
|
||||
if(Player* attackedPlayer = pVictim->GetCharmerOrOwnerPlayerOrPlayerItself())
|
||||
SetContestedPvP(attackedPlayer);
|
||||
}
|
||||
|
||||
// Rage from Damage made (only from direct weapon damage)
|
||||
if( cleanDamage && damagetype==DIRECT_DAMAGE && this != pVictim && GetTypeId() == TYPEID_PLAYER && (getPowerType() == POWER_RAGE))
|
||||
@@ -2151,6 +2139,15 @@ void Unit::AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType, bool ex
|
||||
if(IsNonMeleeSpellCasted(false))
|
||||
return;
|
||||
|
||||
if(!pVictim->isInCombat() && pVictim->GetTypeId() != TYPEID_PLAYER && ((Creature*)pVictim)->AI())
|
||||
((Creature*)pVictim)->AI()->AttackStart(this);
|
||||
|
||||
SetInCombatWith(pVictim);
|
||||
pVictim->SetInCombatWith(this);
|
||||
|
||||
if(Player* attackedPlayer = pVictim->GetCharmerOrOwnerPlayerOrPlayerItself())
|
||||
SetContestedPvP(attackedPlayer);
|
||||
|
||||
uint32 hitInfo;
|
||||
if (attType == BASE_ATTACK)
|
||||
hitInfo = HITINFO_NORMALSWING2;
|
||||
|
||||
Reference in New Issue
Block a user