Merge branch 'azerothcore:master' into Playerbot

This commit is contained in:
ZhengPeiRu21
2022-09-28 17:09:45 -06:00
committed by GitHub
17 changed files with 563 additions and 11 deletions

View File

@@ -15,9 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CreatureGroups.h"
#include "InstanceScript.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "TaskScheduler.h"
#include "temple_of_ahnqiraj.h"
ObjectData const creatureData[] =
@@ -69,6 +71,8 @@ public:
uint32 BugTrioDeathCount;
uint32 CthunPhase;
TaskScheduler scheduler;
void Initialize() override
{
BugTrioDeathCount = 0;
@@ -140,6 +144,37 @@ public:
InstanceScript::OnGameObjectCreate(go);
}
void OnUnitDeath(Unit* unit) override
{
switch (unit->GetEntry())
{
case NPC_QIRAJI_SLAYER:
case NPC_QIRAJI_MINDSLAYER:
if (Creature* creature = unit->ToCreature())
{
if (CreatureGroup* formation = creature->GetFormation())
{
scheduler.Schedule(100ms, [formation](TaskContext /*context*/)
{
if (!formation->IsAnyMemberAlive(true))
{
if (Creature* leader = formation->GetLeader())
{
if (leader->IsAlive())
{
leader->AI()->SetData(0, 1);
}
}
}
});
}
}
break;
default:
break;
}
}
uint32 GetData(uint32 type) const override
{
switch (type)
@@ -217,6 +252,11 @@ public:
return true;
}
void Update(uint32 diff) override
{
scheduler.Update(diff);
}
};
};

View File

@@ -59,7 +59,14 @@ enum Spells
// Obsidian Nullifier
SPELL_NULLIFY = 26552,
SPELL_CLEAVE = 40504
SPELL_CLEAVE = 40504,
// Qiraji Scorpion
// Qiraji Scarab
SPELL_PIERCE_ARMOR = 6016,
SPELL_ACID_SPIT = 26050,
NPC_QIRAJI_SCORPION = 15317
};
struct npc_anubisath_defender : public ScriptedAI
@@ -427,6 +434,74 @@ private:
std::list<Player*> _targets;
};
struct npc_ahnqiraji_critter : public ScriptedAI
{
npc_ahnqiraji_critter(Creature* creature) : ScriptedAI(creature)
{
}
void Reset() override
{
me->RestoreFaction();
_scheduler.CancelAll();
_scheduler.Schedule(100ms, [this](TaskContext context)
{
if (Player* player = me->SelectNearestPlayer(10.f))
{
if (player->IsInCombat())
{
AttackStart(player);
}
}
context.Repeat(3500ms, 4000ms);
});
}
void EnterCombat(Unit* /*who*/) override
{
_scheduler.CancelAll();
if (me->GetEntry() == NPC_QIRAJI_SCORPION)
{
_scheduler.Schedule(2s, 5s, [this](TaskContext context)
{
DoCastVictim(SPELL_PIERCE_ARMOR, true);
context.Repeat(5s, 9s);
})
.Schedule(5s, 9s, [this](TaskContext context)
{
DoCastVictim(SPELL_ACID_SPIT, true);
context.Repeat(6s, 12s);
});
}
}
void JustDied(Unit* /*killer*/) override
{
if (me->GetEntry() == NPC_QIRAJI_SCORPION)
{
me->DespawnOrUnsummon(5 * IN_MILLISECONDS);
}
}
void UpdateAI(uint32 diff) override
{
_scheduler.Update(diff);
if (!UpdateVictim())
{
return;
}
DoMeleeAttackIfReady();
}
private:
TaskScheduler _scheduler;
};
enum NPCs
{
NPC_VEKNISS_DRONE = 15300
@@ -484,6 +559,7 @@ void AddSC_temple_of_ahnqiraj()
RegisterTempleOfAhnQirajCreatureAI(npc_obsidian_eradicator);
RegisterTempleOfAhnQirajCreatureAI(npc_anubisath_warder);
RegisterTempleOfAhnQirajCreatureAI(npc_obsidian_nullifier);
RegisterTempleOfAhnQirajCreatureAI(npc_ahnqiraji_critter);
RegisterSpellScript(spell_aggro_drones);
RegisterSpellScript(spell_nullify);
}

View File

@@ -75,7 +75,10 @@ enum Creatures
NPC_VEKNILASH = 15275,
NPC_OURO = 15517,
NPC_OURO_SPAWNER = 15957,
NPC_SARTURA = 15516
NPC_SARTURA = 15516,
NPC_QIRAJI_SLAYER = 15250,
NPC_QIRAJI_MINDSLAYER = 15246
};
enum ObjectsAQ40

View File

@@ -3403,9 +3403,7 @@ class spell_item_chicken_cover : public SpellScript
enum Refocus
{
SPELL_AIMED_SHOT = 19434,
SPELL_MULTISHOT = 2643,
SPELL_VOLLEY = 42243,
SPELL_CATEGORY_AIMED_MULTI = 85
};
class spell_item_refocus : public SpellScript
@@ -3419,9 +3417,7 @@ class spell_item_refocus : public SpellScript
if (!caster || caster->getClass() != CLASS_HUNTER)
return;
caster->RemoveSpellCooldown(SPELL_AIMED_SHOT, true);
caster->RemoveSpellCooldown(SPELL_MULTISHOT, true);
caster->RemoveSpellCooldown(SPELL_VOLLEY, true);
caster->RemoveCategoryCooldown(SPELL_CATEGORY_AIMED_MULTI);
}
void Register() override