Merge branch 'master' into Playerbot

# Conflicts:
#	src/server/game/Server/WorldSession.cpp
#	src/server/game/Server/WorldSession.h
This commit is contained in:
郑佩茹
2022-12-07 14:46:21 -07:00
196 changed files with 9181 additions and 1080 deletions

View File

@@ -322,7 +322,7 @@ public:
static bool HandleDeserterRemoveAll(ChatHandler* handler, bool isInstance, Optional<std::string> maxTime)
{
uint32 deserterSpell = isInstance ? LFG_SPELL_DUNGEON_DESERTER : BG_SPELL_DESERTER;
int32 remainTime = isInstance ? 1800 : 900;
int32 remainTime = isInstance ? 1800 : 1800;
uint64 deserterCount = 0;
bool countOnline = true;

View File

@@ -129,7 +129,7 @@ public:
}
handler->PSendSysMessage("%s", GitRevision::GetFullVersion());
handler->PSendSysMessage("Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
handler->PSendSysMessage("Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, OpenSSL_version(OPENSSL_VERSION));
handler->PSendSysMessage("Using Boost version: %i.%i.%i", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100);
handler->PSendSysMessage("Using MySQL version: %u", MySQL::GetLibraryVersion());
handler->PSendSysMessage("Using CMake version: %s", GitRevision::GetCMakeVersion());

View File

@@ -108,7 +108,25 @@ public:
bool CanAIAttack(Unit const* target) const override
{
return !(target->GetTypeId() == TYPEID_UNIT && !secondPhase) && !target->HasAura(SPELL_CONFLAGRATION);
if (target->GetTypeId() == TYPEID_UNIT && !secondPhase)
{
return false;
}
if (me->GetThreatMgr().GetThreatListSize() > 1)
{
ThreatContainer::StorageType::const_iterator lastRef = me->GetThreatMgr().GetOnlineContainer().GetThreatList().end();
--lastRef;
if (Unit* lastTarget = (*lastRef)->getTarget())
{
if (lastTarget != target)
{
return !target->HasAura(SPELL_CONFLAGRATION);
}
}
}
return true;
}
void EnterCombat(Unit* /*victim*/) override
@@ -244,9 +262,6 @@ public:
break;
case EVENT_CONFLAGRATION:
DoCastVictim(SPELL_CONFLAGRATION);
if (me->GetVictim() && me->GetVictim()->HasAura(SPELL_CONFLAGRATION))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1))
me->TauntApply(target);
events.ScheduleEvent(EVENT_CONFLAGRATION, 30000);
break;
}

View File

@@ -95,7 +95,7 @@ public:
}
case EVENT_IGNITE_MANA:
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, -SPELL_IGNITE_MANA))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, true, -SPELL_IGNITE_MANA))
{
DoCast(target, SPELL_IGNITE_MANA);
}

View File

@@ -94,10 +94,10 @@ public:
case EVENT_LAVA_BOMB_RANGED:
{
std::list<Unit*> targets;
SelectTargetList(targets, [this](Unit* target)
SelectTargetList(targets, 1, SelectTargetMethod::Random, 1, [this](Unit* target)
{
return target && target->IsPlayer() && target->GetDistance(me) > MELEE_TARGET_LOOKUP_DIST && target->GetDistance(me) < 100.0f;
}, 1, SelectTargetMethod::Random);
});
if (!targets.empty())
{

View File

@@ -71,7 +71,7 @@ public:
}
case EVENT_SHAZZRAH_CURSE:
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, -SPELL_SHAZZRAH_CURSE))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, true, -SPELL_SHAZZRAH_CURSE))
{
DoCast(target, SPELL_SHAZZRAH_CURSE);
}

View File

@@ -174,7 +174,7 @@ public:
}
case EVENT_SHADOW_WORD_PAIN:
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, -SPELL_SHADOW_WORD_PAIN))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, true, -SPELL_SHADOW_WORD_PAIN))
{
DoCast(target, SPELL_SHADOW_WORD_PAIN);
}
@@ -183,7 +183,7 @@ public:
}
case EVENT_IMMOLATE:
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, -SPELL_IMMOLATE))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, true, -SPELL_IMMOLATE))
{
DoCast(target, SPELL_IMMOLATE);
}

View File

