fix(Scripts/Spells): Unlit Torches cannot be used too far away from the bonfire (#7644)
- Closes #6551
This commit is contained in:
@@ -389,15 +389,23 @@ public:
|
|||||||
bool handled;
|
bool handled;
|
||||||
bool Load() override { handled = false; return true; }
|
bool Load() override { handled = false; return true; }
|
||||||
|
|
||||||
|
SpellCastResult CheckCast()
|
||||||
|
{
|
||||||
|
GetCaster()->GetCreaturesWithEntryInRange(_crList, 100.0f, NPC_TORCH_TARGET);
|
||||||
|
if (_crList.empty())
|
||||||
|
{
|
||||||
|
return SPELL_FAILED_NOT_HERE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SPELL_CAST_OK;
|
||||||
|
}
|
||||||
|
|
||||||
void ThrowNextTorch(Unit* caster)
|
void ThrowNextTorch(Unit* caster)
|
||||||
{
|
{
|
||||||
std::list<Creature*> crList;
|
uint8 rand = urand(0, _crList.size() - 1);
|
||||||
caster->GetCreaturesWithEntryInRange(crList, 100.0f, NPC_TORCH_TARGET);
|
|
||||||
|
|
||||||
uint8 rand = urand(0, crList.size() - 1);
|
|
||||||
Position pos;
|
Position pos;
|
||||||
pos.Relocate(0.0f, 0.0f, 0.0f);
|
pos.Relocate(0.0f, 0.0f, 0.0f);
|
||||||
for (std::list<Creature*>::const_iterator itr = crList.begin(); itr != crList.end(); ++itr, --rand)
|
for (std::list<Creature*>::const_iterator itr = _crList.begin(); itr != _crList.end(); ++itr, --rand)
|
||||||
{
|
{
|
||||||
if (caster->GetDistance(*itr) < 5)
|
if (caster->GetDistance(*itr) < 5)
|
||||||
{
|
{
|
||||||
@@ -473,8 +481,14 @@ public:
|
|||||||
{
|
{
|
||||||
AfterCast += SpellCastFn(spell_midsummer_fling_torch_SpellScript::HandleFinish);
|
AfterCast += SpellCastFn(spell_midsummer_fling_torch_SpellScript::HandleFinish);
|
||||||
if (m_scriptSpellId == 45671)
|
if (m_scriptSpellId == 45671)
|
||||||
|
{
|
||||||
|
OnCheckCast += SpellCheckCastFn(spell_midsummer_fling_torch_SpellScript::CheckCast);
|
||||||
OnEffectHitTarget += SpellEffectFn(spell_midsummer_fling_torch_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
OnEffectHitTarget += SpellEffectFn(spell_midsummer_fling_torch_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::list<Creature*> _crList;
|
||||||
};
|
};
|
||||||
|
|
||||||
SpellScript* GetSpellScript() const override
|
SpellScript* GetSpellScript() const override
|
||||||
|
|||||||
Reference in New Issue
Block a user