fix(Scripts/BlackwingLair): Razorgore improvements (#10971)

- Rewrite reset events
- Use proper healing spell on phase transition
- Now uses abilities during phase 1
- Phase transition scripted - mobs now run away
This commit is contained in:
Skjalf
2022-03-23 15:42:34 -03:00
committed by GitHub
parent 6a6d0e5907
commit 7377c96cc8
12 changed files with 212 additions and 32 deletions

View File

@@ -334,6 +334,9 @@ public:
static AISpellInfoType* AISpellInfo;
static void FillAISpellInfo();
// Called when a summon reaches a waypoint or point movement finished.
virtual void SummonMovementInform(Creature* /*creature*/, uint32 /*motionType*/, uint32 /*point*/) { }
virtual void sGossipHello(Player* /*player*/) {}
virtual void sGossipSelect(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/) {}
virtual void sGossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, char const* /*code*/) {}

View File

@@ -3524,3 +3524,8 @@ void Creature::SetRespawnTime(uint32 respawn)
{
m_respawnTime = respawn ? GameTime::GetGameTime().count() + respawn : 0;
}
void Creature::SetCorpseRemoveTime(uint32 delay)
{
m_corpseRemoveTime = GameTime::GetGameTime().count() + delay;
}

View File

@@ -69,6 +69,7 @@ public:
void GetRespawnPosition(float& x, float& y, float& z, float* ori = nullptr, float* dist = nullptr) const;
void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; }
void SetCorpseRemoveTime(uint32 delay);
[[nodiscard]] uint32 GetCorpseDelay() const { return m_corpseDelay; }
[[nodiscard]] bool IsRacialLeader() const { return GetCreatureTemplate()->RacialLeader; }
[[nodiscard]] bool IsCivilian() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_CIVILIAN; }
@@ -395,7 +396,7 @@ protected:
ObjectGuid::LowType m_lootRecipientGroup;
/// Timers
time_t m_corpseRemoveTime; // (msecs)timer for death or corpse disappearance
time_t m_corpseRemoveTime; // (secs) timer for death or corpse disappearance
time_t m_respawnTime; // (secs) time of next respawn
time_t m_respawnedTime; // (secs) time when creature respawned
uint32 m_respawnDelay; // (secs) delay between corpse disappearance and respawning

View File

@@ -408,6 +408,22 @@ void InstanceScript::DoRespawnGameObject(ObjectGuid uiGuid, uint32 uiTimeToDespa
}
}
void InstanceScript::DoRespawnCreature(ObjectGuid guid, bool force)
{
if (Creature* creature = instance->GetCreature(guid))
{
creature->Respawn(force);
}
}
void InstanceScript::DoRespawnCreature(uint32 type, bool force)
{
if (Creature* creature = instance->GetCreature(GetObjectGuid(type)))
{
creature->Respawn(force);
}
}
void InstanceScript::DoUpdateWorldState(uint32 uiStateId, uint32 uiStateData)
{
Map::PlayerList const& lPlayers = instance->GetPlayers();

View File

@@ -194,6 +194,12 @@ public:
//Respawns a GO having negative spawntimesecs in gameobject-table
void DoRespawnGameObject(ObjectGuid guid, uint32 timeToDespawn = MINUTE);
// Respawns a creature.
void DoRespawnCreature(ObjectGuid guid, bool force = false);
// Respawns a creature from the creature object storage.
void DoRespawnCreature(uint32 type, bool force = false);
//sends world state update to all players in instance
void DoUpdateWorldState(uint32 worldstateId, uint32 worldstateValue);

View File

@@ -197,6 +197,14 @@ template <> void PointMovementGenerator<Creature>::MovementInform(Creature* unit
{
if (unit->AI())
unit->AI()->MovementInform(POINT_MOTION_TYPE, id);
if (Unit* summoner = unit->GetCharmerOrOwner())
{
if (UnitAI* AI = summoner->GetAI())
{
AI->SummonMovementInform(unit, POINT_MOTION_TYPE, id);
}
}
}
template void PointMovementGenerator<Player>::DoInitialize(Player*);

View File

@@ -256,6 +256,14 @@ void WaypointMovementGenerator<Creature>::MovementInform(Creature* creature)
{
if (creature->AI())
creature->AI()->MovementInform(WAYPOINT_MOTION_TYPE, i_currentNode);
if (Unit* owner = creature->GetCharmerOrOwner())
{
if (UnitAI* AI = owner->GetAI())
{
AI->SummonMovementInform(creature, WAYPOINT_MOTION_TYPE, i_currentNode);
}
}
}
//----------------------------------------------------//

View File

@@ -4243,6 +4243,12 @@ void SpellMgr::LoadSpellInfoCorrections()
spellInfo->Effects[EFFECT_0].DieSides = 1250;
});
// Explosion - Razorgore
ApplySpellFix({ 20038 }, [](SpellInfo* spellInfo)
{
spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_50000_YARDS);
});
for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i)
{
SpellInfo* spellInfo = mSpellInfoMap[i];