@@ -112,6 +112,11 @@ public:
}
}
break;
case NPC_HYAKISS_THE_LURKER:
case NPC_SHADIKITH_THE_GLIDER:
case NPC_ROKAD_THE_RAVAGER:
SetBossState(DATA_OPTIONAL_BOSS, DONE);
break;
default:
break;
}
@@ -127,6 +132,17 @@ public:
else if (data == IN_PROGRESS)
OzDeathCount = 0;
break;
case DATA_SPAWN_OPERA_DECORATIONS:
{
for (ObjectGuid const& guid : _operaDecorations[data - 1])
{
DoRespawnGameObject(guid, DAY);
}
break;
}
default:
break;
}
}
@@ -220,20 +236,25 @@ public:
case GO_DUST_COVERED_CHEST:
DustCoveredChest = go->GetGUID();
break;
}
switch (OperaEvent)
{
/// @todo Set Object visibilities for Opera based on performance
case EVENT_OZ:
case GO_OZ_BACKDROP:
case GO_OZ_HAY:
_operaDecorations[EVENT_OZ - 1].push_back(go->GetGUID());
break;
case EVENT_HOOD:
case GO_HOOD_BACKDROP:
case GO_HOOD_TREE:
case GO_HOOD_HOUSE:
_operaDecorations[EVENT_HOOD - 1].push_back(go->GetGUID());
break;
case EVENT_RAJ:
case GO_RAJ_BACKDROP:
case GO_RAJ_MOON:
case GO_RAJ_BALCONY:
_operaDecorations[EVENT_RAJ - 1].push_back(go->GetGUID());
break;
default:
break;
}
InstanceScript::OnGameObjectCreate(go);
}
uint32 GetData(uint32 type) const override
@@ -315,6 +336,7 @@ public:
ObjectGuid ImageGUID;
ObjectGuid DustCoveredChest;
ObjectGuid m_uiRelayGUID;
GuidVector _operaDecorations[EVENT_RAJ];
};
};

View File

@@ -269,6 +269,8 @@ public:
}
RaidWiped = false;
instance->SetData(DATA_SPAWN_OPERA_DECORATIONS, m_uiEventId);
}
void UpdateAI(uint32 diff) override

View File

@@ -27,39 +27,39 @@ uint32 const EncounterCount = 12;
enum KZDataTypes
{
DATA_ATTUMEN = 0,
DATA_MOROES = 1,
DATA_MAIDEN = 2,
DATA_OPTIONAL_BOSS = 3,
DATA_OPERA_PERFORMANCE = 4,
DATA_CURATOR = 5,
DATA_ARAN = 6,
DATA_TERESTIAN = 7,
DATA_NETHERSPITE = 8,
DATA_CHESS = 9,
DATA_MALCHEZZAR = 10,
DATA_NIGHTBANE = 11,
DATA_SERVANT_QUARTERS = 12,
DATA_SELECTED_RARE = 13,
DATA_ATTUMEN = 0,
DATA_MOROES = 1,
DATA_MAIDEN = 2,
DATA_OPTIONAL_BOSS = 3,
DATA_OPERA_PERFORMANCE = 4,
DATA_CURATOR = 5,
DATA_ARAN = 6,
DATA_TERESTIAN = 7,
DATA_NETHERSPITE = 8,
DATA_CHESS = 9,
DATA_MALCHEZZAR = 10,
DATA_NIGHTBANE = 11,
DATA_SERVANT_QUARTERS = 12,
DATA_SELECTED_RARE = 13,
DATA_OPERA_OZ_DEATHCOUNT = 14,
DATA_KILREK = 15,
DATA_OPERA_OZ_DEATHCOUNT = 14,
MAX_ENCOUNTERS = 16,
DATA_KILREK = 15,
MAX_ENCOUNTERS = 16,
DATA_GO_CURTAINS = 18,
DATA_GO_STAGEDOORLEFT = 19,
DATA_GO_STAGEDOORRIGHT = 20,
DATA_GO_LIBRARY_DOOR = 21,
DATA_GO_MASSIVE_DOOR = 22,
DATA_GO_NETHER_DOOR = 23,
DATA_GO_GAME_DOOR = 24,
DATA_GO_GAME_EXIT_DOOR = 25,
DATA_IMAGE_OF_MEDIVH = 26,
DATA_MASTERS_TERRACE_DOOR_1 = 27,
DATA_MASTERS_TERRACE_DOOR_2 = 28,
DATA_GO_SIDE_ENTRANCE_DOOR = 29,
DATA_PRINCE = 30
DATA_GO_CURTAINS = 18,
DATA_GO_STAGEDOORLEFT = 19,
DATA_GO_STAGEDOORRIGHT = 20,
DATA_GO_LIBRARY_DOOR = 21,
DATA_GO_MASSIVE_DOOR = 22,
DATA_GO_NETHER_DOOR = 23,
DATA_GO_GAME_DOOR = 24,
DATA_GO_GAME_EXIT_DOOR = 25,
DATA_IMAGE_OF_MEDIVH = 26,
DATA_MASTERS_TERRACE_DOOR_1 = 27,
DATA_MASTERS_TERRACE_DOOR_2 = 28,
DATA_GO_SIDE_ENTRANCE_DOOR = 29,
DATA_PRINCE = 30,
DATA_SPAWN_OPERA_DECORATIONS = 31
};
enum KZOperaEvents
@@ -95,18 +95,28 @@ enum KZMiscCreatures
enum KZGameObjectIds
{
GO_STAGE_CURTAIN = 183932,
GO_STAGE_DOOR_LEFT = 184278,
GO_STAGE_DOOR_RIGHT = 184279,
GO_PRIVATE_LIBRARY_DOOR = 184517,
GO_MASSIVE_DOOR = 185521,
GO_GAMESMAN_HALL_DOOR = 184276,
GO_GAMESMAN_HALL_EXIT_DOOR = 184277,
GO_NETHERSPACE_DOOR = 185134,
GO_MASTERS_TERRACE_DOOR = 184274,
GO_MASTERS_TERRACE_DOOR2 = 184280,
GO_SIDE_ENTRANCE_DOOR = 184275,
GO_DUST_COVERED_CHEST = 185119
GO_STAGE_CURTAIN = 183932,
GO_STAGE_DOOR_LEFT = 184278,
GO_STAGE_DOOR_RIGHT = 184279,
GO_PRIVATE_LIBRARY_DOOR = 184517,
GO_MASSIVE_DOOR = 185521,
GO_GAMESMAN_HALL_DOOR = 184276,
GO_GAMESMAN_HALL_EXIT_DOOR = 184277,
GO_NETHERSPACE_DOOR = 185134,
GO_MASTERS_TERRACE_DOOR = 184274,
GO_MASTERS_TERRACE_DOOR2 = 184280,
GO_SIDE_ENTRANCE_DOOR = 184275,
GO_DUST_COVERED_CHEST = 185119,
// Opera event stage decoration
GO_OZ_BACKDROP = 183442,
GO_OZ_HAY = 183496,
GO_HOOD_BACKDROP = 183491,
GO_HOOD_TREE = 183492,
GO_HOOD_HOUSE = 183493,
GO_RAJ_BACKDROP = 183443,
GO_RAJ_MOON = 183494,
GO_RAJ_BALCONY = 183495
};
enum KZMisc

View File

@@ -140,7 +140,7 @@ public:
events.ScheduleEvent(EVENT_SPELL_STOMP, 30000);
break;
case EVENT_SPELL_BURN:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true, -SPELL_BURN_DAMAGE))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true, true, -SPELL_BURN_DAMAGE))
me->CastSpell(target, SPELL_BURN, false);
events.ScheduleEvent(EVENT_SPELL_BURN, 60000);
break;

View File

@@ -215,7 +215,7 @@ public:
break;
case EVENT_MARK_OF_ARLOKK:
{
Unit* target = SelectTarget(SelectTargetMethod::MaxThreat, urand(1, 3), 0.0f, false, -SPELL_MARK_OF_ARLOKK);
Unit* target = SelectTarget(SelectTargetMethod::MaxThreat, urand(1, 3), 0.0f, false, true, -SPELL_MARK_OF_ARLOKK);
if (!target)
target = me->GetVictim();
if (target)

View File

@@ -130,7 +130,7 @@ class spell_gahzranka_slam : public SpellScript
{
if (Unit* caster = GetCaster())
{
_wipeThreat = targets.size() < caster->GetThreatMgr().GetThreatListSize();;
_wipeThreat = targets.size() < caster->GetThreatMgr().GetThreatListSize();
}
}

View File

@@ -80,8 +80,18 @@ struct boss_hazzarah : public BossAI
bool CanAIAttack(Unit const* target) const override
{
if (me->GetThreatMgr().GetThreatListSize() > 1 && me->GetThreatMgr().GetOnlineContainer().getMostHated()->getTarget() == target)
return !target->HasAura(SPELL_SLEEP);
if (me->GetThreatMgr().GetThreatListSize() > 1)
{
ThreatContainer::StorageType::const_iterator lastRef = me->GetThreatMgr().GetOnlineContainer().GetThreatList().end();
--lastRef;
if (Unit* lastTarget = (*lastRef)->getTarget())
{
if (lastTarget != target)
{
return !target->HasAura(SPELL_SLEEP);
}
}
}
return true;
}

View File

@@ -154,8 +154,18 @@ struct boss_jindo : public BossAI
bool CanAIAttack(Unit const* target) const override
{
if (me->GetThreatMgr().GetThreatListSize() > 1 && me->GetThreatMgr().GetOnlineContainer().getMostHated()->getTarget() == target)
return !target->HasAura(SPELL_HEX);
if (me->GetThreatMgr().GetThreatListSize() > 1)
{
ThreatContainer::StorageType::const_iterator lastRef = me->GetThreatMgr().GetOnlineContainer().GetThreatList().end();
--lastRef;
if (Unit* lastTarget = (*lastRef)->getTarget())
{
if (lastTarget != target)
{
return !target->HasAura(SPELL_HEX);
}
}
}
return true;
}

View File

@@ -85,8 +85,18 @@ public:
bool CanAIAttack(Unit const* target) const override
{
if (me->GetThreatMgr().GetThreatListSize() > 1 && me->GetThreatMgr().GetOnlineContainer().getMostHated()->getTarget() == target)
return !target->HasAura(SPELL_GOUGE);
if (me->GetThreatMgr().GetThreatListSize() > 1)
{
ThreatContainer::StorageType::const_iterator lastRef = me->GetThreatMgr().GetOnlineContainer().GetThreatList().end();
--lastRef;
if (Unit* lastTarget = (*lastRef)->getTarget())
{
if (lastTarget != target)
{
return !target->HasAura(SPELL_GOUGE);
}
}
}
return true;
}

View File

@@ -1009,6 +1009,14 @@ class spell_brewfest_apple_trap : public SpellScript
{
PrepareSpellScript(spell_brewfest_apple_trap);
void FilterTargets(std::list<WorldObject*>& targets)
{
targets.remove_if(Acore::UnitAuraCheck(false, SPELL_RAM_FATIGUE));
if (targets.empty())
FinishCast(SPELL_FAILED_CASTER_AURASTATE);
}
void HandleDummyEffect(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
@@ -1018,6 +1026,7 @@ class spell_brewfest_apple_trap : public SpellScript
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_brewfest_apple_trap::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_brewfest_apple_trap::HandleDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -1768,7 +1777,7 @@ struct npc_coren_direbrew_sisters : public ScriptedAI
})
.Schedule(Seconds(2), [this](TaskContext mugChuck)
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, false, -SPELL_HAS_DARK_BREWMAIDENS_BREW))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, false, true, -SPELL_HAS_DARK_BREWMAIDENS_BREW))
{
DoCast(target, SPELL_CHUCK_MUG);
}

