mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[7709] Cleanups in AI()->AttackedBy use.
* Remove redundent AI()->AttackedBy call at melee cast in state update (called in cast) * Move attacks state update call after first attack instead after all extra attack state updates.
This commit is contained in:
parent
226bdca199
commit
5d9516354e
2 changed files with 5 additions and 10 deletions
|
|
@ -1970,11 +1970,6 @@ void Unit::AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType, bool ex
|
||||||
--m_extraAttacks;
|
--m_extraAttacks;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if damage pVictim call AI reaction
|
|
||||||
if(pVictim->GetTypeId()==TYPEID_UNIT && ((Creature*)pVictim)->AI())
|
|
||||||
((Creature*)pVictim)->AI()->AttackedBy(this);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1995,6 +1990,10 @@ void Unit::AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType, bool ex
|
||||||
DEBUG_LOG("AttackerStateUpdate: (NPC) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.",
|
DEBUG_LOG("AttackerStateUpdate: (NPC) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.",
|
||||||
GetGUIDLow(), pVictim->GetGUIDLow(), pVictim->GetTypeId(), damageInfo.damage, damageInfo.absorb, damageInfo.blocked_amount, damageInfo.resist);
|
GetGUIDLow(), pVictim->GetGUIDLow(), pVictim->GetTypeId(), damageInfo.damage, damageInfo.absorb, damageInfo.blocked_amount, damageInfo.resist);
|
||||||
|
|
||||||
|
// if damage pVictim call AI reaction
|
||||||
|
if(pVictim->GetTypeId()==TYPEID_UNIT && ((Creature*)pVictim)->AI())
|
||||||
|
((Creature*)pVictim)->AI()->AttackedBy(this);
|
||||||
|
|
||||||
// extra attack only at any non extra attack (normal case)
|
// extra attack only at any non extra attack (normal case)
|
||||||
if(!extra && extraAttacks)
|
if(!extra && extraAttacks)
|
||||||
{
|
{
|
||||||
|
|
@ -2005,10 +2004,6 @@ void Unit::AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType, bool ex
|
||||||
--m_extraAttacks;
|
--m_extraAttacks;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if damage pVictim call AI reaction
|
|
||||||
if(pVictim->GetTypeId()==TYPEID_UNIT && ((Creature*)pVictim)->AI())
|
|
||||||
((Creature*)pVictim)->AI()->AttackedBy(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit *pVictim, WeaponAttackType attType) const
|
MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit *pVictim, WeaponAttackType attType) const
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7708"
|
#define REVISION_NR "7709"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue