Core/Scripts: Fixed Vaelastrasz bomb mechanic (#18260)

* Core/Scripts: Fixed Vaelastrasz bomb mechanic

Vaelstraz was suppose to bomb raid members that are mana users every 15
seconds. He was not doing that with the current implementation.

This implementation allows him to bomb the raid and to select the proper
targets. This is also done in a cleaner way.

* Added AuraScript for SPELL_BURNINGADRENALINE

Needed to define an AuraScript for custom behavior that would denatonate
the damaging aura when the debuff falls off.

SpellId - 18173

* Added SQL for Burning Adrenaline Script Ref

* Fixed Multiple Application of BA

* Add unit null check in lambda

* Remove DB name from sql query

* Added Newline in SQL update file.

* Added SQL delete query for potential existing spell

* Fix SQL newline again.

* As suggested a simpler SpellCast overload works

I don't know if there are any consequences but it seems to function fine
in in-game.

I'd like more information on the overload that involves an AuraEffect.

* Remove duplicate Unit null check in lambda

* Update boss_vaelastrasz.cpp

(cherry picked from commit 60ac53ff07)

# Conflicts:
#	src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp
This commit is contained in:
Andrew Blakely
2016-11-25 07:54:38 -06:00
committed by joschiwald
parent 05fb27dae4
commit 06e1990af2
2 changed files with 47 additions and 14 deletions

View File

@@ -0,0 +1,3 @@
-- Adds a reference to the spell_vael_burning_adrenaline script for Burning Adrenaline (Vael Fight)
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_vael_burning_adrenaline';
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES ('18173', 'spell_vael_burning_adrenaline');

View File

@@ -22,6 +22,8 @@
#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "SpellAuraEffects.h"
#include "SpellScript.h"
enum Says
{
@@ -43,8 +45,9 @@ enum Spells
SPELL_FLAMEBREATH = 23461,
SPELL_FIRENOVA = 23462,
SPELL_TAILSWIPE = 15847,
SPELL_BURNINGADRENALINE = 23620,
SPELL_CLEAVE = 20684 //Chain cleave is most likely named something different and contains a dummy effect
SPELL_BURNINGADRENALINE = 18173, //Cast this one. It's what 3.3.5 DBM expects.
SPELL_BURNINGADRENALINE_EXPLOSION = 23478,
SPELL_CLEAVE = 19983 //Chain cleave is most likely named something different and contains a dummy effect
};
enum Events
@@ -189,24 +192,19 @@ public:
break;
case EVENT_BURNINGADRENALINE_CASTER:
{
Unit* target = NULL;
uint8 i = 0;
while (i < 3) // max 3 tries to get a random target with power_mana
//selects a random target that isn't the current victim and is a mana user (selects mana users) but not pets
//it also ignores targets who have the aura. We don't want to place the debuff on the same target twice.
if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 1, [&](Unit* u) { return u && !u->IsPet() && u->getPowerType() == POWER_MANA && !u->HasAura(SPELL_BURNINGADRENALINE); }))
{
++i;
target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); // not aggro leader
if (target && target->GetPowerType() == POWER_MANA)
i = 3;
me->CastSpell(target, SPELL_BURNINGADRENALINE, true);
}
if (target) // cast on self (see below)
target->CastSpell(target, SPELL_BURNINGADRENALINE, true);
}
//reschedule the event
events.ScheduleEvent(EVENT_BURNINGADRENALINE_CASTER, 15000);
break;
case EVENT_BURNINGADRENALINE_TANK:
// have the victim cast the spell on himself otherwise the third effect aura will be applied to Vael instead of the player
me->EnsureVictim()->CastSpell(me->GetVictim(), SPELL_BURNINGADRENALINE, true);
//Vael has to cast it himself; contrary to the previous commit's comment. Nothing happens otherwise.
me->CastSpell(me->GetVictim(), SPELL_BURNINGADRENALINE, true);
events.ScheduleEvent(EVENT_BURNINGADRENALINE_TANK, 45000);
break;
}
@@ -245,7 +243,39 @@ public:
}
};
//Need to define an aurascript for EVENT_BURNINGADRENALINE's death effect.
// 18173 - Burning Adrenaline
class spell_vael_burning_adrenaline : public SpellScriptLoader
{
public:
spell_vael_burning_adrenaline() : SpellScriptLoader("spell_vael_burning_adrenaline") { }
class spell_vael_burning_adrenaline_AuraScript : public AuraScript
{
PrepareAuraScript(spell_vael_burning_adrenaline_AuraScript);
void OnAuraRemoveHandler(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
//The tooltip says the on death the AoE occurs. According to information: http://qaliaresponse.stage.lithium.com/t5/WoW-Mayhem/Surviving-Burning-Adrenaline-For-tanks/td-p/48609
//Burning Adrenaline can be survived therefore Blizzard's implementation was an AoE bomb that went off if you were still alive and dealt
//damage to the target. You don't have to die for it to go off. It can go off whether you live or die.
GetTarget()->CastSpell(GetTarget(), SPELL_BURNINGADRENALINE_EXPLOSION, true);
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_vael_burning_adrenaline_AuraScript::OnAuraRemoveHandler, EFFECT_2, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_vael_burning_adrenaline_AuraScript();
}
};
void AddSC_boss_vaelastrasz()
{
new boss_vaelastrasz();
new spell_vael_burning_adrenaline();
}