View File

@@ -156,7 +156,9 @@ enum eHallowsEndCandy
SPELL_HALLOWS_END_CANDY_1 = 24924,
SPELL_HALLOWS_END_CANDY_2 = 24925,
SPELL_HALLOWS_END_CANDY_3 = 24926,
SPELL_HALLOWS_END_CANDY_4 = 24927,
SPELL_HALLOWS_END_CANDY_3_FEMALE = 44742,
SPELL_HALLOWS_END_CANDY_3_MALE = 44743,
SPELL_HALLOWS_END_CANDY_4 = 24927
};
class spell_hallows_end_candy : public SpellScript
@@ -168,7 +170,7 @@ class spell_hallows_end_candy : public SpellScript
if (Player* target = GetHitPlayer())
{
uint32 spellId = SPELL_HALLOWS_END_CANDY_1 + urand(0, 3);
GetCaster()->CastSpell(target, spellId, true, nullptr);
GetCaster()->CastSpell(target, spellId, true);
}
}
@@ -178,6 +180,34 @@ class spell_hallows_end_candy : public SpellScript
}
};
class spell_hallows_end_candy_pirate_costume : public AuraScript
{
PrepareAuraScript(spell_hallows_end_candy_pirate_costume);
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* target = GetTarget())
{
target->CastSpell(target, target->getGender() == GENDER_MALE ? SPELL_HALLOWS_END_CANDY_3_MALE : SPELL_HALLOWS_END_CANDY_3_FEMALE, true);
}
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* target = GetTarget())
{
target->RemoveAurasDueToSpell(SPELL_HALLOWS_END_CANDY_3_MALE);
target->RemoveAurasDueToSpell(SPELL_HALLOWS_END_CANDY_3_FEMALE);
}
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_hallows_end_candy_pirate_costume::HandleEffectApply, EFFECT_0, SPELL_AURA_MOD_INCREASE_SWIM_SPEED, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_hallows_end_candy_pirate_costume::HandleEffectRemove, EFFECT_0, SPELL_AURA_MOD_INCREASE_SWIM_SPEED, AURA_EFFECT_HANDLE_REAL);
}
};
enum trickyTreat
{
SPELL_UPSET_TUMMY = 42966,
@@ -1426,6 +1456,7 @@ void AddSC_event_hallows_end_scripts()
RegisterSpellScript(spell_hallows_end_trick);
RegisterSpellScript(spell_hallows_end_trick_or_treat);
RegisterSpellScript(spell_hallows_end_candy);
RegisterSpellScript(spell_hallows_end_candy_pirate_costume);
RegisterSpellScript(spell_hallows_end_tricky_treat);
RegisterSpellScriptWithArgs(spell_hallows_end_put_costume, "spell_hallows_end_pirate_costume", SPELL_PIRATE_COSTUME_MALE, SPELL_PIRATE_COSTUME_FEMALE);
RegisterSpellScriptWithArgs(spell_hallows_end_put_costume, "spell_hallows_end_leper_costume", SPELL_LEPER_GNOME_COSTUME_MALE, SPELL_LEPER_GNOME_COSTUME_FEMALE);

View File

@@ -105,10 +105,10 @@ struct npc_obsidian_destroyer : public ScriptedAI
_scheduler.Schedule(6s, [this](TaskContext context)
{
std::list<Unit*> targets;
SelectTargetList(targets, [&](Unit* target)
SelectTargetList(targets, 6, SelectTargetMethod::Random, 1, [&](Unit* target)
{
return target && target->IsPlayer() && target->GetPower(POWER_MANA) > 0;
}, 6, SelectTargetMethod::Random);
});
for (Unit* target : targets)
{

View File

@@ -136,10 +136,7 @@ public:
bool operator()(Unit* unit) const
{
if (unit->GetTypeId() != TYPEID_PLAYER || unit->HasAura(SPELL_DIGESTIVE_ACID))
return false;
return true;
return unit->IsPlayer() && !unit->HasAura(SPELL_DIGESTIVE_ACID) && (unit->GetPositionZ() > 0.0f);
}
};
@@ -277,7 +274,7 @@ struct boss_eye_of_cthun : public BossAI
task.SetGroup(GROUP_BEAM_PHASE);
task.Repeat();
})
.Schedule(50s, [this](TaskContext /*task*/)
.Schedule(46s, [this](TaskContext /*task*/)
{
_scheduler.CancelGroup(GROUP_BEAM_PHASE);
@@ -446,15 +443,19 @@ struct boss_cthun : public BossAI
{
_scheduler.Schedule(13800ms, [this](TaskContext context)
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, -SPELL_DIGESTIVE_ACID))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, NotInStomachSelector()))
{
target->CastSpell(target, SPELL_MOUTH_TENTACLE, true);
target->m_Events.AddEventAtOffset([target, this]()
{
DoCast(target, SPELL_DIGESTIVE_ACID, true);
DoTeleportPlayer(target, STOMACH_X, STOMACH_Y, STOMACH_Z, STOMACH_O);
target->RemoveAurasDueToSpell(SPELL_MIND_FLAY);
target->m_Events.AddEventAtOffset([target, this]()
{
DoCast(target, SPELL_DIGESTIVE_ACID, true);
}, 2s);
}, 3800ms);
}
@@ -469,7 +470,7 @@ struct boss_cthun : public BossAI
context.Repeat(30s);
}).Schedule(8s, [this](TaskContext context)
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, -SPELL_DIGESTIVE_ACID))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, NotInStomachSelector()))
{
//Spawn claw tentacle on the random target
if (Creature* spawned = me->SummonCreature(NPC_GIANT_CLAW_TENTACLE, *target, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000))
@@ -481,7 +482,7 @@ struct boss_cthun : public BossAI
context.Repeat(1min);
}).Schedule(38s, [this](TaskContext context)
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, -SPELL_DIGESTIVE_ACID))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, NotInStomachSelector()))
{
//Spawn claw tentacle on the random target
if (Creature* spawned = me->SummonCreature(NPC_GIANT_EYE_TENTACLE, *target, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000))
@@ -637,7 +638,7 @@ struct npc_eye_tentacle : public ScriptedAI
})
.Schedule(1s, 5s, [this](TaskContext context)
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, [&](Unit* u) { return u && u->GetTypeId() == TYPEID_PLAYER && !u->HasAura(SPELL_DIGESTIVE_ACID) && !u->HasAura(SPELL_MIND_FLAY); }))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, NotInStomachSelector()))
{
DoCast(target, SPELL_MIND_FLAY);
}
@@ -925,7 +926,7 @@ struct npc_giant_eye_tentacle : public ScriptedAI
DoCastAOE(SPELL_MASSIVE_GROUND_RUPTURE);
}).Schedule(1s, 5s, [this](TaskContext context)
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, -SPELL_DIGESTIVE_ACID))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, NotInStomachSelector()))
{
DoCast(target, SPELL_GREEN_BEAM);
}

