mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-05 03:53:48 +00:00
fix(Scripts/BlackrockSpire): Urok Doomhowl - improvements: (#9067)
The mobs should attack the pike if there is no players around The boss should not despawning after summon Urok's Tribute Pile with Pike and Head should disapear after Urok appear Fixes #9023
This commit is contained in:
@@ -742,9 +742,9 @@ Creature* GetClosestCreatureWithEntry(WorldObject* source, uint32 entry, float m
|
||||
return source->FindNearestCreature(entry, maxSearchRange, alive);
|
||||
}
|
||||
|
||||
GameObject* GetClosestGameObjectWithEntry(WorldObject* source, uint32 entry, float maxSearchRange)
|
||||
GameObject* GetClosestGameObjectWithEntry(WorldObject* source, uint32 entry, float maxSearchRange, bool onlySpawned /*= false*/)
|
||||
{
|
||||
return source->FindNearestGameObject(entry, maxSearchRange);
|
||||
return source->FindNearestGameObject(entry, maxSearchRange, onlySpawned);
|
||||
}
|
||||
|
||||
void GetCreatureListWithEntryInGrid(std::list<Creature*>& list, WorldObject* source, uint32 entry, float maxSearchRange)
|
||||
|
||||
@@ -504,7 +504,7 @@ protected:
|
||||
|
||||
// SD2 grid searchers.
|
||||
Creature* GetClosestCreatureWithEntry(WorldObject* source, uint32 entry, float maxSearchRange, bool alive = true);
|
||||
GameObject* GetClosestGameObjectWithEntry(WorldObject* source, uint32 entry, float maxSearchRange);
|
||||
GameObject* GetClosestGameObjectWithEntry(WorldObject* source, uint32 entry, float maxSearchRange, bool onlySpawned = false);
|
||||
void GetCreatureListWithEntryInGrid(std::list<Creature*>& list, WorldObject* source, uint32 entry, float maxSearchRange);
|
||||
void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& list, WorldObject* source, uint32 entry, float maxSearchRange);
|
||||
void GetDeadCreatureListInGrid(std::list<Creature*>& list, WorldObject* source, float maxSearchRange, bool alive = false);
|
||||
|
||||
@@ -3681,7 +3681,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
|
||||
}
|
||||
case SMART_TARGET_CLOSEST_GAMEOBJECT:
|
||||
{
|
||||
GameObject* target = GetClosestGameObjectWithEntry(GetBaseObject(), e.target.closest.entry, (float)(e.target.closest.dist ? e.target.closest.dist : 100));
|
||||
GameObject* target = GetClosestGameObjectWithEntry(GetBaseObject(), e.target.closestGameobject.entry, (float)(e.target.closestGameobject.dist ? e.target.closestGameobject.dist : 100), e.target.closestGameobject.onlySpawned);
|
||||
if (target)
|
||||
l->push_back(target);
|
||||
break;
|
||||
|
||||
@@ -1460,6 +1460,13 @@ struct SmartTarget
|
||||
uint32 dead;
|
||||
} closest;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 entry;
|
||||
uint32 dist;
|
||||
uint32 onlySpawned;
|
||||
} closestGameobject;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 maxDist;
|
||||
|
||||
@@ -2533,10 +2533,10 @@ Creature* WorldObject::FindNearestCreature(uint32 entry, float range, bool alive
|
||||
return creature;
|
||||
}
|
||||
|
||||
GameObject* WorldObject::FindNearestGameObject(uint32 entry, float range) const
|
||||
GameObject* WorldObject::FindNearestGameObject(uint32 entry, float range, bool onlySpawned /*= false*/) const
|
||||
{
|
||||
GameObject* go = nullptr;
|
||||
Acore::NearestGameObjectEntryInObjectRangeCheck checker(*this, entry, range);
|
||||
Acore::NearestGameObjectEntryInObjectRangeCheck checker(*this, entry, range, onlySpawned);
|
||||
Acore::GameObjectLastSearcher<Acore::NearestGameObjectEntryInObjectRangeCheck> searcher(this, go, checker);
|
||||
Cell::VisitGridObjects(this, searcher, range);
|
||||
return go;
|
||||
@@ -2816,7 +2816,8 @@ void WorldObject::GetContactPoint(const WorldObject* obj, float& x, float& y, fl
|
||||
// angle to face `obj` to `this` using distance includes size of `obj`
|
||||
GetNearPoint(obj, x, y, z, obj->GetObjectSize(), distance2d, GetAngle(obj));
|
||||
|
||||
if (fabs(this->GetPositionZ() - z) > 3.0f || !IsWithinLOS(x, y, z))
|
||||
// Exclude gameobjects from LoS calculations
|
||||
if (fabs(this->GetPositionZ() - z) > 3.0f || (GetTypeId() != TYPEID_GAMEOBJECT && !IsWithinLOS(x, y, z)))
|
||||
{
|
||||
x = this->GetPositionX();
|
||||
y = this->GetPositionY();
|
||||
|
||||
@@ -812,7 +812,7 @@ public:
|
||||
void SummonCreatureGroup(uint8 group, std::list<TempSummon*>* list = nullptr);
|
||||
|
||||
[[nodiscard]] Creature* FindNearestCreature(uint32 entry, float range, bool alive = true) const;
|
||||
[[nodiscard]] GameObject* FindNearestGameObject(uint32 entry, float range) const;
|
||||
[[nodiscard]] GameObject* FindNearestGameObject(uint32 entry, float range, bool onlySpawned = false) const;
|
||||
[[nodiscard]] GameObject* FindNearestGameObjectOfType(GameobjectTypes type, float range) const;
|
||||
|
||||
[[nodiscard]] Player* SelectNearestPlayer(float distance = 0) const;
|
||||
|
||||
@@ -690,10 +690,12 @@ namespace Acore
|
||||
class NearestGameObjectEntryInObjectRangeCheck
|
||||
{
|
||||
public:
|
||||
NearestGameObjectEntryInObjectRangeCheck(WorldObject const& obj, uint32 entry, float range) : i_obj(obj), i_entry(entry), i_range(range) {}
|
||||
NearestGameObjectEntryInObjectRangeCheck(WorldObject const& obj, uint32 entry, float range, bool onlySpawned = false) :
|
||||
i_obj(obj), i_entry(entry), i_range(range), i_onlySpawned(onlySpawned) { }
|
||||
|
||||
bool operator()(GameObject* go)
|
||||
{
|
||||
if (go->GetEntry() == i_entry && i_obj.IsWithinDistInMap(go, i_range))
|
||||
if (go->GetEntry() == i_entry && i_obj.IsWithinDistInMap(go, i_range) && (!i_onlySpawned || go->isSpawned()))
|
||||
{
|
||||
i_range = i_obj.GetDistance(go); // use found GO range as new range limit for next check
|
||||
return true;
|
||||
@@ -704,6 +706,7 @@ namespace Acore
|
||||
WorldObject const& i_obj;
|
||||
uint32 i_entry;
|
||||
float i_range;
|
||||
bool i_onlySpawned;
|
||||
|
||||
// prevent clone this object
|
||||
NearestGameObjectEntryInObjectRangeCheck(NearestGameObjectEntryInObjectRangeCheck const&);
|
||||
|
||||
@@ -49,17 +49,22 @@ public:
|
||||
{
|
||||
boss_urok_doomhowlAI(Creature* creature) : BossAI(creature, DATA_UROK_DOOMHOWL) {}
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
_Reset();
|
||||
}
|
||||
|
||||
void InitializeAI() override
|
||||
{
|
||||
me->CastSpell(me, SPELL_UROK_SPAWN, true);
|
||||
BossAI::InitializeAI();
|
||||
Talk(SAY_SUMMON);
|
||||
DoZoneInCombat(nullptr, 100.0f);
|
||||
|
||||
if (GameObject* challenge = instance->instance->GetGameObject(instance->GetGuidData(GO_UROK_CHALLENGE)))
|
||||
{
|
||||
challenge->Delete();
|
||||
}
|
||||
|
||||
if (GameObject* pile = instance->instance->GetGameObject(instance->GetGuidData(GO_UROK_PILE)))
|
||||
{
|
||||
pile->DespawnOrUnsummon(0ms, Seconds(MONTH));
|
||||
}
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/) override
|
||||
@@ -70,11 +75,6 @@ public:
|
||||
events.ScheduleEvent(SPELL_INTIMIDATING_ROAR, urand(25000, 30000));
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*killer*/) override
|
||||
{
|
||||
_JustDied();
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
|
||||
@@ -376,7 +376,7 @@ public:
|
||||
case DATA_UROK_DOOMHOWL:
|
||||
if (data == FAIL)
|
||||
{
|
||||
if (!(GetBossState(DATA_UROK_DOOMHOWL) == NOT_STARTED))
|
||||
if (GetBossState(DATA_UROK_DOOMHOWL) != NOT_STARTED)
|
||||
{
|
||||
SetBossState(DATA_UROK_DOOMHOWL, NOT_STARTED);
|
||||
if (GameObject* challenge = instance->GetGameObject(go_urokChallenge))
|
||||
@@ -395,7 +395,7 @@ public:
|
||||
circle->Delete();
|
||||
}
|
||||
}
|
||||
for (const auto& mobGUID: UrokMobs)
|
||||
for (const auto& mobGUID : UrokMobs)
|
||||
{
|
||||
if (Creature* mob = instance->GetCreature(mobGUID))
|
||||
{
|
||||
@@ -510,6 +510,10 @@ public:
|
||||
return go_emberseerrunes[6];
|
||||
case GO_PORTCULLIS_ACTIVE:
|
||||
return go_portcullis_active;
|
||||
case GO_UROK_PILE:
|
||||
return go_urokPile;
|
||||
case GO_UROK_CHALLENGE:
|
||||
return go_urokChallenge;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user