Core/Spells: SPELL_EFFECT_CHARGE_DEST will now also use speed values from DBC

*Scripts/GB: General Umbriss will now properly charge to his Blitz target
This commit is contained in:
Ovalord
2018-02-14 18:24:31 +01:00
parent dc8f263fc8
commit 02fef5cbe2
3 changed files with 38 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
DELETE FROM `spell_script_names` WHERE `ScriptName`= 'spell_umbris_blitz';
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(74670, 'spell_umbriss_blitz'),
(90250, 'spell_umbriss_blitz');

View File

@@ -4479,6 +4479,7 @@ void Spell::EffectChargeDest(SpellEffIndex /*effIndex*/)
if (m_targets.HasDst())
{
Position pos = destTarget->GetPosition();
float speed = G3D::fuzzyGt(m_spellInfo->Speed, 0.0f) ? m_spellInfo->Speed : SPEED_CHARGE;
if (!m_caster->IsWithinLOS(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()))
{
@@ -4487,7 +4488,7 @@ void Spell::EffectChargeDest(SpellEffIndex /*effIndex*/)
pos = m_caster->GetFirstCollisionPosition(dist, angle);
}
m_caster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ);
m_caster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ, speed);
}
}

View File

@@ -429,6 +429,36 @@ class spell_umbriss_bleeding_wound : public SpellScriptLoader
}
};
class spell_umbriss_blitz : public SpellScriptLoader
{
public:
spell_umbriss_blitz() : SpellScriptLoader("spell_umbriss_blitz") { }
class spell_umbriss_blitz_SpellScript : public SpellScript
{
PrepareSpellScript(spell_umbriss_blitz_SpellScript);
void HandleCharge(SpellEffIndex /*effIndex*/)
{
if (Unit* caster = GetCaster())
{
caster->ClearUnitState(UNIT_STATE_CANNOT_TURN);
caster->ClearUnitState(UNIT_STATE_CASTING);
}
}
void Register() override
{
OnEffectLaunch += SpellEffectFn(spell_umbriss_blitz_SpellScript::HandleCharge, EFFECT_0, SPELL_EFFECT_CHARGE_DEST);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_umbriss_blitz_SpellScript();
}
};
void AddSC_boss_general_umbriss()
{
new boss_general_umbriss();
@@ -436,4 +466,5 @@ void AddSC_boss_general_umbriss()
new spell_umbriss_summon_blitz_trigger();
new spell_umbriss_summon_ground_siege_trigger();
new spell_umbriss_bleeding_wound();
new spell_umbriss_blitz();
}