Skip to content

Scripts/Ulduar: Spellscripts for Mimiron #12579

Closed
wants to merge 1 commit into from

10 participants

@LuqJensen

Cutting the commit in pieces, so that the diff can be viewed on github...

@Subv
Subv commented Jul 20, 2014

Man, that's a boatload of spellscripts

@obsidean

when is this planned to be added? It's the 3rd time you make the request and still not added to master. just a question. no one should be offended.

@Subv
Subv commented Jul 20, 2014

@obsidean It was added once, then reverted, so we're being extra careful now

@DarkBrain2580

Why reverted? It has work.

@Trisjdc
Trisjdc commented Jul 24, 2014

Just me, or there's plenty of things that could be with spell_linked_spell?

@jackpoz jackpoz and 1 other commented on an outdated diff Jul 24, 2014
...r/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
@@ -18,10 +18,9 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "InstanceScript.h"
+#include "ulduar.h"
@jackpoz
TrinityCore member
jackpoz added a note Jul 24, 2014

what does this header rearrange do ?

@LuqJensen
LuqJensen added a note Jul 24, 2014

that was unintentional, good finding

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Warpten
TrinityCore member
Warpten commented Jul 24, 2014

spell_linked_spell is a trap for hacks

@jackpoz jackpoz commented on an outdated diff Jul 24, 2014
...r/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
#include "ulduar.h"
+#include "WorldPacket.h"
@jackpoz
TrinityCore member
jackpoz added a note Jul 24, 2014

was this unintentional too ? TortoiseGit allows to reviews the changes in a useful way before committing&pushing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@LuqJensen

Removed a bunch of whitespace and checked no-pch, gcc build (Ty to Aokromes)

@Shauren Shauren commented on an outdated diff Aug 1, 2014
...rver/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
{
- PreventHitDefaultEffect(effIndex);
- for (uint8 i = 0; i < 10; ++i)
- GetCaster()->CastSpell(GetCaster(), SPELL_TRIGGER_MISSILE, true);
+ if (GetHitPlayer())
+ if (InstanceScript* instance = GetCaster()->GetInstanceScript())
+ if (Creature* mkii = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_LEVIATHAN_MK_II)))
+ mkii->AI()->SetData(DATA_SETUP_BOMB, 0);
+ }
+
+ void HandleDespawn(SpellEffIndex /*effIndex*/)
+ {
+ if (GetHitUnit()->IsSummon())
@Shauren
TrinityCore member
Shauren added a note Aug 1, 2014

Change this to GetHitCreature() && GetHitCreature()->IsSummon() - will make this slightly more obvious and will allow you to drop ToTempSummon() completely (replace GetHitUnit with GetHitCreature in all cases inside this method (HandleDespawn))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Shauren Shauren commented on an outdated diff Aug 1, 2014
...rver/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
+ }
+};
+
+// 65192 - Flame Suppressant, 65224 - Clear Fires, 65354 - Clear Fires, 64619 - Water Spray
+class spell_mimiron_clear_fires : public SpellScriptLoader
+{
+ public:
+ spell_mimiron_clear_fires() : SpellScriptLoader("spell_mimiron_clear_fires") { }
+
+ class spell_mimiron_clear_fires_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_mimiron_clear_fires_SpellScript);
+
+ void HandleDummy(SpellEffIndex /*effIndex*/)
+ {
+ if (GetHitUnit()->IsSummon())
@Shauren
TrinityCore member
Shauren added a note Aug 1, 2014

just do - drop IsSummon check since you are limiting possible targets with conditions and are not expecting any of these creatures to be permanently spawned

if (GetHitCreature())
    GetHitCreature()->DespawnOrUnsummon();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Shauren Shauren and 1 other commented on an outdated diff Aug 1, 2014
...rver/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
+ }
+
+ void Register() override
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_mimiron_despawn_assault_bots_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const override
+ {
+ return new spell_mimiron_despawn_assault_bots_SpellScript();
+ }
+};
+
+// 64626 - Explosion
+class spell_mimiron_frost_bomb_explosion : public SpellScriptLoader
@Shauren
TrinityCore member
Shauren added a note Aug 1, 2014

This script can be replaced by spell_linked_spell
(64626, -SPELL_FROST_BOMB_LINKED, 0, 'Explosion - Remove SPELL_FROST_BOMB_LINKED from caster'),
(64626, -SPELL_FLAMES_PERIODIC_TRIGGER, 1, 'Explosion - Remove SPELL_FLAMES_PERIODIC_TRIGGER from targets');

@LuqJensen
LuqJensen added a note Aug 1, 2014

