mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 01:59:09 +00:00
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 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)
|
||||
{
|
||||
std::list<Creature*> crList;
|
||||
caster->GetCreaturesWithEntryInRange(crList, 100.0f, NPC_TORCH_TARGET);
|
||||
|
||||
uint8 rand = urand(0, crList.size() - 1);
|
||||
uint8 rand = urand(0, _crList.size() - 1);
|
||||
Position pos;
|
||||
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)
|
||||
{
|
||||
@@ -473,8 +481,14 @@ public:
|
||||
{
|
||||
AfterCast += SpellCastFn(spell_midsummer_fling_torch_SpellScript::HandleFinish);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::list<Creature*> _crList;
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
|
||||
Reference in New Issue
Block a user