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).

This commit is contained in:
treeston
2017-07-18 18:32:43 +02:00
committed by Aokromes
parent 9815e07afd
commit d73970fcb5
2 changed files with 54 additions and 1 deletions

View File

@@ -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');

View File

@@ -3332,7 +3332,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
@@ -3380,6 +3381,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,
@@ -4708,6 +4757,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();
new spell_item_teach_language();
new spell_item_rocket_boots();
new spell_item_pygmy_oil();