mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-15 20:52:22 -04:00
Core/AI: Added new method for search friendly targets with certain entry and hp pct below a value (#18310)
This commit is contained in:
@@ -335,6 +335,16 @@ Unit* ScriptedAI::DoSelectLowestHpFriendly(float range, uint32 minHPDiff)
|
||||
return unit;
|
||||
}
|
||||
|
||||
Unit* ScriptedAI::DoSelectBelowHpPctFriendlyWithEntry(uint32 entry, float range, uint8 minHPDiff, bool excludeSelf)
|
||||
{
|
||||
Unit* unit = nullptr;
|
||||
Trinity::FriendlyBelowHpPctEntryInRange u_check(me, entry, range, minHPDiff, excludeSelf);
|
||||
Trinity::UnitLastSearcher<Trinity::FriendlyBelowHpPctEntryInRange> searcher(me, unit, u_check);
|
||||
me->VisitNearbyObject(range, searcher);
|
||||
|
||||
return unit;
|
||||
}
|
||||
|
||||
std::list<Creature*> ScriptedAI::DoFindFriendlyCC(float range)
|
||||
{
|
||||
std::list<Creature*> list;
|
||||
@@ -403,54 +413,6 @@ enum NPCs
|
||||
NPC_SARTHARION = 28860
|
||||
};
|
||||
|
||||
// Hacklike storage used for misc creatures that are expected to evade of outside of a certain area.
|
||||
// It is assumed the information is found elswehere and can be handled by the core. So far no luck finding such information/way to extract it.
|
||||
/*bool ScriptedAI::EnterEvadeIfOutOfCombatArea(uint32 const diff)
|
||||
{
|
||||
if (_evadeCheckCooldown <= diff)
|
||||
_evadeCheckCooldown = 2500;
|
||||
else
|
||||
{
|
||||
_evadeCheckCooldown -= diff;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (me->IsInEvadeMode() || !me->GetVictim())
|
||||
return false;
|
||||
|
||||
float x = me->GetPositionX();
|
||||
float y = me->GetPositionY();
|
||||
float z = me->GetPositionZ();
|
||||
|
||||
switch (me->GetEntry())
|
||||
{
|
||||
case NPC_BROODLORD: // broodlord (not move down stairs)
|
||||
if (z > 448.60f)
|
||||
return false;
|
||||
break;
|
||||
case NPC_VOID_REAVER: // void reaver (calculate from center of room)
|
||||
if (me->GetDistance2d(432.59f, 371.93f) < 105.0f)
|
||||
return false;
|
||||
break;
|
||||
case NPC_JAN_ALAI: // jan'alai (calculate by Z)
|
||||
if (z > 12.0f)
|
||||
return false;
|
||||
break;
|
||||
case NPC_SARTHARION: // sartharion (calculate box)
|
||||
if (x > 3218.86f && x < 3275.69f && y < 572.40f && y > 484.68f)
|
||||
return false;
|
||||
break;
|
||||
default: // For most of creatures that certain area is their home area.
|
||||
TC_LOG_INFO("misc", "TSCR: EnterEvadeIfOutOfCombatArea used for creature entry %u, but does not have any definition. Using the default one.", me->GetEntry());
|
||||
uint32 homeAreaId = me->GetMap()->GetAreaId(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY(), me->GetHomePosition().GetPositionZ());
|
||||
if (me->GetAreaId() == homeAreaId)
|
||||
return false;
|
||||
}
|
||||
|
||||
EnterEvadeMode();
|
||||
return true;
|
||||
}*/
|
||||
|
||||
// BossAI - for instanced bosses
|
||||
BossAI::BossAI(Creature* creature, uint32 bossId) : ScriptedAI(creature),
|
||||
instance(creature->GetInstanceScript()),
|
||||
|
||||
Reference in New Issue
Block a user