View File

@@ -49,7 +49,8 @@ enum Spells
SPELL_HEAL_BRETHEN = 26565,
SPELL_ENRAGE = 8599,
TALK_ENRAGE = 0
TALK_ENRAGE = 0,
TALK_SHARE_BUFFS = 1
};
class npc_anubisath_sentinel : public CreatureScript
@@ -275,6 +276,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
bool cast = false;
for (int ni = 0; ni < 3; ++ni)
{
Creature* sent = ObjectAccessor::GetCreature(*me, NearbyGUID[ni]);
@@ -282,10 +284,16 @@ public:
continue;
if (sent->isDead())
continue;
cast = true;
DoCast(sent, SPELL_HEAL_BRETHEN, true);
DoCast(sent, SPELL_TRANSFER_POWER, true);
}
if (cast)
{
Talk(TALK_SHARE_BUFFS);
}
DoCastSelf(SPELL_SUMMON_SMALL_OBSIDIAN_CHUNK, true);
}

View File

@@ -204,7 +204,7 @@ struct boss_amanitar : public BossAI
}
}
if (SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, -SPELL_MINI))
if (SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, true, -SPELL_MINI))
{
DoCastSelf(SPELL_REMOVE_MUSHROOM_POWER, true);
DoCastAOE(SPELL_MINI);

View File

@@ -224,7 +224,7 @@ public:
break;
case EVENT_ENERVATING_BRAND:
for (uint8 i = 0; i < RAID_MODE<uint8>(2, 4, 2, 4); i++)
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 45.0f, true, -SPELL_ENERVATING_BRAND))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 45.0f, true, true, -SPELL_ENERVATING_BRAND))
me->CastSpell(target, SPELL_ENERVATING_BRAND, true);
events.ScheduleEvent(EVENT_ENERVATING_BRAND, 26000);
break;
@@ -311,7 +311,7 @@ public:
break;
case EVENT_ENERVATING_BRAND:
for (uint8 i = 0; i < RAID_MODE<uint8>(4, 10, 4, 10); i++)
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 45.0f, true, -SPELL_ENERVATING_BRAND))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 45.0f, true, true, -SPELL_ENERVATING_BRAND))
me->CastSpell(target, SPELL_ENERVATING_BRAND, true);
_events.ScheduleEvent(EVENT_ENERVATING_BRAND, 26000);
break;

