diff options
author | treeston <treeston.mmoc@gmail.com> | 2017-07-18 18:32:43 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2020-08-19 20:51:03 +0200 |
commit | 89006f621e0c59d88ab6102d2c67071aaeeb8ee9 (patch) | |
tree | f97897ca908098c6ebd3f4aa4db5f5b20f413253 | |
parent | cc9889a3d495961657b1b5918fe1bdac6e7f8817 (diff) |
Scripts/Item: Change Nitro -> Boosts <- to use the correct knockup effect for their backfire. Also, script that knockup effect to work properly ("usually" deploy a rescue parachute).
(cherry picked from commit 02b1d8bb484ed82be055438cd2bac1db5f18a101)
-rw-r--r-- | sql/updates/world/master/2020_08_19_01_world_2017_07_18_03_world.sql | 3 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_item.cpp | 52 |
2 files changed, 54 insertions, 1 deletions
diff --git a/sql/updates/world/master/2020_08_19_01_world_2017_07_18_03_world.sql b/sql/updates/world/master/2020_08_19_01_world_2017_07_18_03_world.sql new file mode 100644 index 00000000000..17bcc875f61 --- /dev/null +++ b/sql/updates/world/master/2020_08_19_01_world_2017_07_18_03_world.sql @@ -0,0 +1,3 @@ +-- +DELETE FROM `spell_script_names` WHERE `scriptname`='spell_item_nitro_boosts_backfire'; +INSERT INTO `spell_script_names` (`spell_id`,`scriptname`) VALUES (54621,'spell_item_nitro_boosts_backfire'); 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(); |