stealing these

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Shauren Shauren commented on an outdated diff Aug 1, 2014
...rver/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
+ class spell_mimiron_fire_search_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_mimiron_fire_search_SpellScript);
+
+ bool Validate(SpellInfo const* /*spell*/) override
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_WATER_SPRAY))
+ return false;
+ return true;
+ }
+
+ void FilterTargets(std::list<WorldObject*>& targets)
+ {
+ if (targets.empty())
+ {
+ GetCaster()->GetMotionMaster()->MoveRandom(15.0f);
@Shauren
TrinityCore member
Shauren added a note Aug 1, 2014

I really don't like that - movement is not part of target filtering. What you should do instead is store whether the list was empty at this point and execute this in AfterCast hook

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Shauren Shauren commented on an outdated diff Aug 1, 2014
...rver/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
+
+ void Register() override
+ {
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_mimiron_fire_search_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
+ OnEffectHitTarget += SpellEffectFn(spell_mimiron_fire_search_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const override
+ {
+ return new spell_mimiron_fire_search_SpellScript();
+ }
+};
+
+// 64570 - Flame Suppressant
+class spell_mimiron_flame_suppressant : public SpellScriptLoader
@Shauren
TrinityCore member
Shauren added a note Aug 1, 2014

spell_linked_spell
(64570, -SPELL_FLAMES_PERIODIC_TRIGGER, 1, 'Flame Suppressant - Remove SPELL_FLAMES_PERIODIC_TRIGGER from targets');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Shauren Shauren commented on an outdated diff Aug 1, 2014
...rver/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
+ }
+};
+
+// 64436 - Magnetic Core
+class spell_mimiron_magnetic_core : public SpellScriptLoader
+{
+ public:
+ spell_mimiron_magnetic_core() : SpellScriptLoader("spell_mimiron_magnetic_core") { }
+
+ class spell_mimiron_magnetic_core_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_mimiron_magnetic_core_SpellScript);
+
+ void FilterTargets(std::list<WorldObject*>& targets)
+ {
+ targets.remove_if([](WorldObject* obj) { return obj->ToUnit()->GetVehicleBase() || obj->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); });
@Shauren
TrinityCore member
Shauren added a note Aug 1, 2014

This is bad! Missing object type check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Shauren Shauren commented on an outdated diff Aug 1, 2014
...rver/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
+
+ target->CastSpell(target, SPELL_MAGNETIC_CORE_VISUAL, true);
+ }
+
+ void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* target = GetTarget();
+ if (target->GetAI())
+ target->GetAI()->DoAction(DO_ENABLE_AERIAL);
+
+ target->RemoveAurasDueToSpell(SPELL_MAGNETIC_CORE_VISUAL);
+ }
+
+ void OnRemoveSelf(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ if (GetTarget()->ToCreature())
@Shauren
TrinityCore member
Shauren added a note Aug 1, 2014

if (Creature* target = GetTarget()->ToCreature())
bla; // you know what to do here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Shauren Shauren commented on the diff Aug 1, 2014
...rver/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
+ }
+};
+
+// 63274 - P3Wx2 Laser Barrage -- This should be removed when channel track target implementation is properly functioning.
+class spell_mimiron_p3wx2_laser_barrage : public SpellScriptLoader
+{
+ public:
+ spell_mimiron_p3wx2_laser_barrage() : SpellScriptLoader("spell_mimiron_p3wx2_laser_barrage") { }
+
+ class spell_mimiron_p3wx2_laser_barrage_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_mimiron_p3wx2_laser_barrage_SpellScript);
+
+ void OnHit(SpellEffIndex /*effIndex*/)
+ {
+ GetCaster()->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, GetHitUnit()->GetGUID());
@Shauren
TrinityCore member
Shauren added a note Aug 1, 2014

This is... REALLY bad, does this spell hit more than one target so UNIT_FIELD_CHANNEL_OBJECT is not set automatically?

@LuqJensen
LuqJensen added a note Aug 1, 2014

eff0 hits DB target, eff1 and eff2 hit caster, core cant handle that. thus the comment.

@Shauren
TrinityCore member
Shauren added a note Aug 1, 2014

Comment didnt explain anything but this can stay for now

@LuqJensen
LuqJensen added a note Aug 1, 2014

added a comment to explain the hack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Shauren Shauren commented on the diff Aug 1, 2014
...rver/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
+ bool Validate(SpellInfo const* /*spell*/) override
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_PLASMA_BLAST))
+ return false;
+ return true;
+ }
+
+ bool Load() override
+ {
+ return GetCaster()->GetVehicleKit();
+ }
+
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ if (Unit* caster = GetCaster()->GetVehicleKit()->GetPassenger(3))
+ caster->CastSpell(GetHitUnit(), SPELL_PLASMA_BLAST);
@Shauren
TrinityCore member
Shauren added a note Aug 1, 2014

