Merge pull request #5426 from Souler/fix_ds_pipe_knockback

Dalaran Sewers Arena: Knockback from starting pipe
This commit is contained in:
Subv
2012-03-03 12:20:39 -08:00
4 changed files with 112 additions and 4 deletions

View File

@@ -2548,6 +2548,43 @@ class spell_gen_chaos_blast : public SpellScriptLoader
};
class spell_gen_ds_flush_knockback : public SpellScriptLoader
{
public:
spell_gen_ds_flush_knockback() : SpellScriptLoader("spell_gen_ds_flush_knockback") {}
class spell_gen_ds_flush_knockback_SpellScript : public SpellScript
{
PrepareSpellScript(spell_gen_ds_flush_knockback_SpellScript);
void HandleScript(SpellEffIndex /*effIndex*/)
{
// Here the target is the water spout and determines the position where the player is knocked from
if (Unit* target = GetHitUnit())
{
if (Player* player = GetCaster()->ToPlayer())
{
float horizontalSpeed = 20.0f + (40.0f - GetCaster()->GetDistance(target));
float verticalSpeed = 8.0f;
// This method relies on the Dalaran Sewer map disposition and Water Spout position
// What we do is knock the player from a position exactly behind him and at the end of the pipe
player->KnockbackFrom(target->GetPositionX(), player->GetPositionY(), horizontalSpeed, verticalSpeed);
}
}
}
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_gen_ds_flush_knockback_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_gen_ds_flush_knockback_SpellScript();
}
};
void AddSC_generic_spell_scripts()
{
new spell_gen_absorb0_hitlimit1();
@@ -2597,4 +2634,5 @@ void AddSC_generic_spell_scripts()
new spell_gen_on_tournament_mount();
new spell_gen_tournament_pennant();
new spell_gen_chaos_blast();
new spell_gen_ds_flush_knockback();
}