mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-14 09:39:11 +00:00
fix(Core/Combat): Removed some invalid code about auto-acquiring a nearby target if primary target is not detectable by creature. (#8624)
Spells with sanctuary always delete hostile references (if not during encounter). Update visibility should be always forced in case of invisibility/stealth auras. Restored old Shadowmeld code. Fixes #4764 Fixes #7125
This commit is contained in:
@@ -5411,62 +5411,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// 58984 - Shadowmeld
|
||||
class spell_gen_shadowmeld : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_gen_shadowmeld() : SpellScriptLoader("spell_gen_shadowmeld") {}
|
||||
|
||||
class spell_gen_shadowmeld_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_shadowmeld_SpellScript);
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (!caster)
|
||||
return;
|
||||
|
||||
caster->InterruptSpell(CURRENT_AUTOREPEAT_SPELL); // break Auto Shot and autohit
|
||||
caster->InterruptSpell(CURRENT_CHANNELED_SPELL); // break channeled spells
|
||||
|
||||
bool instant_exit = true;
|
||||
if (Player* pCaster = caster->ToPlayer()) // if is a creature instant exits combat, else check if someone in party is in combat in visibility distance
|
||||
{
|
||||
ObjectGuid myGUID = pCaster->GetGUID();
|
||||
float visibilityRange = pCaster->GetMap()->GetVisibilityRange();
|
||||
if (Group* pGroup = pCaster->GetGroup())
|
||||
{
|
||||
const Group::MemberSlotList membersList = pGroup->GetMemberSlots();
|
||||
for (Group::member_citerator itr = membersList.begin(); itr != membersList.end() && instant_exit; ++itr)
|
||||
if (itr->guid != myGUID)
|
||||
if (Player* GroupMember = ObjectAccessor::GetPlayer(*pCaster, itr->guid))
|
||||
if (GroupMember->IsInCombat() && pCaster->GetMap() == GroupMember->GetMap() && pCaster->IsWithinDistInMap(GroupMember, visibilityRange))
|
||||
instant_exit = false;
|
||||
}
|
||||
|
||||
pCaster->SendAttackSwingCancelAttack();
|
||||
}
|
||||
|
||||
if (instant_exit)
|
||||
{
|
||||
caster->getHostileRefMgr().deleteReferences();
|
||||
}
|
||||
caster->CombatStop();
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_gen_shadowmeld_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
{
|
||||
return new spell_gen_shadowmeld_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 7102 Contagion of Rot
|
||||
class spell_contagion_of_rot : public SpellScriptLoader
|
||||
{
|
||||
@@ -5631,6 +5575,5 @@ void AddSC_generic_spell_scripts()
|
||||
new spell_gen_eject_all_passengers();
|
||||
new spell_gen_eject_passenger();
|
||||
new spell_gen_charmed_unit_spell_cooldown();
|
||||
new spell_gen_shadowmeld();
|
||||
new spell_contagion_of_rot();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user