fix(Scripts/ZulAman): Amani Hatchers should hatch eggs at increasing … (#20497)
This commit is contained in:
@@ -0,0 +1,15 @@
|
|||||||
|
--
|
||||||
|
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 13 AND `SourceEntry` = 43734;
|
||||||
|
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
|
||||||
|
(13, 1, 43734, 0, 0, 31, 0, 3, 23817, 0, 0, 0, 0, '', 'Hatch Eggs can only hit Dragonhawk Egg');
|
||||||
|
|
||||||
|
UPDATE `creature_template` SET `AIName` = 'SmartAI', `ScriptName` = '' WHERE `entry` = 23817;
|
||||||
|
|
||||||
|
DELETE FROM `smart_scripts` WHERE (`entryorguid` = 23817) AND (`source_type` = 0) AND (`id` IN (0, 1));
|
||||||
|
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
|
||||||
|
(23817, 0, 0, 0, 8, 0, 100, 0, 42471, 0, 0, 0, 0, 0, 11, 42493, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Dragonhawk Egg - On Spellhit \'Hatch Eggs\' - Cast \'Summon Dragonhawk Hatchling\''),
|
||||||
|
(23817, 0, 1, 0, 8, 0, 100, 0, 43734, 0, 0, 0, 0, 0, 11, 42493, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Dragonhawk Egg - On Spellhit \'Hatch Eggs\' - Cast \'Summon Dragonhawk Hatchling\'');
|
||||||
|
|
||||||
|
DELETE FROM `creature_template_movement` WHERE `CreatureId` = 23598;
|
||||||
|
INSERT INTO `creature_template_movement` (`CreatureId`, `Ground`, `Flight`) VALUES
|
||||||
|
(23598, 1, 1);
|
||||||
@@ -15,13 +15,6 @@
|
|||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* ScriptData
|
|
||||||
SDName: Boss_Janalai
|
|
||||||
SD%Complete: 100
|
|
||||||
SDComment:
|
|
||||||
SDCategory: Zul'Aman
|
|
||||||
EndScriptData */
|
|
||||||
|
|
||||||
#include "CellImpl.h"
|
#include "CellImpl.h"
|
||||||
#include "CreatureScript.h"
|
#include "CreatureScript.h"
|
||||||
#include "GridNotifiers.h"
|
#include "GridNotifiers.h"
|
||||||
@@ -125,7 +118,13 @@ enum Misc
|
|||||||
|
|
||||||
struct boss_janalai : public BossAI
|
struct boss_janalai : public BossAI
|
||||||
{
|
{
|
||||||
boss_janalai(Creature* creature) : BossAI(creature, DATA_JANALAI) { }
|
boss_janalai(Creature* creature) : BossAI(creature, DATA_JANALAI)
|
||||||
|
{
|
||||||
|
scheduler.SetValidator([this]
|
||||||
|
{
|
||||||
|
return !me->HasUnitState(UNIT_STATE_CASTING);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void Reset() override
|
void Reset() override
|
||||||
{
|
{
|
||||||
@@ -134,18 +133,17 @@ struct boss_janalai : public BossAI
|
|||||||
_isBombing = false;
|
_isBombing = false;
|
||||||
_isFlameBreathing = false;
|
_isFlameBreathing = false;
|
||||||
|
|
||||||
ScheduleHealthCheckEvent(25, [&]{
|
|
||||||
DoCastSelf(SPELL_ENRAGE, true);
|
|
||||||
});
|
|
||||||
|
|
||||||
ScheduleHealthCheckEvent(35, [&]{
|
ScheduleHealthCheckEvent(35, [&]{
|
||||||
Talk(SAY_ALL_EGGS);
|
Talk(SAY_ALL_EGGS);
|
||||||
me->AttackStop();
|
me->AttackStop();
|
||||||
me->GetMotionMaster()->Clear();
|
me->GetMotionMaster()->Clear();
|
||||||
me->SetPosition(janalainPos);
|
me->SetPosition(janalainPos);
|
||||||
me->StopMovingOnCurrentPos();
|
me->StopMovingOnCurrentPos();
|
||||||
DoCastSelf(SPELL_HATCH_ALL);
|
DoCastAOE(SPELL_HATCH_ALL);
|
||||||
HatchAllEggs(HATCH_ALL);
|
});
|
||||||
|
|
||||||
|
ScheduleHealthCheckEvent(25, [&] {
|
||||||
|
DoCastSelf(SPELL_ENRAGE, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,19 +207,19 @@ struct boss_janalai : public BossAI
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (hatchAction == HATCH_RESET)
|
if (hatchAction == HATCH_RESET)
|
||||||
|
{
|
||||||
for (Creature* egg : eggList)
|
for (Creature* egg : eggList)
|
||||||
egg->Respawn();
|
egg->Respawn();
|
||||||
else if (hatchAction == HATCH_ALL)
|
|
||||||
DoCastSelf(SPELL_HATCH_EGG_ALL);
|
|
||||||
|
|
||||||
if (hatchAction == HATCH_RESET)
|
|
||||||
{
|
|
||||||
std::list<Creature* > hatchlingList;
|
std::list<Creature* > hatchlingList;
|
||||||
me->GetCreaturesWithEntryInRange(hatchlingList, 100.0f, NPC_HATCHLING);
|
me->GetCreaturesWithEntryInRange(hatchlingList, 100.0f, NPC_HATCHLING);
|
||||||
for (Creature* hatchling : hatchlingList)
|
for (Creature* hatchling : hatchlingList)
|
||||||
hatchling->DespawnOrUnsummon();
|
hatchling->DespawnOrUnsummon();
|
||||||
hatchlingList.clear();
|
hatchlingList.clear();
|
||||||
}
|
}
|
||||||
|
else if (hatchAction == HATCH_ALL)
|
||||||
|
DoCastSelf(SPELL_HATCH_EGG_ALL);
|
||||||
|
|
||||||
eggList.clear();
|
eggList.clear();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -239,9 +237,7 @@ struct boss_janalai : public BossAI
|
|||||||
: me->SummonCreature(NPC_FIRE_BOMB, fireWallCoords[i].GetPositionX() - 2 + 4 * j, fireWallCoords[i].GetPositionY(), fireWallCoords[i].GetPositionZ(), fireWallCoords[i].GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 15000);
|
: me->SummonCreature(NPC_FIRE_BOMB, fireWallCoords[i].GetPositionX() - 2 + 4 * j, fireWallCoords[i].GetPositionY(), fireWallCoords[i].GetPositionZ(), fireWallCoords[i].GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 15000);
|
||||||
|
|
||||||
if (wall)
|
if (wall)
|
||||||
{
|
|
||||||
wall->AI()->DoCastSelf(SPELL_FIRE_WALL, true);
|
wall->AI()->DoCastSelf(SPELL_FIRE_WALL, true);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -259,18 +255,16 @@ struct boss_janalai : public BossAI
|
|||||||
|
|
||||||
void Boom()
|
void Boom()
|
||||||
{
|
{
|
||||||
std::list<Creature*> fireBombs;
|
summons.DoForAllSummons([&](WorldObject* summon) {
|
||||||
me->GetCreaturesWithEntryInRange(fireBombs, 100.0f, NPC_FIRE_BOMB);
|
if (summon->GetEntry() == NPC_FIRE_BOMB)
|
||||||
|
{
|
||||||
if (fireBombs.empty())
|
if (Creature* bomb = summon->ToCreature())
|
||||||
return;
|
{
|
||||||
|
bomb->AI()->DoCastSelf(SPELL_FIRE_BOMB_DAMAGE, true);
|
||||||
for (Creature* bomb : fireBombs)
|
bomb->RemoveAllAuras();
|
||||||
{
|
}
|
||||||
bomb->AI()->DoCastSelf(SPELL_FIRE_BOMB_DAMAGE, true);
|
}
|
||||||
bomb->RemoveAllAuras();
|
});
|
||||||
}
|
|
||||||
fireBombs.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartBombing()
|
void StartBombing()
|
||||||
@@ -286,14 +280,11 @@ struct boss_janalai : public BossAI
|
|||||||
SpawnBombs();
|
SpawnBombs();
|
||||||
_isBombing = true;
|
_isBombing = true;
|
||||||
|
|
||||||
if (Map* map = me->GetMap())
|
me->GetMap()->DoForAllPlayers([&](Player* player)
|
||||||
{
|
{
|
||||||
map->DoForAllPlayers([&](Player* player)
|
if (player->IsAlive())
|
||||||
{
|
DoTeleportPlayer(player, janalainPos.GetPositionX() - 5 + rand() % 10, janalainPos.GetPositionY() - 5 + rand() % 10, janalainPos.GetPositionZ(), 0.0f);
|
||||||
if (player->IsAlive())
|
});
|
||||||
DoTeleportPlayer(player, janalainPos.GetPositionX() - 5 + rand() % 10, janalainPos.GetPositionY() - 5 + rand() % 10, janalainPos.GetPositionZ(), 0.0f);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//DoCast(Temp, SPELL_SUMMON_PLAYERS, true) // core bug, spell does not work if too far
|
//DoCast(Temp, SPELL_SUMMON_PLAYERS, true) // core bug, spell does not work if too far
|
||||||
ThrowBombs();
|
ThrowBombs();
|
||||||
|
|
||||||
@@ -308,20 +299,23 @@ struct boss_janalai : public BossAI
|
|||||||
|
|
||||||
void ThrowBombs()
|
void ThrowBombs()
|
||||||
{
|
{
|
||||||
std::list<Creature*> fireBombs;
|
|
||||||
std::chrono::milliseconds bombTimer = 100ms;
|
std::chrono::milliseconds bombTimer = 100ms;
|
||||||
me->GetCreaturesWithEntryInRange(fireBombs, 100.0f, NPC_FIRE_BOMB);
|
|
||||||
for (Creature* bomb : fireBombs)
|
summons.DoForAllSummons([this, &bombTimer](WorldObject* summon) {
|
||||||
{
|
if (summon->GetEntry() == NPC_FIRE_BOMB)
|
||||||
scheduler.Schedule(bombTimer, [this, bomb](TaskContext)
|
|
||||||
{
|
{
|
||||||
bomb->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
|
if (Creature* bomb = summon->ToCreature())
|
||||||
DoCast(bomb, SPELL_FIRE_BOMB_THROW, true);
|
{
|
||||||
bomb->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
|
bomb->m_Events.AddEventAtOffset([this, bomb] {
|
||||||
});
|
bomb->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
|
||||||
bombTimer = bombTimer + 100ms;
|
DoCast(bomb, SPELL_FIRE_BOMB_THROW, true);
|
||||||
}
|
bomb->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
|
||||||
fireBombs.clear();
|
}, bombTimer);
|
||||||
|
}
|
||||||
|
|
||||||
|
bombTimer += 100ms;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CheckEvadeIfOutOfCombatArea() const override
|
bool CheckEvadeIfOutOfCombatArea() const override
|
||||||
@@ -335,10 +329,7 @@ private:
|
|||||||
|
|
||||||
struct npc_janalai_hatcher : public ScriptedAI
|
struct npc_janalai_hatcher : public ScriptedAI
|
||||||
{
|
{
|
||||||
npc_janalai_hatcher(Creature* creature) : ScriptedAI(creature)
|
npc_janalai_hatcher(Creature* creature) : ScriptedAI(creature) { }
|
||||||
{
|
|
||||||
_instance = creature->GetInstanceScript();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Reset() override
|
void Reset() override
|
||||||
{
|
{
|
||||||
@@ -347,7 +338,6 @@ struct npc_janalai_hatcher : public ScriptedAI
|
|||||||
_side = (me->GetPositionY() < 1150);
|
_side = (me->GetPositionY() < 1150);
|
||||||
_waypoint = 0;
|
_waypoint = 0;
|
||||||
_isHatching = false;
|
_isHatching = false;
|
||||||
_hasChangedSide = false;
|
|
||||||
me->GetMotionMaster()->Clear();
|
me->GetMotionMaster()->Clear();
|
||||||
me->GetMotionMaster()->MovePoint(0, hatcherway[_side][0]);
|
me->GetMotionMaster()->MovePoint(0, hatcherway[_side][0]);
|
||||||
}
|
}
|
||||||
@@ -357,29 +347,13 @@ struct npc_janalai_hatcher : public ScriptedAI
|
|||||||
if (_waypoint == 5)
|
if (_waypoint == 5)
|
||||||
{
|
{
|
||||||
_isHatching = true;
|
_isHatching = true;
|
||||||
std::list<Creature* > eggList;
|
|
||||||
me->GetCreaturesWithEntryInRange(eggList, 50.0f, NPC_EGG);
|
scheduler.Schedule(1500ms, SCHEDULER_GROUP_HATCHING, [this](TaskContext context)
|
||||||
scheduler.Schedule(1500ms, SCHEDULER_GROUP_HATCHING, [this, eggList](TaskContext context)
|
|
||||||
{
|
{
|
||||||
std::list<Creature* > unhatchedEggs;
|
me->CastCustomSpell(SPELL_HATCH_EGG_ALL, SPELLVALUE_MAX_TARGETS, context.GetRepeatCounter() + 1);
|
||||||
for (Creature* egg : eggList)
|
|
||||||
{
|
if (me->FindNearestCreature(NPC_EGG, 100.0f))
|
||||||
if (egg->IsAlive())
|
context.Repeat(4s);
|
||||||
unhatchedEggs.emplace_front(egg);
|
|
||||||
}
|
|
||||||
Acore::Containers::RandomResize(unhatchedEggs, 1);
|
|
||||||
if (Creature* egg = unhatchedEggs.front())
|
|
||||||
egg->AI()->DoCastSelf(SPELL_HATCH_EGG_SINGULAR);
|
|
||||||
else if (!_hasChangedSide)
|
|
||||||
{
|
|
||||||
_side = _side ? 0 : 1;
|
|
||||||
_isHatching = false;
|
|
||||||
_waypoint = 3;
|
|
||||||
MoveToNewWaypoint(_waypoint);
|
|
||||||
_hasChangedSide = true;
|
|
||||||
context.CancelGroup(SCHEDULER_GROUP_HATCHING);
|
|
||||||
}
|
|
||||||
context.Repeat(1500ms);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -411,19 +385,14 @@ struct npc_janalai_hatcher : public ScriptedAI
|
|||||||
void MoveInLineOfSight(Unit* /*who*/) override { }
|
void MoveInLineOfSight(Unit* /*who*/) override { }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
InstanceScript* _instance;
|
|
||||||
uint8 _side;
|
uint8 _side;
|
||||||
uint8 _waypoint;
|
uint8 _waypoint;
|
||||||
bool _isHatching;
|
bool _isHatching;
|
||||||
bool _hasChangedSide;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct npc_janalai_hatchling : public ScriptedAI
|
struct npc_janalai_hatchling : public ScriptedAI
|
||||||
{
|
{
|
||||||
npc_janalai_hatchling(Creature* creature) : ScriptedAI(creature)
|
npc_janalai_hatchling(Creature* creature) : ScriptedAI(creature) { }
|
||||||
{
|
|
||||||
_instance = creature->GetInstanceScript();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Reset() override
|
void Reset() override
|
||||||
{
|
{
|
||||||
@@ -433,7 +402,6 @@ struct npc_janalai_hatchling : public ScriptedAI
|
|||||||
else
|
else
|
||||||
me->GetMotionMaster()->MovePoint(0, hatcherway[1][3].GetPositionX() + rand() % 4 - 2, 1150.0f + rand() % 4 - 2, hatcherway[1][3].GetPositionY());
|
me->GetMotionMaster()->MovePoint(0, hatcherway[1][3].GetPositionX() + rand() % 4 - 2, 1150.0f + rand() % 4 - 2, hatcherway[1][3].GetPositionY());
|
||||||
|
|
||||||
me->SetDisableGravity(true);
|
|
||||||
me->SetInCombatWithZone();
|
me->SetInCombatWithZone();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,20 +422,6 @@ struct npc_janalai_hatchling : public ScriptedAI
|
|||||||
|
|
||||||
DoMeleeAttackIfReady();
|
DoMeleeAttackIfReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
InstanceScript* _instance;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct npc_janalai_egg : public NullCreatureAI
|
|
||||||
{
|
|
||||||
npc_janalai_egg(Creature* creature) : NullCreatureAI(creature) { }
|
|
||||||
|
|
||||||
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
|
|
||||||
{
|
|
||||||
if (spell->Id == SPELL_HATCH_EGG_ALL || spell->Id == SPELL_HATCH_EGG_SINGULAR)
|
|
||||||
DoCastSelf(SPELL_SUMMON_HATCHLING);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddSC_boss_janalai()
|
void AddSC_boss_janalai()
|
||||||
@@ -475,5 +429,4 @@ void AddSC_boss_janalai()
|
|||||||
RegisterZulAmanCreatureAI(boss_janalai);
|
RegisterZulAmanCreatureAI(boss_janalai);
|
||||||
RegisterZulAmanCreatureAI(npc_janalai_hatcher);
|
RegisterZulAmanCreatureAI(npc_janalai_hatcher);
|
||||||
RegisterZulAmanCreatureAI(npc_janalai_hatchling);
|
RegisterZulAmanCreatureAI(npc_janalai_hatchling);
|
||||||
RegisterZulAmanCreatureAI(npc_janalai_egg);
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user