mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-03-16 05:55:07 +00:00
fix(Scripts/ZulAman): Fix Jan'lai teleport spells (#21083)
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
--
|
||||||
|
DELETE FROM `spell_script_names` WHERE `spell_id` = 43096;
|
||||||
|
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||||
|
(43096, 'spell_summon_all_players_dummy');
|
||||||
@@ -21,6 +21,8 @@
|
|||||||
#include "GridNotifiersImpl.h"
|
#include "GridNotifiersImpl.h"
|
||||||
#include "PassiveAI.h"
|
#include "PassiveAI.h"
|
||||||
#include "ScriptedCreature.h"
|
#include "ScriptedCreature.h"
|
||||||
|
#include "SpellScript.h"
|
||||||
|
#include "SpellScriptLoader.h"
|
||||||
#include "zulaman.h"
|
#include "zulaman.h"
|
||||||
|
|
||||||
enum Yells
|
enum Yells
|
||||||
@@ -42,6 +44,7 @@ enum Spells
|
|||||||
SPELL_FLAME_BREATH = 43140,
|
SPELL_FLAME_BREATH = 43140,
|
||||||
SPELL_FIRE_WALL = 43113,
|
SPELL_FIRE_WALL = 43113,
|
||||||
SPELL_ENRAGE = 44779,
|
SPELL_ENRAGE = 44779,
|
||||||
|
SPELL_SUMMON_PLAYERS_DUMMY = 43096,
|
||||||
SPELL_SUMMON_PLAYERS = 43097,
|
SPELL_SUMMON_PLAYERS = 43097,
|
||||||
SPELL_TELE_TO_CENTER = 43098, // coord
|
SPELL_TELE_TO_CENTER = 43098, // coord
|
||||||
SPELL_HATCH_ALL = 43144,
|
SPELL_HATCH_ALL = 43144,
|
||||||
@@ -323,11 +326,9 @@ struct boss_janalai : public BossAI
|
|||||||
SpawnBombs();
|
SpawnBombs();
|
||||||
_isBombing = true;
|
_isBombing = true;
|
||||||
|
|
||||||
me->GetMap()->DoForAllPlayers([&](Player* player)
|
DoCastSelf(SPELL_TELE_TO_CENTER);
|
||||||
{
|
DoCastAOE(SPELL_SUMMON_PLAYERS_DUMMY, true);
|
||||||
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();
|
||||||
|
|
||||||
@@ -449,8 +450,39 @@ private:
|
|||||||
bool _isHatching;
|
bool _isHatching;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class spell_summon_all_players_dummy: public SpellScript
|
||||||
|
{
|
||||||
|
PrepareSpellScript(spell_summon_all_players_dummy);
|
||||||
|
|
||||||
|
bool Validate(SpellInfo const* /*spell*/) override
|
||||||
|
{
|
||||||
|
return ValidateSpellInfo({ SPELL_SUMMON_PLAYERS });
|
||||||
|
}
|
||||||
|
|
||||||
|
void FilterTargets(std::list<WorldObject*>& targets)
|
||||||
|
{
|
||||||
|
Position pos = GetCaster()->GetPosition();
|
||||||
|
targets.remove_if([&, pos](WorldObject* target) -> bool
|
||||||
|
{
|
||||||
|
return target->IsWithinBox(pos, 18.0f, 18.0f, 18.0f);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnHit(SpellEffIndex /*effIndex*/)
|
||||||
|
{
|
||||||
|
GetCaster()->CastSpell(GetHitUnit(), SPELL_SUMMON_PLAYERS, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Register() override
|
||||||
|
{
|
||||||
|
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_summon_all_players_dummy::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||||
|
OnEffectHitTarget += SpellEffectFn(spell_summon_all_players_dummy::OnHit, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void AddSC_boss_janalai()
|
void AddSC_boss_janalai()
|
||||||
{
|
{
|
||||||
RegisterZulAmanCreatureAI(boss_janalai);
|
RegisterZulAmanCreatureAI(boss_janalai);
|
||||||
RegisterZulAmanCreatureAI(npc_janalai_hatcher);
|
RegisterZulAmanCreatureAI(npc_janalai_hatcher);
|
||||||
|
RegisterSpellScript(spell_summon_all_players_dummy);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user