mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-05 12:03:48 +00:00
refactor(Core/AI): Some more refactoring prep for Comat Threat system… (#15026)
Co-authored-by: Treeston <14020072+Treeston@users.noreply.github.com>
This commit is contained in:
@@ -68,7 +68,12 @@ void CombatAI::JustDied(Unit* killer)
|
||||
me->CastSpell(killer, *i, true);
|
||||
}
|
||||
|
||||
void CombatAI::EnterCombat(Unit* who)
|
||||
/**
|
||||
* @brief Called for reaction when initially engaged
|
||||
*
|
||||
* @param who Who 'me' Engaged combat with
|
||||
*/
|
||||
void CombatAI::JustEngagedWith(Unit* who)
|
||||
{
|
||||
for (SpellVct::iterator i = spells.begin(); i != spells.end(); ++i)
|
||||
{
|
||||
@@ -114,7 +119,12 @@ void CasterAI::InitializeAI()
|
||||
m_attackDist = MELEE_RANGE;
|
||||
}
|
||||
|
||||
void CasterAI::EnterCombat(Unit* who)
|
||||
/**
|
||||
* @brief Called for reaction when initially engaged
|
||||
*
|
||||
* @param who Who 'me' Engaged combat with
|
||||
*/
|
||||
void CasterAI::JustEngagedWith(Unit* who)
|
||||
{
|
||||
if (spells.empty())
|
||||
return;
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
|
||||
void InitializeAI() override;
|
||||
void Reset() override;
|
||||
void EnterCombat(Unit* who) override;
|
||||
void JustEngagedWith(Unit* who) override;
|
||||
void JustDied(Unit* killer) override;
|
||||
void UpdateAI(uint32 diff) override;
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
void InitializeAI() override;
|
||||
void AttackStart(Unit* victim) override { AttackStartCaster(victim, m_attackDist); }
|
||||
void UpdateAI(uint32 diff) override;
|
||||
void EnterCombat(Unit* /*who*/) override;
|
||||
void JustEngagedWith(Unit* /*who*/) override;
|
||||
private:
|
||||
float m_attackDist;
|
||||
};
|
||||
|
||||
@@ -69,7 +69,7 @@ void PossessedAI::KilledUnit(Unit* /*victim*/)
|
||||
// victim->RemoveDynamicFlag(UNIT_DYNFLAG_LOOTABLE);
|
||||
}
|
||||
|
||||
void CritterAI::EnterCombat(Unit* who)
|
||||
void CritterAI::JustEngagedWith(Unit* who)
|
||||
{
|
||||
if (!me->HasUnitState(UNIT_STATE_FLEEING))
|
||||
{
|
||||
|
||||
@@ -68,7 +68,7 @@ class CritterAI : public PassiveAI
|
||||
public:
|
||||
explicit CritterAI(Creature* c) : PassiveAI(c) { }
|
||||
|
||||
void EnterCombat(Unit* /*who*/) override;
|
||||
void JustEngagedWith(Unit* /*who*/) override;
|
||||
void EnterEvadeMode(EvadeReason why) override;
|
||||
void MovementInform(uint32 type, uint32 id) override;
|
||||
void UpdateAI(uint32 /*diff*/) override { }
|
||||
|
||||
@@ -332,6 +332,21 @@ public:
|
||||
targetList.resize(num);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Called when the unit enters combat
|
||||
* (NOTE: Creature engage logic should NOT be here, but in JustEngagedWith, which happens once threat is established!)
|
||||
*
|
||||
* @todo Never invoked right now. Preparation for Combat Threat refactor
|
||||
*/
|
||||
virtual void JustEnteredCombat(Unit* /*who*/) { }
|
||||
|
||||
/**
|
||||
* @brief Called when the unit leaves combat
|
||||
*
|
||||
* @todo Never invoked right now. Preparation for Combat Threat refactor
|
||||
*/
|
||||
virtual void JustExitedCombat() { }
|
||||
|
||||
// Called at any Damage to any victim (before damage apply)
|
||||
virtual void DamageDealt(Unit* /*victim*/, uint32& /*damage*/, DamageEffectType /*damageType*/) { }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user