summoning rituals mechanic (#1017)

This commit is contained in:
sipertruk
2017-06-08 21:00:46 +02:00
committed by StadenElysium
parent f00d824425
commit aef7de716d
17 changed files with 437 additions and 326 deletions
@@ -42,6 +42,7 @@ enum
GO_GYTH_COMBAT_DOOR = 175185, // control in boss_script, because will auto-close after each wave
GO_GYTH_EXIT_DOOR = 175186,
GO_BLACKROCK_ALTAR = 175706,
GO_ROOM_7_RUNE = 175194,
GO_ROOM_3_RUNE = 175195,
@@ -137,6 +138,8 @@ class instance_blackrock_spire : public ScriptedInstance
uint64 m_uiEmberseerRune06GUID;
uint64 m_uiEmberseerRune07GUID;
uint64 m_uiBlackRockAltarGUID;
uint32 m_uiUBRSDoor_Timer;
uint32 m_uiUBRSDoor_Step;
@@ -60,6 +60,8 @@ struct boss_pyroguard_emberseerAI : public ScriptedAI
uint32 m_uiFlameBuffetTimer;
uint32 m_uiPyroBlastTimer;
std::set<Player*> sSummoners;
// NOSTALRIUS
bool initialized;
bool bCanalisationEnCours;
@@ -93,6 +95,8 @@ struct boss_pyroguard_emberseerAI : public ScriptedAI
// Tous doivent etre en vie au debut de l'event.
RespawnAddWarlocks();
if (!m_creature->HasAura(SPELL_SELF_CAGE))
m_creature->CastSpell(m_creature, SPELL_SELF_CAGE, false);
return true;
}
@@ -107,49 +111,51 @@ struct boss_pyroguard_emberseerAI : public ScriptedAI
return true;
}
void RefreshCanalisation(uint32 const diff)
void RefreshCanalisation()
{
if (!m_pInstance)
return;
std::vector<ObjectGuid>::iterator it;
if (!m_creature->HasAura(SPELL_SELF_CAGE))
m_creature->CastSpell(m_creature, SPELL_SELF_CAGE, false);
// Verification si la canalisation a commence
uint32 playerSummonersCount = 0;
uint32 requiredSummoners = REQUIRED_SUMMONERS;
Player* pSummoners[REQUIRED_SUMMONERS] = {NULL};
std::set<Player*>::iterator it;
GameObject* pGo = m_creature->GetMap()->GetGameObject(m_pInstance->GetData64(GO_BLACKROCK_ALTAR));
Map::PlayerList const &pl = m_creature->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator it2 = pl.begin(); it2 != pl.end(); ++it2)
{
Player* currPlayer = it2->getSource();
if (currPlayer && currPlayer->HasAura(AURA_PLAYER_CANALISATION))
if (currPlayer)
{
pSummoners[playerSummonersCount] = currPlayer;
if (currPlayer->isGameMaster()) // Debug mode
requiredSummoners = 1;
playerSummonersCount++;
if (playerSummonersCount >= requiredSummoners)
break;
it = sSummoners.find(currPlayer);
bool isUsing = pGo->HasUniqueUser(currPlayer);
if (isUsing && it == sSummoners.end())
sSummoners.insert(currPlayer);
else if (!isUsing && it != sSummoners.end())
sSummoners.erase(currPlayer);
}
}
}
if (playerSummonersCount >= requiredSummoners)
void StartWarlocksCombat()
{
std::set<Player*>::const_iterator itSummoners;
// Le combat avec les adds commence
m_pInstance->SetData(TYPE_EMBERSEER, SPECIAL);
for (auto it = canaliseurs.begin(); it != canaliseurs.end(); ++it)
{
// Le combat avec les adds commence
m_pInstance->SetData(TYPE_EMBERSEER, SPECIAL);
for (it = canaliseurs.begin(); it != canaliseurs.end(); ++it)
Creature *currCanaliseur = m_creature->GetMap()->GetCreature(*it);
if (!currCanaliseur)
continue;
currCanaliseur->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PASSIVE);
currCanaliseur->InterruptNonMeleeSpells(false);
if (currCanaliseur->AI())
{
Creature *currCanaliseur = m_creature->GetMap()->GetCreature(*it);
if (!currCanaliseur)
continue;
currCanaliseur->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PASSIVE);
currCanaliseur->InterruptNonMeleeSpells(false);
if (currCanaliseur->AI())
currCanaliseur->AI()->AttackStart(pSummoners[urand(0, requiredSummoners - 1)]);
itSummoners = sSummoners.begin();
if (itSummoners != sSummoners.end())
std::advance(itSummoners, urand(0, sSummoners.size() - 1));
currCanaliseur->AI()->AttackStart(*itSummoners);
}
bCanalisationEnCours = false;
bBossEnferme = true;
}
bCanalisationEnCours = false;
bBossEnferme = true;
}
void EventBossLiberation()
@@ -237,6 +243,8 @@ struct boss_pyroguard_emberseerAI : public ScriptedAI
m_pInstance->SetData(TYPE_EMBERSEER, FAIL);
RespawnAddWarlocks();
bCanalisationEnCours = true;
if (!m_creature->HasAura(SPELL_SELF_CAGE))
m_creature->CastSpell(m_creature, SPELL_SELF_CAGE, false);
}
void UpdateAI(const uint32 uiDiff)
@@ -251,7 +259,7 @@ struct boss_pyroguard_emberseerAI : public ScriptedAI
// Return since we have no target
if (bCanalisationEnCours)
{
RefreshCanalisation(uiDiff);
RefreshCanalisation();
return;
}
if (bBossEnferme)
@@ -300,6 +308,18 @@ struct boss_pyroguard_emberseerAI : public ScriptedAI
}
};
// Return true to avoid db script attempt
bool ProcessEventId_event_free_pyroguard_emberseer(uint32 eventId, Object* source, Object* target, bool isStart)
{
if (!source || source->GetTypeId() != TYPEID_PLAYER)
return true;
if (ScriptedInstance* instance = (ScriptedInstance*)((Player*)source)->GetInstanceData())
if (Creature* pyroguardEmberseer = source->ToPlayer()->GetMap()->GetCreature(instance->GetData64(NPC_PYROGUARD_EMBERSEER)))
if (boss_pyroguard_emberseerAI* bossAI = dynamic_cast<boss_pyroguard_emberseerAI*>(pyroguardEmberseer->AI()))
bossAI->StartWarlocksCombat();
return true;
}
CreatureAI* GetAI_boss_pyroguard_emberseer(Creature* pCreature)
{
return new boss_pyroguard_emberseerAI(pCreature);
@@ -410,4 +430,9 @@ void AddSC_boss_pyroguard_emberseer()
pNewScript->Name = "npc_geolier_main_noire";
pNewScript->GetAI = &GetAI_npc_geolier_main_noire;
pNewScript->RegisterSelf();
pNewScript = new Script;
pNewScript->Name = "event_free_pyroguard_emberseer";
pNewScript->pProcessEventId = &ProcessEventId_event_free_pyroguard_emberseer;
pNewScript->RegisterSelf();
}
@@ -82,6 +82,8 @@ instance_blackrock_spire::instance_blackrock_spire(Map* pMap) : ScriptedInstance
m_uiEmberseerRune06GUID(0),
m_uiEmberseerRune07GUID(0),
m_uiBlackRockAltarGUID(0),
m_uiUBRSDoor_Timer(0),
m_uiUBRSDoor_Step(0),
@@ -104,6 +106,9 @@ void instance_blackrock_spire::OnObjectCreate(GameObject* pGo)
{
switch (pGo->GetEntry())
{
case GO_BLACKROCK_ALTAR:
m_uiBlackRockAltarGUID = pGo->GetGUID();
break;
case GO_EMBERSEER_IN:
m_uiEmberseerInDoorGUID = pGo->GetGUID();
if (GetData(TYPE_ROOM_EVENT) == DONE)
@@ -225,7 +230,7 @@ void instance_blackrock_spire::OnCreatureCreate(Creature* pCreature)
switch (pCreature->GetEntry())
{
case NPC_PYROGUARD_EMBERSEER:
m_uiEmberseerGUID = pCreature->GetEntry();
m_uiEmberseerGUID = pCreature->GetGUID();
break;
case NPC_LORD_VICTOR_NEFARIUS:
m_uiNefariusGUID = pCreature->GetGUID();
@@ -494,6 +499,8 @@ uint64 instance_blackrock_spire::GetData64(uint32 uiType)
{
switch (uiType)
{
case GO_BLACKROCK_ALTAR:
return m_uiBlackRockAltarGUID;
case NPC_PYROGUARD_EMBERSEER:
return m_uiEmberseerGUID;
case NPC_LORD_VICTOR_NEFARIUS:
@@ -45,6 +45,16 @@ EndScriptData */
#define SAY_KILL "Reckless mortal."
#define SOUND_KILL 5858
// Return true to avoid db script attempt
bool ProcessEventId_event_awaken_archaedas(uint32 eventId, Object* source, Object* target, bool isStart)
{
if (!source || source->GetTypeId() != TYPEID_PLAYER)
return true;
ScriptedInstance* instance = (ScriptedInstance*)((Player*)source)->GetInstanceData();
instance->SetData(ULDAMAN_ENCOUNTER_ARCHAEDAS, IN_PROGRESS);
return true;
}
struct boss_archaedasAI : public ScriptedAI
{
boss_archaedasAI(Creature* pCreature) : ScriptedAI(pCreature)
@@ -399,122 +409,6 @@ CreatureAI* GetAI_mob_archaedas_minions(Creature* creature)
return new mob_archaedas_minionsAI(creature);
}
/* ScriptData
SDName: go_altar_archaedas
SD%Complete: 100
SDComment: Needs 1 person to activate the Archaedas script
SDCategory: Uldaman
EndScriptData */
bool GOHello_go_altar_of_archaedas(Player* pPlayer, GameObject* pGo)
{
ScriptedInstance* pInstance = (ScriptedInstance*)pGo->GetInstanceData();
if (!pInstance)
return false;
if (pPlayer)
pPlayer->CastSpell(nullptr, SPELL_ALTAR_SUMMONING_VISUAL, true);
return true;
}
struct go_altar_of_archaedasAI : public GameObjectAI
{
go_altar_of_archaedasAI(GameObject* gobj) : GameObjectAI(gobj)
{
instance = (ScriptedInstance*)gobj->GetInstanceData();
_gobjGuid = gobj->GetGUID();
_gobjType = gobj->GetGoType();
_gobj = gobj;
Reset();
}
ScriptedInstance* instance;
GameObject* _gobj;
uint64 _gobjGuid;
uint32 _gobjType;
bool _eventStarted;
uint32 _summonTimer;
void Reset()
{
_eventStarted = false;
_summonTimer = TIMER_ALTAR_SUMMON;
instance->SetData(DATA_ARCHAEDAS_ALTAR, NOT_STARTED);
}
uint32 CountSummoners()
{
const Map::PlayerList& players = me->GetMap()->GetPlayers();
uint32 count = 0;
for (auto it = players.begin(); it != players.end(); ++it)
{
if (Player* player = it->getSource())
{
if (Spell* spell = player->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
{
if (spell->m_spellInfo->Id == SPELL_ALTAR_SUMMONING_VISUAL)
{
if (_gobj->GetDistance2d(player) <= INTERACTION_DISTANCE)
{
++count;
}
}
}
}
}
return count;
}
void UpdateAI(const uint32 diff)
{
if (!instance ||
instance->GetData(ULDAMAN_ENCOUNTER_STONE_KEEPERS) != DONE ||
instance->GetData(ULDAMAN_ENCOUNTER_ARCHAEDAS) == DONE ||
instance->GetData(ULDAMAN_ENCOUNTER_ARCHAEDAS) == IN_PROGRESS)
{
return;
}
if (!_eventStarted)
{
if (CountSummoners() >= NEEDED_SUMMONERS)
{
instance->SetData(DATA_ARCHAEDAS_ALTAR, IN_PROGRESS); // activate the altar
instance->SetData(DATA_ANCIENT_DOOR, IN_PROGRESS); // close the vault door
_eventStarted = true;
}
return;
}
else if (CountSummoners() >= NEEDED_SUMMONERS)
{
if (_summonTimer <= diff)
{
Reset();
instance->SetData(ULDAMAN_ENCOUNTER_ARCHAEDAS, IN_PROGRESS); // activate archaedas
}
else
{
_summonTimer -= diff;
}
}
else
{
Reset();
if (instance->GetData(ULDAMAN_ENCOUNTER_ARCHAEDAS) != IN_PROGRESS)
instance->SetData(DATA_ANCIENT_DOOR, FAIL); // open the vault door
}
}
};
GameObjectAI* GetAI_go_altar_of_archaedas(GameObject* go)
{
return new go_altar_of_archaedasAI(go);
}
//This is the actual function called only once during InitScripts()
//It must define all handled functions that are to be run in this script
void AddSC_boss_archaedas()
@@ -532,8 +426,7 @@ void AddSC_boss_archaedas()
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "go_altar_of_archaedas";
newscript->GOGetAI = &GetAI_go_altar_of_archaedas;
newscript->pGOHello = &GOHello_go_altar_of_archaedas;
newscript->Name = "event_awaken_archaedas";
newscript->pProcessEventId = &ProcessEventId_event_awaken_archaedas;
newscript->RegisterSelf();
}
@@ -412,6 +412,8 @@ struct instance_uldaman : public ScriptedInstance
{
if (m_auiEncounter[ULDAMAN_ENCOUNTER_ARCHAEDAS] != IN_PROGRESS)
{
if (m_auiEncounter[ULDAMAN_ENCOUNTER_ARCHAEDAS] != DONE)
SetData(DATA_ANCIENT_DOOR, IN_PROGRESS);
if (archaedas)
{
if (archaedas->isAlive() && archaedas->getFaction() != FACTION_AWAKE)
@@ -52,6 +52,16 @@ bool GOHello_go_keystone_chamber(Player* pPlayer, GameObject* pGo)
return false;
}
// Return true to avoid db script attempt
bool ProcessEventId_event_awaken_stone_keeper(uint32 eventId, Object* source, Object* target, bool isStart)
{
if (!source || source->GetTypeId() != TYPEID_PLAYER)
return true;
ScriptedInstance* instance = (ScriptedInstance*)((Player*)source)->GetInstanceData();
instance->SetData(ULDAMAN_ENCOUNTER_STONE_KEEPERS, IN_PROGRESS);
return true;
}
struct mob_stone_keeperAI : public ScriptedAI
{
mob_stone_keeperAI(Creature* pCreature) : ScriptedAI(pCreature)
@@ -272,99 +282,6 @@ bool OnTrigger_at_map_chamber(Player* pPlayer, const AreaTriggerEntry *at)
return true;
}
bool GOHello_go_altar_of_the_keepers(Player* pPlayer, GameObject* pGo)
{
ScriptedInstance* pInstance = (ScriptedInstance*)pGo->GetInstanceData();
if (!pInstance)
return false;
if (pPlayer)
pPlayer->CastSpell(nullptr, SPELL_ALTAR_SUMMONING_VISUAL, true);
return true;
}
struct go_altar_of_the_keepersAI : public GameObjectAI
{
go_altar_of_the_keepersAI(GameObject* gobj) : GameObjectAI(gobj)
{
instance = (ScriptedInstance*)gobj->GetInstanceData();
Reset();
}
ScriptedInstance* instance;
bool _eventStarted;
uint32 _summonTimer;
void Reset()
{
_eventStarted = false;
_summonTimer = TIMER_ALTAR_SUMMON;
instance->SetData(DATA_KEEPERS_ALTAR, NOT_STARTED);
}
uint32 CountSummoners()
{
const Map::PlayerList& players = me->GetMap()->GetPlayers();
uint32 count = 0;
for (auto it = players.begin(); it != players.end(); ++it)
{
if (Player* player = it->getSource())
{
if (Spell* spell = player->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
{
if (spell->m_spellInfo->Id == SPELL_ALTAR_SUMMONING_VISUAL)
{
++count;
}
}
}
}
return count;
}
void UpdateAI(const uint32 diff)
{
if (!instance ||
instance->GetData(ULDAMAN_ENCOUNTER_STONE_KEEPERS) == DONE ||
instance->GetData(ULDAMAN_ENCOUNTER_STONE_KEEPERS) == IN_PROGRESS)
{
return;
}
if (!_eventStarted)
{
if (CountSummoners() >= NEEDED_SUMMONERS)
{
instance->SetData(DATA_KEEPERS_ALTAR, IN_PROGRESS); // activate the altar
_eventStarted = true;
}
return;
}
else if (CountSummoners() >= NEEDED_SUMMONERS)
{
if (_summonTimer <= diff)
{
Reset();
instance->SetData(ULDAMAN_ENCOUNTER_STONE_KEEPERS, IN_PROGRESS);
}
else
{
_summonTimer -= diff;
}
}
else
{
Reset();
}
}
};
GameObjectAI* GetAI_go_altar_of_the_keepers(GameObject* go)
{
return new go_altar_of_the_keepersAI(go);
}
struct AnnoraAI : public ScriptedAI
{
AnnoraAI(Creature* pCreature) : ScriptedAI(pCreature)
@@ -524,9 +441,8 @@ void AddSC_uldaman()
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "go_altar_of_the_keepers";
newscript->GOGetAI = &GetAI_go_altar_of_the_keepers;
newscript->pGOHello = &GOHello_go_altar_of_the_keepers;
newscript->Name = "event_awaken_stone_keeper";
newscript->pProcessEventId = &ProcessEventId_event_awaken_stone_keeper;
newscript->RegisterSelf();
newscript = new Script;
@@ -33,9 +33,6 @@ enum
DATA_ANCIENT_DOOR = 11,
DATA_ARCHAEDAS_ALTAR = 12,
// Altar summoning ritual
TIMER_ALTAR_SUMMON = 5000, // "Uldaman Boss Aggro" spellid=10340 has 5s cast
NEEDED_SUMMONERS = 3, // 3 in vanilla, 1 since 3.0.8
FACTION_AWAKE = 14, // aggressive
FACTION_STONED = 35, // friendly
@@ -67,10 +64,9 @@ enum
SPELL_ARCHAEDAS_AWAKEN = 10347,
SPELL_AWAKEN_EARTHEN_GUARDIAN = 10252,
SPELL_AWAKEN_VAULT_WARDER = 10258,
/* Not used here, supposed cast from altars summoning ritual objects
TODO when summoning rituals GO will work.
SPELL_ULDMANA_BOSS_AGGRO = 10340,
SPELL_ULDMANA_SUB_BOSS_AGGRO = 11568,*/
/* spells cast from summoning ritual altars, send scripted_event_id events
SPELL_ULDMAN_SUB_BOSS_AGGRO = 11568, event 2228 event_awaken_stone_keeper
SPELL_ULDMAN_BOSS_AGGRO = 10340, event 2268 event_awaken_archaedas*/
// Earthen Custodians
SPELL_RECONSTRUCT = 10260,
// Ironaya