Scripts/BoT: implement Dancing Flames visual effects

*fixed summon destination for Cyclone Winds
*added 100 Valor Points to all difficulties for Halfus Wyrmbreaker
This commit is contained in:
Ovahlord
2018-04-17 14:34:56 +02:00
parent 54fa65f76b
commit 36b3dcff71
4 changed files with 149 additions and 11 deletions

View File

@@ -83,7 +83,10 @@ enum BoTCreatures
NPC_STORM_RIDER = 44650,
NPC_TIME_WARDEN = 44797,
NPC_ORPHANED_EMERALD_WELP = 44641,
NPC_SPIKE = 44765
NPC_SPIKE = 44765,
// Generic Creatures
NPC_INVISIBLE_STALKER = 42098
};
enum BoTGameObjects
@@ -109,6 +112,16 @@ enum BoTActions
ACTION_MOVE_OUT_OF_CAGE = 4
};
enum BoTEvents
{
EVENT_CAST_DANCING_FLAMES = 1
};
enum BoTSpells
{
SPELL_DANCING_FLAMES_VISUAL = 83962
};
template<class AI>
AI* GetBastionOfTwilightAI(Creature* creature)
{

View File

@@ -642,6 +642,89 @@ class spell_halfus_stone_touch : public SpellScriptLoader
}
};
class spell_halfus_cyclone_winds : public SpellScriptLoader
{
public:
spell_halfus_cyclone_winds() : SpellScriptLoader("spell_halfus_cyclone_winds") { }
class spell_halfus_cyclone_winds_SpellScript : public SpellScript
{
PrepareSpellScript(spell_halfus_cyclone_winds_SpellScript);
void SetDestPosition(SpellEffIndex /*effIndex*/)
{
if (Unit* caster = GetCaster())
{
float angle = caster->GetOrientation();
float x = caster->GetPositionX() + cos(angle) * 7.0f;
float y = caster->GetPositionY() + sin(angle) * 7.0f;
float z = caster->GetPositionZ();
const_cast<WorldLocation*>(GetExplTargetDest())->Relocate(x, y, z);
GetHitDest()->Relocate(x, y, z);
}
}
void Register()
{
OnEffectLaunch += SpellEffectFn(spell_halfus_cyclone_winds_SpellScript::SetDestPosition, EFFECT_0, SPELL_EFFECT_SUMMON);
}
};
SpellScript* GetSpellScript() const
{
return new spell_halfus_cyclone_winds_SpellScript();
}
};
class DancingFlamesDistanceCheck
{
public:
DancingFlamesDistanceCheck(Unit* caster) : _caster(caster) { }
bool operator()(WorldObject* object)
{
return (object->GetDistance2d(_caster) <= 40.0f || object->GetDistance2d(_caster) >= 100.0f);
}
private:
Unit* _caster;
};
class spell_halfus_dancing_flames : public SpellScriptLoader
{
public:
spell_halfus_dancing_flames() : SpellScriptLoader("spell_halfus_dancing_flames") { }
class spell_halfus_dancing_flames_SpellScript : public SpellScript
{
PrepareSpellScript(spell_halfus_dancing_flames_SpellScript);
void FilterTargets(std::list<WorldObject*>& targets)
{
if (targets.empty())
return;
if (Unit* caster = GetCaster())
targets.remove_if(DancingFlamesDistanceCheck(caster));
if (targets.empty())
return;
Trinity::Containers::RandomResize(targets, 1);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_halfus_dancing_flames_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_halfus_dancing_flames_SpellScript();
}
};
class achievement_the_only_escape : public AchievementCriteriaScript
{
public:
@@ -665,5 +748,7 @@ void AddSC_boss_halfus_wyrmbreaker()
new spell_halfus_bind_will();
new spell_halfus_fireball();
new spell_halfus_stone_touch();
new spell_halfus_cyclone_winds();
new spell_halfus_dancing_flames();
new achievement_the_only_escape();
}

View File

@@ -123,6 +123,10 @@ class instance_bastion_of_twilight : public InstanceMapScript
case NPC_SPIKE:
_halfusEncounterGUIDs.insert(creature->GetGUID());
break;
case NPC_INVISIBLE_STALKER:
if (creature->GetPositionZ() < 850.0f)
_dancingFlamesInvisibleStalkerGUIDs.insert(creature->GetGUID());
break;
default:
break;
}
@@ -179,6 +183,7 @@ class instance_bastion_of_twilight : public InstanceMapScript
}
_deadOrphanedEmeraldWhelps = 0;
events.CancelEvent(EVENT_CAST_DANCING_FLAMES);
}
else if (state == DONE)
{
@@ -191,6 +196,8 @@ class instance_bastion_of_twilight : public InstanceMapScript
if (GameObject* cage = GetGameObject(DATA_WHELP_CAGE))
cage->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
events.CancelEvent(EVENT_CAST_DANCING_FLAMES);
}
break;
default:
@@ -239,7 +246,10 @@ class instance_bastion_of_twilight : public InstanceMapScript
if (entry == NPC_ORPHANED_EMERALD_WELP)
protoBehemoth->AI()->DoAction(ACTION_ENABLE_SCORCHING_BREATH);
if (entry == NPC_TIME_WARDEN)
{
protoBehemoth->AI()->DoAction(ACTION_ENABLE_FIREBALL_BARRAGE);
events.RescheduleEvent(EVENT_CAST_DANCING_FLAMES, Milliseconds(500), Seconds(1));
}
}
}
}
@@ -272,6 +282,27 @@ class instance_bastion_of_twilight : public InstanceMapScript
return 0;
}
void Update(uint32 diff) override
{
events.Update(diff);
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_CAST_DANCING_FLAMES:
if (ObjectGuid guid = Trinity::Containers::SelectRandomContainerElement(_dancingFlamesInvisibleStalkerGUIDs))
if (Creature* cataclysmStalker = instance->GetCreature(guid))
cataclysmStalker->CastSpell(cataclysmStalker, SPELL_DANCING_FLAMES_VISUAL, true);
events.Repeat(Milliseconds(500), Seconds(1));
break;
default:
break;
}
}
}
void WriteSaveDataMore(std::ostringstream& data) override
{
data << _unresponsiveDragonEntryFirst << ' '
@@ -290,15 +321,11 @@ class instance_bastion_of_twilight : public InstanceMapScript
&& _unresponsiveDragonEntrySecond != NPC_ORPHANED_EMERALD_WELP);
}
/*
void Update(uint32 diff) override
{
}
*/
protected:
EventMap events;
GuidSet _halfusEncounterGUIDs;
GuidSet _spikeGUIDs;
GuidSet _dancingFlamesInvisibleStalkerGUIDs;
std::set<uint32> _activeDragonEntries;
uint32 _unresponsiveDragonEntryFirst;
uint32 _unresponsiveDragonEntrySecond;