fix(Core/PetAI): aggro and movement of Warlock's IMP (#2379)
This commit is contained in:
committed by
Francesco Borzì
parent
616b8d9fb1
commit
ded3bd8900
@@ -87,11 +87,52 @@ void PetAI::_doMeleeAttack()
|
|||||||
DoMeleeAttackIfReady();
|
DoMeleeAttackIfReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PetAI::_canMeleeAttack() const
|
bool PetAI::_canMeleeAttack()
|
||||||
{
|
{
|
||||||
return me->GetEntry() != 416 /*ENTRY_IMP*/ &&
|
combatRange = 0.f;
|
||||||
me->GetEntry() != 510 /*ENTRY_WATER_ELEMENTAL*/ &&
|
switch (me->GetEntry())
|
||||||
me->GetEntry() != 37994 /*ENTRY_WATER_ELEMENTAL_PERM*/;
|
{
|
||||||
|
case ENTRY_IMP:
|
||||||
|
case ENTRY_WATER_ELEMENTAL:
|
||||||
|
case ENTRY_WATER_ELEMENTAL_PERM:
|
||||||
|
{
|
||||||
|
for (uint8 i = 0; i < me->GetPetAutoSpellSize(); ++i)
|
||||||
|
{
|
||||||
|
uint32 spellID = me->GetPetAutoSpellOnPos(i);
|
||||||
|
switch (spellID)
|
||||||
|
{
|
||||||
|
case IMP_FIREBOLT_RANK_1:
|
||||||
|
case IMP_FIREBOLT_RANK_2:
|
||||||
|
case IMP_FIREBOLT_RANK_3:
|
||||||
|
case IMP_FIREBOLT_RANK_4:
|
||||||
|
case IMP_FIREBOLT_RANK_5:
|
||||||
|
case IMP_FIREBOLT_RANK_6:
|
||||||
|
case IMP_FIREBOLT_RANK_7:
|
||||||
|
case IMP_FIREBOLT_RANK_8:
|
||||||
|
case IMP_FIREBOLT_RANK_9:
|
||||||
|
case WATER_ELEMENTAL_WATERBOLT_1:
|
||||||
|
case WATER_ELEMENTAL_WATERBOLT_2:
|
||||||
|
{
|
||||||
|
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID);
|
||||||
|
int32 mana = me->GetPower(POWER_MANA);
|
||||||
|
|
||||||
|
if (mana >= spellInfo->CalcPowerCost(me, spellInfo->GetSchoolMask()))
|
||||||
|
{
|
||||||
|
combatRange = spellInfo->GetMaxRange();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PetAI::UpdateAI(uint32 diff)
|
void PetAI::UpdateAI(uint32 diff)
|
||||||
@@ -563,7 +604,8 @@ void PetAI::DoAttack(Unit* target, bool chase)
|
|||||||
|
|
||||||
if (chase)
|
if (chase)
|
||||||
{
|
{
|
||||||
me->GetMotionMaster()->MoveChase(target, !_canMeleeAttack() ? 20.0f: 0.0f, me->GetAngle(target));
|
if (_canMeleeAttack())
|
||||||
|
me->GetMotionMaster()->MoveChase(target, combatRange, float(M_PI));
|
||||||
}
|
}
|
||||||
else // (Stay && ((Aggressive || Defensive) && In Melee Range)))
|
else // (Stay && ((Aggressive || Defensive) && In Melee Range)))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,6 +13,25 @@
|
|||||||
class Creature;
|
class Creature;
|
||||||
class Spell;
|
class Spell;
|
||||||
|
|
||||||
|
enum SpecialPets
|
||||||
|
{
|
||||||
|
ENTRY_IMP = 416,
|
||||||
|
ENTRY_WATER_ELEMENTAL = 510,
|
||||||
|
ENTRY_WATER_ELEMENTAL_PERM = 37994,
|
||||||
|
|
||||||
|
IMP_FIREBOLT_RANK_1 = 3110,
|
||||||
|
IMP_FIREBOLT_RANK_2 = 7799,
|
||||||
|
IMP_FIREBOLT_RANK_3 = 7800,
|
||||||
|
IMP_FIREBOLT_RANK_4 = 7801,
|
||||||
|
IMP_FIREBOLT_RANK_5 = 7802,
|
||||||
|
IMP_FIREBOLT_RANK_6 = 11762,
|
||||||
|
IMP_FIREBOLT_RANK_7 = 11763,
|
||||||
|
IMP_FIREBOLT_RANK_8 = 27267,
|
||||||
|
IMP_FIREBOLT_RANK_9 = 47964,
|
||||||
|
WATER_ELEMENTAL_WATERBOLT_1 = 31707,
|
||||||
|
WATER_ELEMENTAL_WATERBOLT_2 = 72898
|
||||||
|
};
|
||||||
|
|
||||||
class PetAI : public CreatureAI
|
class PetAI : public CreatureAI
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -43,13 +62,14 @@ class PetAI : public CreatureAI
|
|||||||
bool _needToStop(void);
|
bool _needToStop(void);
|
||||||
void _stopAttack(void);
|
void _stopAttack(void);
|
||||||
void _doMeleeAttack();
|
void _doMeleeAttack();
|
||||||
bool _canMeleeAttack() const;
|
bool _canMeleeAttack();
|
||||||
|
|
||||||
void UpdateAllies();
|
void UpdateAllies();
|
||||||
|
|
||||||
TimeTracker i_tracker;
|
TimeTracker i_tracker;
|
||||||
std::set<uint64> m_AllySet;
|
std::set<uint64> m_AllySet;
|
||||||
uint32 m_updateAlliesTimer;
|
uint32 m_updateAlliesTimer;
|
||||||
|
float combatRange;
|
||||||
|
|
||||||
Unit* SelectNextTarget(bool allowAutoSelect) const;
|
Unit* SelectNextTarget(bool allowAutoSelect) const;
|
||||||
void HandleReturnMovement();
|
void HandleReturnMovement();
|
||||||
|
|||||||
Reference in New Issue
Block a user