View File

@@ -399,7 +399,7 @@ public:
events.ScheduleEvent(EVENT_METEOR_STRIKE, 40000);
break;
case EVENT_FIERY_COMBUSTION:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100.0f, true, -SPELL_TWILIGHT_REALM))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100.0f, true, true, -SPELL_TWILIGHT_REALM))
me->CastSpell(target, SPELL_FIERY_COMBUSTION, false);
events.ScheduleEvent(EVENT_FIERY_COMBUSTION, 25000);
break;
@@ -542,7 +542,7 @@ public:
_events.ScheduleEvent(EVENT_BREATH, urand(10000, 12000));
break;
case EVENT_SOUL_CONSUMPTION:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100.0f, true, SPELL_TWILIGHT_REALM))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100.0f, true, true, SPELL_TWILIGHT_REALM))
me->CastSpell(target, SPELL_SOUL_CONSUMPTION, false);
_events.ScheduleEvent(EVENT_SOUL_CONSUMPTION, 20000);
break;

View File

@@ -211,12 +211,12 @@ public:
events.RepeatEvent(urand(10000, 15000));
break;
case EVENT_SPELL_FEL_LIGHTNING:
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, true) )
me->CastSpell(target, SPELL_FEL_LIGHTNING, false);
events.RepeatEvent(urand(10000, 15000));
break;
case EVENT_SPELL_INCINERATE_FLESH:
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, true) )
{
Talk(EMOTE_INCINERATE, target);
Talk(SAY_INCINERATE);
@@ -230,7 +230,7 @@ public:
events.RepeatEvent(urand(25000, 45000));
break;
case EVENT_SPELL_LEGION_FLAME:
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, true) )
{
Talk(EMOTE_LEGION_FLAME, target);
me->CastSpell(target, SPELL_LEGION_FLAME, false);

View File

@@ -1562,7 +1562,7 @@ public:
for (uint8 i = 3; i < PATH_WP_COUNT - 1; ++i)
path.push_back(G3D::Vector3(PathWaypoints[i].GetPositionX(), PathWaypoints[i].GetPositionY(), PathWaypoints[i].GetPositionZ()));
me->GetMotionMaster()->MoveSplinePath(&path);
me->GetMotionMaster()->propagateSpeedChange();
me->GetMotionMaster()->PropagateSpeedChange();
events.ScheduleEvent(EVENT_LK_SUMMON, 1000);
}
break;

View File

