mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-31 17:43:47 +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:
@@ -0,0 +1,7 @@
|
|||||||
|
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1634671396926649200');
|
||||||
|
|
||||||
|
DELETE FROM `spell_script_names` WHERE `spell_id`=58984;
|
||||||
|
DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=58984;
|
||||||
|
INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES
|
||||||
|
(58984,59646,0,'Shadowmeld: Sanctuary'),
|
||||||
|
(58984,62196,0,'Shadowmeld: Force deselect');
|
||||||
@@ -228,8 +228,7 @@ void HostileRefMgr::UpdateVisibility(bool checkThreat)
|
|||||||
while (ref)
|
while (ref)
|
||||||
{
|
{
|
||||||
HostileReference* nextRef = ref->next();
|
HostileReference* nextRef = ref->next();
|
||||||
if ((!checkThreat || ref->GetSource()->getThreatList().size() <= 1) &&
|
if ((!checkThreat || ref->GetSource()->getThreatList().size() <= 1))
|
||||||
!ref->GetSource()->GetOwner()->CanSeeOrDetect(GetOwner()))
|
|
||||||
{
|
{
|
||||||
nextRef = ref->next();
|
nextRef = ref->next();
|
||||||
ref->removeReference();
|
ref->removeReference();
|
||||||
|
|||||||
@@ -13896,14 +13896,6 @@ Unit* Creature::SelectVictim()
|
|||||||
if (GetVehicle())
|
if (GetVehicle())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
// search nearby enemies before evading
|
|
||||||
if (HasReactState(REACT_AGGRESSIVE))
|
|
||||||
{
|
|
||||||
target = SelectNearestTargetInAttackDistance(std::max<float>(m_CombatDistance, ATTACK_DISTANCE));
|
|
||||||
if (target && _CanDetectFeignDeathOf(target) && CanCreatureAttack(target))
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
|
|
||||||
// pussywizard: not sure why it's here
|
// pussywizard: not sure why it's here
|
||||||
// pussywizard: can't evade when having invisibility aura with duration? o_O
|
// pussywizard: can't evade when having invisibility aura with duration? o_O
|
||||||
Unit::AuraEffectList const& iAuras = GetAuraEffectsByType(SPELL_AURA_MOD_INVISIBILITY);
|
Unit::AuraEffectList const& iAuras = GetAuraEffectsByType(SPELL_AURA_MOD_INVISIBILITY);
|
||||||
|
|||||||
@@ -1575,13 +1575,8 @@ void AuraEffect::HandleModInvisibility(AuraApplication const* aurApp, uint8 mode
|
|||||||
target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
|
target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!apply && aurApp->GetRemoveMode() == AURA_REMOVE_BY_DEFAULT)
|
target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable(), true);
|
||||||
{
|
target->bRequestForcedVisibilityUpdate = false;
|
||||||
target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable(), true);
|
|
||||||
target->bRequestForcedVisibilityUpdate = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AuraEffect::HandleModStealthDetect(AuraApplication const* aurApp, uint8 mode, bool apply) const
|
void AuraEffect::HandleModStealthDetect(AuraApplication const* aurApp, uint8 mode, bool apply) const
|
||||||
@@ -1654,13 +1649,8 @@ void AuraEffect::HandleModStealth(AuraApplication const* aurApp, uint8 mode, boo
|
|||||||
target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
|
target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!apply && aurApp->GetRemoveMode() == AURA_REMOVE_BY_DEFAULT)
|
target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable(), true);
|
||||||
{
|
target->bRequestForcedVisibilityUpdate = false;
|
||||||
target->UpdateObjectVisibility((target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable()), true);
|
|
||||||
target->bRequestForcedVisibilityUpdate = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AuraEffect::HandleModStealthLevel(AuraApplication const* aurApp, uint8 mode, bool apply) const
|
void AuraEffect::HandleModStealthLevel(AuraApplication const* aurApp, uint8 mode, bool apply) const
|
||||||
|
|||||||
@@ -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
|
// 7102 Contagion of Rot
|
||||||
class spell_contagion_of_rot : public SpellScriptLoader
|
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_all_passengers();
|
||||||
new spell_gen_eject_passenger();
|
new spell_gen_eject_passenger();
|
||||||
new spell_gen_charmed_unit_spell_cooldown();
|
new spell_gen_charmed_unit_spell_cooldown();
|
||||||
new spell_gen_shadowmeld();
|
|
||||||
new spell_contagion_of_rot();
|
new spell_contagion_of_rot();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user