fix(Scripts/DB): Jiklik's bats from phase 2 now won't engage players… (#8142)

This commit is contained in:
Ragelezz
2021-11-16 15:42:08 +02:00
committed by GitHub
parent a72b4d9121
commit 6a2d817daf
2 changed files with 21 additions and 5 deletions
@@ -0,0 +1,6 @@
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1632863354170415400');
UPDATE `creature_template` SET `InhabitType`=4 WHERE `entry`=14965;
UPDATE `creature_template` SET `ScriptName`='npc_batrider' WHERE `entry`=14965;
@@ -221,6 +221,7 @@ public:
{ {
Bomb_Timer = 2000; Bomb_Timer = 2000;
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->AddUnitState(UNIT_STATE_ROOT);
} }
void EnterCombat(Unit* /*who*/) override { } void EnterCombat(Unit* /*who*/) override { }
@@ -232,16 +233,25 @@ public:
if (Bomb_Timer <= diff) if (Bomb_Timer <= diff)
{ {
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) std::list<Unit*> targets;
SelectTargetList(targets, 1, SELECT_TARGET_RANDOM, 500.0f, true);
if (!targets.empty())
{ {
DoCast(target, SPELL_BOMB); if (targets.size() > 1)
Bomb_Timer = 5000; {
targets.resize(1);
} }
} }
for (std::list<Unit*>::iterator itr = targets.begin(); itr != targets.end(); ++itr)
{
me->CastSpell((*itr), SPELL_BOMB);
}
Bomb_Timer = 7000;
}
else else
Bomb_Timer -= diff; Bomb_Timer -= diff;
DoMeleeAttackIfReady();
} }
}; };