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

@@ -406,13 +406,16 @@ bool CreatureGroup::IsFormationInCombat()
return false;
}
bool CreatureGroup::IsAnyMemberAlive()
bool CreatureGroup::IsAnyMemberAlive(bool ignoreLeader /*= false*/)
{
for (auto const& itr : m_members)
{
if (itr.first && itr.first->IsAlive())
{
return true;
if (!ignoreLeader || itr.first != m_leader)
{
return true;
}
}
}

View File

@@ -111,7 +111,7 @@ public:
void MemberEvaded(Creature* member);
void RespawnFormation(bool force = false);
[[nodiscard]] bool IsFormationInCombat();
[[nodiscard]] bool IsAnyMemberAlive();
[[nodiscard]] bool IsAnyMemberAlive(bool ignoreLeader = false);
private:
Creature* m_leader; //Important do not forget sometimes to work with pointers instead synonims :D:D

View File

@@ -1800,6 +1800,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
switch (GetId())
{
case 47788: // Guardian Spirit
{
if (removeMode != AURA_REMOVE_BY_EXPIRE)
break;
if (caster->GetTypeId() != TYPEID_PLAYER)
@@ -1821,6 +1822,15 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
player->SendDirectMessage(&data);
}
break;
}
case 47585: // Dispersion (fixed bug invisible as a Shadow Priest)
{
if (target->IsMounted())
{
target->CastSpell(target, 53444, true);
}
break;
}
}
break;
case SPELLFAMILY_ROGUE:

View File

@@ -4391,12 +4391,24 @@ void SpellMgr::LoadSpellInfoCorrections()
spellInfo->SpellFamilyName = SPELLFAMILY_POTION;
});
// Refocus (Renataki's charm of beasts)
ApplySpellFix({ 24531 }, [](SpellInfo* spellInfo)
{
spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER);
});
// Collect Rookery Egg
ApplySpellFix({ 15958 }, [](SpellInfo* spellInfo)
{
spellInfo->Effects[EFFECT_1].Effect = 0;
});
// WotLK Prologue Frozen Shade Visual, temp used to restore visual after Dispersion
ApplySpellFix({ 53444 }, [](SpellInfo* spellInfo)
{
spellInfo->DurationEntry = sSpellDurationStore.LookupEntry(27);
});
for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i)
{
SpellInfo* spellInfo = mSpellInfoMap[i];

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