mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-24 14:16:31 +00:00
Merge branch 'azerothcore:master' into Playerbot
This commit is contained in:
@@ -691,6 +691,14 @@ void BossAI::ScheduleHealthCheckEvent(uint32 healthPct, std::function<void()> ex
|
||||
_healthCheckEvents.push_back(HealthCheckEventData(healthPct, exec));
|
||||
};
|
||||
|
||||
void BossAI::ScheduleHealthCheckEvent(std::initializer_list<uint8> healthPct, std::function<void()> exec)
|
||||
{
|
||||
for (auto const& checks : healthPct)
|
||||
{
|
||||
_healthCheckEvents.push_back(HealthCheckEventData(checks, exec));
|
||||
}
|
||||
}
|
||||
|
||||
bool BossAI::_ProccessHealthCheckEvent(uint8 healthPct, uint32 damage, std::function<void()> exec) const
|
||||
{
|
||||
if (me->HealthBelowPctDamaged(healthPct, damage))
|
||||
|
||||
@@ -470,6 +470,7 @@ public:
|
||||
void UpdateAI(uint32 diff) override;
|
||||
|
||||
void ScheduleHealthCheckEvent(uint32 healthPct, std::function<void()> exec);
|
||||
void ScheduleHealthCheckEvent(std::initializer_list<uint8> healthPct, std::function<void()> exec);
|
||||
|
||||
// Hook used to execute events scheduled into EventMap without the need
|
||||
// to override UpdateAI
|
||||
|
||||
@@ -1635,7 +1635,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
float x, y, z;
|
||||
target->GetPosition(x, y, z);
|
||||
if (e.action.moveToPos.ContactDistance > 0)
|
||||
target->GetContactPoint(me, x, y, z, e.action.moveToPos.ContactDistance);
|
||||
{
|
||||
target->GetNearPoint(me, x, y, z, e.action.moveToPos.ContactDistance, 0, target->GetAngle(me));
|
||||
}
|
||||
me->GetMotionMaster()->MovePoint(e.action.moveToPos.pointId, x + e.target.x, y + e.target.y, z + e.target.z, true, true, isControlled ? MOTION_SLOT_CONTROLLED : MOTION_SLOT_ACTIVE);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1428,7 +1428,7 @@ enum SMARTAI_TARGETS
|
||||
SMART_TARGET_SUMMONED_CREATURES = 204, // Entry
|
||||
SMART_TARGET_INSTANCE_STORAGE = 205, // Instance data index, Type (creature (1), gameobject (2))
|
||||
|
||||
SMART_TARGET_AC_END = 205 // placeholder
|
||||
SMART_TARGET_AC_END = 206 // placeholder
|
||||
};
|
||||
|
||||
struct SmartTarget
|
||||
|
||||
@@ -208,7 +208,10 @@ void InstanceScript::UpdateMinionState(Creature* minion, EncounterState state)
|
||||
minion->Respawn();
|
||||
else
|
||||
{
|
||||
minion->AI()->DoZoneInCombat(nullptr, 100.0f);
|
||||
if (minion->GetReactState() == REACT_AGGRESSIVE)
|
||||
{
|
||||
minion->AI()->DoZoneInCombat(nullptr, 100.0f);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -362,6 +365,20 @@ void InstanceScript::StorePersistentData(uint32 index, uint32 data)
|
||||
persistentData[index] = data;
|
||||
}
|
||||
|
||||
void InstanceScript::DoForAllMinions(uint32 id, std::function<void(Creature*)> exec)
|
||||
{
|
||||
BossInfo* bossInfo = &bosses[id];
|
||||
MinionSet listCopy = bossInfo->minion;
|
||||
|
||||
for (auto const& minion : listCopy)
|
||||
{
|
||||
if (minion)
|
||||
{
|
||||
exec(minion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InstanceScript::Load(const char* data)
|
||||
{
|
||||
if (!data)
|
||||
|
||||
@@ -260,6 +260,9 @@ public:
|
||||
|
||||
// Allows to perform particular actions
|
||||
virtual void DoAction(int32 /*action*/) {}
|
||||
|
||||
// Allows executing code using all creatures registered in the instance script as minions
|
||||
void DoForAllMinions(uint32 id, std::function<void(Creature*)> exec);
|
||||
protected:
|
||||
void SetHeaders(std::string const& dataHeaders);
|
||||
void SetBossNumber(uint32 number) { bosses.resize(number); }
|
||||
|
||||
Reference in New Issue
Block a user