aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Spells/spell_item.cpp52
1 files changed, 51 insertions, 1 deletions
diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp
index 8b05eec1082..df34e4f5af2 100644
--- a/src/server/scripts/Spells/spell_item.cpp
+++ b/src/server/scripts/Spells/spell_item.cpp
@@ -3306,7 +3306,8 @@ class spell_item_brewfest_mount_transformation : public SpellScriptLoader
enum NitroBoosts
{
SPELL_NITRO_BOOSTS_SUCCESS = 54861,
- SPELL_NITRO_BOOSTS_BACKFIRE = 46014,
+ SPELL_NITRO_BOOSTS_BACKFIRE = 54621,
+ SPELL_NITRO_BOOSTS_PARACHUTE = 54649,
};
class spell_item_nitro_boosts : public SpellScriptLoader
@@ -3352,6 +3353,54 @@ class spell_item_nitro_boosts : public SpellScriptLoader
}
};
+class spell_item_nitro_boosts_backfire : public SpellScriptLoader
+{
+ public:
+ spell_item_nitro_boosts_backfire() : SpellScriptLoader("spell_item_nitro_boosts_backfire") { }
+
+ class spell_item_nitro_boosts_backfire_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_item_nitro_boosts_backfire_AuraScript);
+
+ bool Validate(SpellInfo const* /*spell*/) override
+ {
+ return ValidateSpellInfo({ SPELL_NITRO_BOOSTS_PARACHUTE });
+ }
+
+ void HandleApply(AuraEffect const* /*effect*/, AuraEffectHandleModes /*mode*/)
+ {
+ lastZ = GetTarget()->GetPositionZ();
+ }
+
+ void HandlePeriodicDummy(AuraEffect const* effect)
+ {
+ PreventDefaultAction();
+ float curZ = GetTarget()->GetPositionZ();
+ if (curZ < lastZ)
+ {
+ if (roll_chance_i(80)) // we don't have enough sniffs to verify this, guesstimate
+ GetTarget()->CastSpell(GetTarget(), SPELL_NITRO_BOOSTS_PARACHUTE, true, nullptr, effect);
+ GetAura()->Remove();
+ }
+ else
+ lastZ = curZ;
+ }
+
+ void Register() override
+ {
+ OnEffectApply += AuraEffectApplyFn(spell_item_nitro_boosts_backfire_AuraScript::HandleApply, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_item_nitro_boosts_backfire_AuraScript::HandlePeriodicDummy, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
+ }
+
+ float lastZ = INVALID_HEIGHT;
+ };
+
+ AuraScript* GetAuraScript() const override
+ {
+ return new spell_item_nitro_boosts_backfire_AuraScript();
+ }
+};
+
enum TeachLanguage
{
SPELL_LEARN_GNOMISH_BINARY = 50242,
@@ -4928,6 +4977,7 @@ void AddSC_item_spell_scripts()
new spell_item_impale_leviroth();
new spell_item_brewfest_mount_transformation();
new spell_item_nitro_boosts();
+ new spell_item_nitro_boosts_backfire();
RegisterSpellScript(spell_item_teach_language);
new spell_item_rocket_boots();
new spell_item_pygmy_oil();