note to self - check spellwork on this one

@LuqJensen
LuqJensen added a note Aug 1, 2014

sniffs tell us that MKII casts this on victim, there is no spell which targets the cannon to force SPELL_PLASMA_BLAST to be cast, so we have to script it

@Shauren
TrinityCore member
Shauren added a note Aug 1, 2014

passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Shauren Shauren commented on an outdated diff Aug 1, 2014
...rver/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
+ spell_mimiron_rapid_burst() : SpellScriptLoader("spell_mimiron_rapid_burst") { }
+
+ class spell_mimiron_rapid_burst_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_mimiron_rapid_burst_AuraScript);
+
+ bool Validate(SpellInfo const* /*spell*/) override
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_RAPID_BURST_LEFT) || !sSpellMgr->GetSpellInfo(SPELL_RAPID_BURST_RIGHT))
+ return false;
+ return true;
+ }
+
+ void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ if (GetTarget()->IsSummon())
@Shauren
TrinityCore member
Shauren added a note Aug 1, 2014

if (TempSummon* summ = GetTarget()->ToTempSummon())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Shauren Shauren commented on an outdated diff Aug 1, 2014
...rver/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
+ spell_mimiron_rocket_strike_damage() : SpellScriptLoader("spell_mimiron_rocket_strike_damage") { }
+
+ class spell_mimiron_rocket_strike_damage_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_mimiron_rocket_strike_damage_SpellScript);
+
+ bool Validate(SpellInfo const* /*spell*/) override
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_NOT_SO_FRIENDLY_FIRE))
+ return false;
+ return true;
+ }
+
+ void HandleDespawn(SpellEffIndex /*effIndex*/)
+ {
+ if (GetCaster()->IsSummon())
@Shauren
TrinityCore member
Shauren added a note Aug 1, 2014

Same as above + do this in AfterCast

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Shauren Shauren commented on the diff Aug 1, 2014
...rver/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
+ }
+};
+
+// 63414 - Spinning Up -- This should be removed when channel track target implementation is properly functioning.
+class spell_mimiron_spinning_up : public SpellScriptLoader
+{
+ public:
+ spell_mimiron_spinning_up() : SpellScriptLoader("spell_mimiron_spinning_up") { }
+
+ class spell_mimiron_spinning_up_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_mimiron_spinning_up_SpellScript);
+
+ void OnHit(SpellEffIndex /*effIndex*/)
+ {
+ if (GetHitUnit() != GetCaster())
@Shauren
TrinityCore member
Shauren added a note Aug 1, 2014

same as above about BAD

@LuqJensen
LuqJensen added a note Aug 1, 2014

in this commit i have not included the hacks in spellmgr.cpp. the problem is that current implementation of auras will not allow caster to track this target if the spell is not active on caster itself (joschiwald and I discussed this a lot). the spell also hits the MKII. so in spellmgr.cpp eff0 is hacked to hit both caster and DB target, thus we need this to finish the hack.

@LuqJensen
LuqJensen added a note Aug 1, 2014

added a comment to better reflect the hack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Shauren Shauren and 1 other commented on an outdated diff Aug 1, 2014
...rver/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
+ spell_mimiron_summon_fire_bot_target() : SpellScriptLoader("spell_mimiron_summon_fire_bot_target") { }
+
+ class spell_mimiron_summon_fire_bot_target_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_mimiron_summon_fire_bot_target_SpellScript);
+
+ bool Validate(SpellInfo const* /*spell*/) override
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_FIRE_BOT_DUMMY))
+ return false;
+ return true;
+ }
+
+ void FilterTargets(std::list<WorldObject*>& targets)
+ {
+ Trinity::Containers::RandomResizeList(targets, 3);
@Shauren
TrinityCore member
Shauren added a note Aug 1, 2014
  1. Check spellwork on max targets
  2. Do you have any control over casting this spell?
@LuqJensen
LuqJensen added a note Aug 1, 2014

the spell is cast by the eventmap of ACU

@Shauren
TrinityCore member
Shauren added a note Aug 1, 2014

Remove the target filter hook and use CastCustomSpell with SPELLVALUE_MAX_TARGETS set to 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Shauren Shauren commented on an outdated diff Aug 1, 2014
...rver/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
+ spell_mimiron_summon_flames_initial() : SpellScriptLoader("spell_mimiron_summon_flames_initial") { }
+
+ class spell_mimiron_summon_flames_initial_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_mimiron_summon_flames_initial_SpellScript);
+
+ bool Validate(SpellInfo const* /*spell*/) override
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_FLAMES_INITIAL))
+ return false;
+ return true;
+ }
+
+ void FilterTargets(std::list<WorldObject*>& targets)
+ {
+ Trinity::Containers::RandomResizeList(targets, 3);
@Shauren
TrinityCore member
Shauren added a note Aug 1, 2014

same as above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Shauren Shauren and 2 others commented on an outdated diff Aug 1, 2014
...rver/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
+{
+ public:
+ spell_mimiron_summon_flames_spread() : SpellScriptLoader("spell_mimiron_summon_flames_spread") { }
+
+ class spell_mimiron_summon_flames_spread_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_mimiron_summon_flames_spread_SpellScript);
+
+ void FilterTargets(std::list<WorldObject*>& targets)
+ {
+ if (targets.empty())
+ return;
+
+ WorldObject* target = targets.front();
+
+ for (std::list<WorldObject*>::const_iterator iter = targets.begin(); iter != targets.end(); iter++)
@Shauren
TrinityCore member
Shauren added a note Aug 1, 2014

Need more info about what this script is supposed to do

@LuqJensen
LuqJensen added a note Aug 1, 2014

the spell is supposed to target the nearest player and cast towards that
so the fires chase the nearest player

@Subv
Subv added a note Aug 1, 2014

Don't just add comments here, if the script is not immediately obvious, add a comment in the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Shauren Shauren commented on an outdated diff Aug 1, 2014
...rver/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
+ }
+};
+
+// 64627 - Frost Bomb
+class spell_mimiron_summon_frost_bomb : public SpellScriptLoader
+{
+ public:
+ spell_mimiron_summon_frost_bomb() : SpellScriptLoader("spell_mimiron_summon_frost_bomb") { }
+
+ class spell_mimiron_summon_frost_bomb_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_mimiron_summon_frost_bomb_SpellScript);
+
+ void HandleDummy(SpellEffIndex /*effIndex*/)
+ {
+ GetHitUnit()->RemoveAurasDueToSpell(SPELL_FLAMES_PERIODIC_TRIGGER);
@Shauren
TrinityCore member
Shauren added a note Aug 1, 2014

spell_linked_spell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Shauren Shauren commented on the diff Aug 1, 2014
...rver/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
+ {
+ PrepareSpellScript(spell_mimiron_summon_frost_bomb_target_SpellScript);
+
+ bool Validate(SpellInfo const* /*spell*/) override
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_FROST_BOMB))
+ return false;
+ return true;
+ }
+
+ void FilterTargets(std::list<WorldObject*>& targets)
+ {
+ if (targets.empty())
+ return;
+
+ targets.remove_if(Trinity::AllWorldObjectsInRange(GetCaster(), 15.0f));
@Shauren
TrinityCore member
Shauren added a note Aug 1, 2014

Is this ability supposed to be negated by having entire raid standing within 15 yards of the caster?

@LuqJensen
LuqJensen added a note Aug 1, 2014

not the raid. the frostbomb spell targets fires, blizzard has some kind of safe zone where it will not be cast within because the frostbomb deals lethal damage and has a 30yd explosion range, in p2 the mid of the room is vital for surviving due to the laser barrage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Shauren Shauren and 2 others commented on an outdated diff Aug 1, 2014
...r/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
@@ -354,6 +365,28 @@ class instance_ulduar : public InstanceMapScript
creature->DespawnOrUnsummon();
break;
+ // Mimiron
+ case NPC_MIMIRON:
+ MimironGUID = creature->GetGUID();
+ break;
+ case NPC_LEVIATHAN_MKII:
+ MimironVehicleGUIDs[0] = creature->GetGUID();
+ if (GetBossState(BOSS_MIMIRON) == DONE)
+ creature->DespawnOrUnsummon();
@Shauren
TrinityCore member
Shauren added a note Aug 1, 2014

Not needed if this creature fully dies afer encounter is complete - just put a high spawntimesecs

@Warpten
TrinityCore member
Warpten added a note Aug 1, 2014

Iirc they don't, mimiron just gathers his ideas back (à la freya) and shit despawns

@LuqJensen
LuqJensen added a note Aug 1, 2014

they die. VX001 and ACU are summoned, MKII is not, i will try out the spawntimesecs instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@tkrokli
tkrokli commented Aug 2, 2014

Looks good, @Unholychick - Travis CI build passed this time. 😼

@DDuarte DDuarte added a commit that closed this pull request Aug 18, 2014
@LuqJensen LuqJensen Scripts/Ulduar: Spellscripts for Mimiron
Closes #12579

Signed-off-by: DDuarte <dnpd.dd@gmail.com>
377f385
@DDuarte DDuarte closed this in 377f385 Aug 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.