@@ -465,7 +465,7 @@ public:
switch (action)
{
case ACTION_MARK_OF_THE_FALLEN_CHAMPION:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true, -SPELL_MARK_OF_THE_FALLEN_CHAMPION))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true, true, -SPELL_MARK_OF_THE_FALLEN_CHAMPION))
{
++_fallenChampionCastCount;
me->CastSpell(target, SPELL_MARK_OF_THE_FALLEN_CHAMPION, false);

View File

@@ -235,7 +235,7 @@ public:
{
std::list<Unit*> targets;
uint32 minTargets = RAID_MODE<uint32>(3, 8, 3, 8);
SelectTargetList(targets, minTargets, SelectTargetMethod::Random, -5.0f, true);
SelectTargetList(targets, minTargets, SelectTargetMethod::Random, 0, -5.0f, true);
float minDist = 0.0f;
if (targets.size() >= minTargets)
minDist = -5.0f;

View File

@@ -445,7 +445,7 @@ public:
count = 3;
std::list<Unit*> targets;
SelectTargetList(targets, NonTankTargetSelector(me, true), count, SelectTargetMethod::Random);
SelectTargetList(targets, count, SelectTargetMethod::Random, 0, NonTankTargetSelector(me, true));
if (!targets.empty())
for (std::list<Unit*>::iterator itr = targets.begin(); itr != targets.end(); ++itr)
me->CastSpell(*itr, SPELL_SUMMON_SHADE, true);

View File

@@ -479,7 +479,7 @@ public:
void SelectTarget(std::list<WorldObject*>& targets)
{
targets.clear();
Unit* target = GetCaster()->GetAI()->SelectTarget(SelectTargetMethod::Random, 1, -1.0f, true, -SPELL_IMPALED); // -1.0f as it takes into account object size
Unit* target = GetCaster()->GetAI()->SelectTarget(SelectTargetMethod::Random, 1, -1.0f, true,true, -SPELL_IMPALED); // -1.0f as it takes into account object size
if (!target)
target = GetCaster()->GetAI()->SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true); // if only tank or noone outside of boss' model
if (!target)

View File

@@ -548,7 +548,7 @@ public:
case EVENT_SLIME_PUDDLE:
{
std::list<Unit*> targets;
SelectTargetList(targets, 2, SelectTargetMethod::Random, 0.0f, true);
SelectTargetList(targets, 2, SelectTargetMethod::Random, 0, 0.0f, true);
if (!targets.empty())
for (std::list<Unit*>::iterator itr = targets.begin(); itr != targets.end(); ++itr)
me->CastSpell(*itr, SPELL_SLIME_PUDDLE_TRIGGER, true);
@@ -634,7 +634,7 @@ public:
if (Is25ManRaid())
{
std::list<Unit*> targets;
SelectTargetList(targets, MalleableGooSelector(me), (IsHeroic() ? 3 : 2), SelectTargetMethod::Random);
SelectTargetList(targets, (IsHeroic() ? 3 : 2), SelectTargetMethod::Random, 0, MalleableGooSelector(me));
if (!targets.empty())
{

View File

@@ -315,7 +315,7 @@ public:
{
std::list<Unit*> targets;
uint32 minTargets = RAID_MODE<uint32>(3, 8, 3, 8);
SelectTargetList(targets, minTargets, SelectTargetMethod::Random, -5.0f, true);
SelectTargetList(targets, minTargets, SelectTargetMethod::Random, 0, -5.0f, true);
float minDist = 0.0f;
if (targets.size() >= minTargets)
minDist = -5.0f;

View File

@@ -625,7 +625,7 @@ public:
switch (eventId)
{
case EVENT_DEATH_PLAGUE:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true, -SPELL_RECENTLY_INFECTED))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true, true, -SPELL_RECENTLY_INFECTED))
{
Talk(EMOTE_DEATH_PLAGUE_WARNING, target);
DoCast(target, SPELL_DEATH_PLAGUE);
@@ -1175,7 +1175,7 @@ public:
Talk(SAY_SVALNA_AGGRO);
break;
case EVENT_IMPALING_SPEAR:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true, -SPELL_IMPALING_SPEAR))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true, true, -SPELL_IMPALING_SPEAR))
{
DoCast(me, SPELL_AETHER_SHIELD);
me->AddAura(70203, me);
@@ -1361,7 +1361,7 @@ public:
Events.ScheduleEvent(EVENT_ARNATH_SMITE, urand(4000, 7000));
break;
case EVENT_ARNATH_DOMINATE_MIND:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true, -SPELL_DOMINATE_MIND))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true, true, -SPELL_DOMINATE_MIND))
DoCast(target, SPELL_DOMINATE_MIND);
Events.ScheduleEvent(EVENT_ARNATH_DOMINATE_MIND, urand(28000, 37000));
break;

View File

@@ -177,7 +177,7 @@ public:
events.RepeatEvent(20000);
break;
case EVENT_MUTATING_INJECTION:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100.0f, true, -SPELL_MUTATING_INJECTION))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100.0f, true, true, -SPELL_MUTATING_INJECTION))
{
me->CastSpell(target, SPELL_MUTATING_INJECTION, false);
}

View File

