fix(Core/ZulGurub): more improvements to High Priestess Jeklik (#11604)

* Fix(Core/ZulGurub): more improvements to High Priestess Jeklik

* remove old comment

* cancel phase one events on phase 2

* Update src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp

Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>

* Update src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp

Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>

* style

* build

Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
This commit is contained in:
Nefertumm
2022-06-03 09:26:18 -03:00
committed by GitHub
parent c027e907e1
commit 8e0b1ca286
2 changed files with 209 additions and 184 deletions
@@ -0,0 +1,8 @@
--
UPDATE `creature_template` SET `speed_run` = 1.14286, `speed_walk` = 1.32 WHERE `entry` = 14517;
DELETE FROM `spell_script_names` WHERE `ScriptName` = 'spell_batrider_bomb';
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(23970, 'spell_batrider_bomb');
UPDATE `gameobject_template` SET `Data2` = 6 WHERE `entry` = 180125;
@@ -15,8 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>. * with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "GameObjectAI.h"
#include "ScriptMgr.h" #include "ScriptMgr.h"
#include "ScriptedCreature.h" #include "ScriptedCreature.h"
#include "SpellScript.h"
#include "TaskScheduler.h"
#include "zulgurub.h" #include "zulgurub.h"
enum Says enum Says
@@ -49,7 +52,8 @@ enum Spells
SPELL_GREATER_HEAL = 23954, SPELL_GREATER_HEAL = 23954,
// Batriders Spell // Batriders Spell
SPELL_BOMB = 40332 // Wrong ID but Magmadars bomb is not working... SPELL_THROW_LIQUID_FIRE = 23970,
SPELL_SUMMON_LIQUID_FIRE = 23971
}; };
enum BatIds enum BatIds
@@ -93,18 +97,15 @@ Position const SpawnBat[6] =
{ -12293.6220f, -1380.2640f, 144.8304f, 5.483f } { -12293.6220f, -1380.2640f, 144.8304f, 5.483f }
}; };
class boss_jeklik : public CreatureScript struct boss_jeklik : public BossAI
{ {
public: boss_jeklik(Creature* creature) : BossAI(creature, DATA_JEKLIK) { }
boss_jeklik() : CreatureScript("boss_jeklik") { }
struct boss_jeklikAI : public BossAI
{
boss_jeklikAI(Creature* creature) : BossAI(creature, DATA_JEKLIK) { }
void Reset() override void Reset() override
{ {
DoCastSelf(SPELL_GREEN_CHANNELING); DoCastSelf(SPELL_GREEN_CHANNELING);
me->SetHover(false);
me->SetDisableGravity(false);
_Reset(); _Reset();
} }
@@ -114,12 +115,21 @@ public:
Talk(SAY_DEATH); Talk(SAY_DEATH);
} }
void EnterEvadeMode(EvadeReason why) override
{
const Position homePos = me->GetHomePosition();
me->NearTeleportTo(homePos.GetPositionX(), homePos.GetPositionY(), homePos.GetPositionZ(), homePos.GetOrientation());
BossAI::EnterEvadeMode(why);
}
void EnterCombat(Unit* /*who*/) override void EnterCombat(Unit* /*who*/) override
{ {
_EnterCombat(); _EnterCombat();
Talk(SAY_AGGRO); Talk(SAY_AGGRO);
me->RemoveAurasDueToSpell(SPELL_GREEN_CHANNELING); me->RemoveAurasDueToSpell(SPELL_GREEN_CHANNELING);
me->SetHover(true);
me->SetDisableGravity(true); me->SetDisableGravity(true);
me->AddUnitState(UNIT_STATE_IGNORE_PATHFINDING);
DoCastSelf(SPELL_BAT_FORM); DoCastSelf(SPELL_BAT_FORM);
events.SetPhase(PHASE_ONE); events.SetPhase(PHASE_ONE);
@@ -131,14 +141,16 @@ public:
events.ScheduleEvent(EVENT_SPAWN_BATS, 30000, PHASE_ONE); events.ScheduleEvent(EVENT_SPAWN_BATS, 30000, PHASE_ONE);
} }
void DamageTaken(Unit*, uint32& /*damage*/, DamageEffectType, SpellSchoolMask) override void DamageTaken(Unit* /*who*/, uint32& /*damage*/, DamageEffectType, SpellSchoolMask) override
{ {
if (events.IsInPhase(PHASE_ONE) && !HealthAbovePct(50)) if (events.IsInPhase(PHASE_ONE) && !HealthAbovePct(50))
{ {
me->RemoveAurasDueToSpell(SPELL_BAT_FORM); me->RemoveAurasDueToSpell(SPELL_BAT_FORM);
me->SetHover(false);
me->SetDisableGravity(false); me->SetDisableGravity(false);
DoResetThreat(); DoResetThreat();
events.SetPhase(PHASE_TWO); events.SetPhase(PHASE_TWO);
events.CancelEventGroup(PHASE_ONE);
events.ScheduleEvent(EVENT_CURSE_OF_BLOOD, urand(5000, 15000), PHASE_TWO); events.ScheduleEvent(EVENT_CURSE_OF_BLOOD, urand(5000, 15000), PHASE_TWO);
events.ScheduleEvent(EVENT_SHADOW_WORD_PAIN, urand(10000, 15000), PHASE_TWO); events.ScheduleEvent(EVENT_SHADOW_WORD_PAIN, urand(10000, 15000), PHASE_TWO);
@@ -225,7 +237,7 @@ public:
Talk(SAY_CALL_RIDERS); Talk(SAY_CALL_RIDERS);
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
if (Creature* flyingBat = me->SummonCreature(NPC_FRENZIED_BAT, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ() + 15.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) if (Creature* flyingBat = me->SummonCreature(NPC_FRENZIED_BAT, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ() + 15.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000))
flyingBat->AI()->AttackStart(target); flyingBat->AI()->DoZoneInCombat();
events.ScheduleEvent(EVENT_SPAWN_FLYING_BATS, urand(10000, 15000), PHASE_TWO); events.ScheduleEvent(EVENT_SPAWN_FLYING_BATS, urand(10000, 15000), PHASE_TWO);
break; break;
default: default:
@@ -237,70 +249,75 @@ public:
} }
}; };
CreatureAI* GetAI(Creature* creature) const override
{
return GetZulGurubAI<boss_jeklikAI>(creature);
}
};
// Flying Bat // Flying Bat
class npc_batrider : public CreatureScript struct npc_batrider : public ScriptedAI
{ {
public: npc_batrider(Creature* creature) : ScriptedAI(creature)
npc_batrider() : CreatureScript("npc_batrider") { }
struct npc_batriderAI : public ScriptedAI
{ {
npc_batriderAI(Creature* creature) : ScriptedAI(creature) { } _scheduler.SetValidator([this]
{
uint32 Bomb_Timer; return !me->HasUnitState(UNIT_STATE_CASTING);
});
}
void Reset() override void Reset() override
{ {
Bomb_Timer = 2000; _scheduler.CancelAll();
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE); me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetHover(true);
me->SetDisableGravity(true);
me->AddUnitState(UNIT_STATE_ROOT); me->AddUnitState(UNIT_STATE_ROOT);
} }
void EnterCombat(Unit* /*who*/) override { } void EnterCombat(Unit* /*who*/) override
{
_scheduler.Schedule(2s, [this](TaskContext context)
{
DoCastRandomTarget(SPELL_THROW_LIQUID_FIRE);
context.Repeat(7s);
});
}
void UpdateAI(uint32 diff) override void UpdateAI(uint32 diff) override
{ {
if (!UpdateVictim()) if (!UpdateVictim())
return; return;
if (Bomb_Timer <= diff) _scheduler.Update(diff);
{
std::list<Unit*> targets;
SelectTargetList(targets, 1, SelectTargetMethod::Random, 500.0f, true);
if (!targets.empty())
{
if (targets.size() > 1)
{
targets.resize(1);
}
} }
for (std::list<Unit*>::iterator itr = targets.begin(); itr != targets.end(); ++itr) private:
{ TaskScheduler _scheduler;
me->CastSpell((*itr), SPELL_BOMB);
}
Bomb_Timer = 7000;
}
else
Bomb_Timer -= diff;
}
}; };
CreatureAI* GetAI(Creature* creature) const override class spell_batrider_bomb : public SpellScript
{ {
return GetZulGurubAI<npc_batriderAI>(creature); PrepareSpellScript(spell_batrider_bomb);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_SUMMON_LIQUID_FIRE });
}
void HandleScriptEffect(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (Unit* target = GetHitUnit())
{
target->CastSpell(target, SPELL_SUMMON_LIQUID_FIRE, true);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_batrider_bomb::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
} }
}; };
void AddSC_boss_jeklik() void AddSC_boss_jeklik()
{ {
new boss_jeklik(); RegisterCreatureAI(boss_jeklik);
new npc_batrider(); RegisterCreatureAI(npc_batrider);
RegisterSpellScript(spell_batrider_bomb);
} }