@@ -427,7 +427,7 @@ public:
case EVENT_CHAINS:
for (uint8 i = 0; i < 3; ++i)
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 200, true, -SPELL_CHAINS_OF_KELTHUZAD))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 200, true, true, -SPELL_CHAINS_OF_KELTHUZAD))
{
me->CastSpell(target, SPELL_CHAINS_OF_KELTHUZAD, true);
}

View File

@@ -201,7 +201,7 @@ public:
Talk(EMOTE_WEB_WRAP);
for (uint8 i = 0; i < RAID_MODE(1, 2); ++i)
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0, true, -SPELL_WEB_WRAP))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0, true, true, -SPELL_WEB_WRAP))
{
target->RemoveAura(RAID_MODE(SPELL_WEB_SPRAY_10, SPELL_WEB_SPRAY_25));
uint8 pos = urand(0, 2);

View File

@@ -1505,7 +1505,7 @@ public:
{
uint8 i = 0;
std::list<Unit*> drakes;
c->AI()->SelectTargetList(drakes, (c->GetMap()->GetSpawnMode() == 0 ? 1 : 3), SelectTargetMethod::Random, 0.0f, false, 57403 /*only drakes have this aura*/);
c->AI()->SelectTargetList(drakes, (c->GetMap()->GetSpawnMode() == 0 ? 1 : 3), SelectTargetMethod::Random, 0, 0.0f, false, true, 57403 /*only drakes have this aura*/);
for (std::list<Unit*>::iterator itr = drakes.begin(); itr != drakes.end() && i < 3; ++itr)
{
DrakeGUID[i++] = (*itr)->GetGUID();

View File

@@ -197,7 +197,7 @@ public:
events.RepeatEvent(urand(4000, 5000));
break;
case EVENT_FROST_TOMB:
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true) )
if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, true) )
if( !target->HasAura(SPELL_FROST_TOMB_AURA) )
{
Talk(SAY_FROST_TOMB_EMOTE, target);

View File

@@ -191,6 +191,11 @@ public:
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
{
return;
}
if (Unit* caster = GetCaster())
if (Unit* target = GetTarget())
caster->CastSpell(target, 32830 /*POSSESS*/, true);

View File

@@ -44,18 +44,19 @@ public:
struct boss_broggokAI : public ScriptedAI
{
boss_broggokAI(Creature* creature) : ScriptedAI(creature)
boss_broggokAI(Creature* creature) : ScriptedAI(creature), summons(me)
{
instance = creature->GetInstanceScript();
}
InstanceScript* instance;
EventMap events;
SummonList summons;
bool canAttack;
void Reset() override
{
events.Reset();
summons.DespawnAll();
me->SetReactState(REACT_PASSIVE);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
@@ -73,10 +74,16 @@ public:
void JustSummoned(Creature* summoned) override
{
summons.Summon(summoned);
summoned->SetFaction(FACTION_MONSTER_2);
summoned->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
summoned->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
summoned->CastSpell(summoned, SPELL_POISON, false, 0, 0, me->GetGUID());
summoned->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
summoned->CastSpell(summoned, SPELL_POISON, true, 0, 0, me->GetGUID());
}
void SummonedCreatureDespawn(Creature* summon) override
{
summons.Despawn(summon);
}
void UpdateAI(uint32 diff) override

View File

@@ -132,6 +132,14 @@ public:
BossAI::EnterEvadeMode();
}
void SetData(uint32 type, uint32 data) override
{
if (type == 0 && data == 1)
{
summons.DoZoneInCombat(NPC_HELLFIRE_SENTRY);
}
}
void UpdateAI(uint32 /*diff*/) override
{
if (!me->IsVisible() && summons.size() == 0)
@@ -265,6 +273,7 @@ public:
void Reset() override
{
events.Reset();
_nazanCalled = false;
}
void EnterEvadeMode(EvadeReason /*why*/) override
@@ -288,9 +297,17 @@ public:
}
}
void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*type*/, SpellSchoolMask /*school*/) override
{
if (!_nazanCalled && me->HealthBelowPctDamaged(35, damage))
{
_nazanCalled = true;
me->CastSpell(me, SPELL_CALL_NAZAN, true);
}
}
void JustDied(Unit*) override
{
me->CastSpell(me, SPELL_CALL_NAZAN, true);
Talk(SAY_DIE);
}
@@ -316,6 +333,7 @@ public:
private:
EventMap events;
bool _nazanCalled;
};
CreatureAI* GetAI(Creature* creature) const override

View File

@@ -833,6 +833,9 @@ class spell_mage_master_of_elements : public AuraScript
{
PreventDefaultAction();
if (!_spellInfo)
return;
if (Unit* target = GetTarget())
{
int32 mana = int32(_spellInfo->CalcPowerCost(target, eventInfo.GetSchoolMask()) / _ticksModifier);