Core:
- Redesigned stealth and invisibility handling - Implemented the handling of multiple stealth types - Implemented fake inebriation - The message deliverer no longer sends packets from a non-visible source - The server won't send that much garbage which just takes bandwith - It won't be possible to use cheats to detect invisible objects - Removed a lot of checks for the Z-coord - Fixes visibility problems happening while flying - Limited the grid activation range of creatures to use less resources - Implemented Shroud of Death - Implemented increased visibility range for active objects - Removed visibility check at spellhit (only sanctuary effects should prevent it) (And a lot of other changes...) Closes issue 4208 Closes issue 3049 Closes issue 2097 Closes issue 2198 Closes issue 2384 Closes issue 2197 Closes issue 2319 --HG-- branch : trunk
This commit is contained in:
@@ -71,9 +71,9 @@ enum AuraType
|
||||
SPELL_AURA_MOD_DAMAGE_TAKEN = 14,
|
||||
SPELL_AURA_DAMAGE_SHIELD = 15,
|
||||
SPELL_AURA_MOD_STEALTH = 16,
|
||||
SPELL_AURA_MOD_DETECT = 17,
|
||||
SPELL_AURA_MOD_STEALTH_DETECT = 17,
|
||||
SPELL_AURA_MOD_INVISIBILITY = 18,
|
||||
SPELL_AURA_MOD_INVISIBILITY_DETECTION = 19,
|
||||
SPELL_AURA_MOD_INVISIBILITY_DETECT = 19,
|
||||
SPELL_AURA_OBS_MOD_HEALTH = 20, //20,21 unofficial
|
||||
SPELL_AURA_OBS_MOD_POWER = 21,
|
||||
SPELL_AURA_MOD_RESISTANCE = 22,
|
||||
@@ -358,7 +358,7 @@ enum AuraType
|
||||
SPELL_AURA_SCHOOL_HEAL_ABSORB = 301,
|
||||
SPELL_AURA_302 = 302,
|
||||
SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE = 303,
|
||||
SPELL_AURA_304 = 304,
|
||||
SPELL_AURA_MOD_FAKE_INEBRIATE = 304,
|
||||
SPELL_AURA_MOD_MINIMUM_SPEED = 305,
|
||||
SPELL_AURA_306 = 306,
|
||||
SPELL_AURA_HEAL_ABSORB_TEST = 307,
|
||||
|
||||
@@ -69,9 +69,9 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
|
||||
&AuraEffect::HandleNoImmediateEffect, // 14 SPELL_AURA_MOD_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonus and Unit::SpellDamageBonus
|
||||
&AuraEffect::HandleNoImmediateEffect, // 15 SPELL_AURA_DAMAGE_SHIELD implemented in Unit::DoAttackDamage
|
||||
&AuraEffect::HandleModStealth, // 16 SPELL_AURA_MOD_STEALTH
|
||||
&AuraEffect::HandleNoImmediateEffect, // 17 SPELL_AURA_MOD_DETECT implement in GameObject::canDetectTrap and Unit::canDetectStealthOf
|
||||
&AuraEffect::HandleInvisibility, // 18 SPELL_AURA_MOD_INVISIBILITY
|
||||
&AuraEffect::HandleInvisibilityDetect, // 19 SPELL_AURA_MOD_INVISIBILITY_DETECTION
|
||||
&AuraEffect::HandleModStealthDetect, // 17 SPELL_AURA_MOD_DETECT
|
||||
&AuraEffect::HandleModInvisibility, // 18 SPELL_AURA_MOD_INVISIBILITY
|
||||
&AuraEffect::HandleModInvisibilityDetect, // 19 SPELL_AURA_MOD_INVISIBILITY_DETECTION
|
||||
&AuraEffect::HandleNoImmediateEffect, // 20 SPELL_AURA_OBS_MOD_HEALTH implemented in AuraEffect::PeriodicTick
|
||||
&AuraEffect::HandleNoImmediateEffect, // 21 SPELL_AURA_OBS_MOD_POWER implemented in AuraEffect::PeriodicTick
|
||||
&AuraEffect::HandleAuraModResistance, // 22 SPELL_AURA_MOD_RESISTANCE
|
||||
@@ -206,7 +206,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
|
||||
&AuraEffect::HandleAuraTrackStealthed, //151 SPELL_AURA_TRACK_STEALTHED
|
||||
&AuraEffect::HandleNoImmediateEffect, //152 SPELL_AURA_MOD_DETECTED_RANGE implemented in Creature::GetAttackDistance
|
||||
&AuraEffect::HandleNoImmediateEffect, //153 SPELL_AURA_SPLIT_DAMAGE_FLAT
|
||||
&AuraEffect::HandleNoImmediateEffect, //154 SPELL_AURA_MOD_STEALTH_LEVEL
|
||||
&AuraEffect::HandleModStealthLevel, //154 SPELL_AURA_MOD_STEALTH_LEVEL
|
||||
&AuraEffect::HandleNoImmediateEffect, //155 SPELL_AURA_MOD_WATER_BREATHING
|
||||
&AuraEffect::HandleNoImmediateEffect, //156 SPELL_AURA_MOD_REPUTATION_GAIN
|
||||
&AuraEffect::HandleNULL, //157 SPELL_AURA_PET_DAMAGE_MULTI
|
||||
@@ -356,7 +356,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
|
||||
&AuraEffect::HandleNoImmediateEffect, //301 SPELL_AURA_SCHOOL_HEAL_ABSORB implemented in Unit::CalcHealAbsorb
|
||||
&AuraEffect::HandleNULL, //302 0 spells in 3.3.5
|
||||
&AuraEffect::HandleNoImmediateEffect, //303 SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE implemented in Unit::SpellDamageBonus, Unit::MeleeDamageBonus
|
||||
&AuraEffect::HandleUnused, //304 clientside
|
||||
&AuraEffect::HandleAuraModFakeInebriation, //304 SPELL_AURA_MOD_DRUNK
|
||||
&AuraEffect::HandleAuraModIncreaseSpeed, //305 SPELL_AURA_MOD_MINIMUM_SPEED
|
||||
&AuraEffect::HandleNULL, //306 0 spells in 3.3.5
|
||||
&AuraEffect::HandleNULL, //307 0 spells in 3.3.5
|
||||
@@ -2685,40 +2685,40 @@ void AuraEffect::HandleShapeshiftBoosts(Unit * target, bool apply) const
|
||||
/*** VISIBILITY & PHASES ***/
|
||||
/**************************************/
|
||||
|
||||
void AuraEffect::HandleInvisibilityDetect(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
void AuraEffect::HandleModInvisibilityDetect(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
{
|
||||
if (!(mode & AURA_EFFECT_HANDLE_REAL))
|
||||
return;
|
||||
|
||||
Unit * target = aurApp->GetTarget();
|
||||
InvisibilityType type = InvisibilityType(GetMiscValue());
|
||||
|
||||
if (apply)
|
||||
{
|
||||
target->m_detectInvisibilityMask |= (1 << GetMiscValue());
|
||||
target->m_invisibilityDetect.AddFlag(type);
|
||||
target->m_invisibilityDetect.AddValue(type, GetAmount());
|
||||
}
|
||||
else
|
||||
{
|
||||
// recalculate value at modifier remove (current aura already removed)
|
||||
target->m_detectInvisibilityMask = 0;
|
||||
Unit::AuraEffectList const& auras = target->GetAuraEffectsByType(SPELL_AURA_MOD_INVISIBILITY_DETECTION);
|
||||
for (Unit::AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
|
||||
target->m_detectInvisibilityMask |= (1 << GetMiscValue());
|
||||
if (!target->HasAuraType(SPELL_AURA_MOD_INVISIBILITY_DETECT))
|
||||
target->m_invisibilityDetect.DelFlag(type);
|
||||
|
||||
target->m_invisibilityDetect.AddValue(type, -GetAmount());
|
||||
}
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
target->UpdateObjectVisibility();
|
||||
|
||||
target->UpdateObjectVisibility();
|
||||
}
|
||||
|
||||
void AuraEffect::HandleInvisibility(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
void AuraEffect::HandleModInvisibility(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
{
|
||||
if (!(mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK))
|
||||
return;
|
||||
|
||||
Unit * target = aurApp->GetTarget();
|
||||
InvisibilityType type = InvisibilityType(GetMiscValue());
|
||||
|
||||
if (apply)
|
||||
{
|
||||
target->m_invisibilityMask |= (1 << GetMiscValue());
|
||||
|
||||
if (mode & AURA_EFFECT_HANDLE_REAL)
|
||||
{
|
||||
// drop flag at invisibiliy in bg
|
||||
@@ -2729,23 +2729,49 @@ void AuraEffect::HandleInvisibility(AuraApplication const * aurApp, uint8 mode,
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
target->SetFlag(PLAYER_FIELD_BYTES2,PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW);
|
||||
|
||||
target->UpdateObjectVisibility();
|
||||
target->m_invisibility.AddFlag(type);
|
||||
target->m_invisibility.AddValue(type, GetAmount());
|
||||
}
|
||||
else
|
||||
{
|
||||
// recalculate value at modifier remove (current aura already removed)
|
||||
target->m_invisibilityMask = 0;
|
||||
Unit::AuraEffectList const& auras = target->GetAuraEffectsByType(SPELL_AURA_MOD_INVISIBILITY);
|
||||
for (Unit::AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
|
||||
target->m_invisibilityMask |= (1 << GetMiscValue());
|
||||
if (!target->HasAuraType(SPELL_AURA_MOD_INVISIBILITY))
|
||||
{
|
||||
// if not have different invisibility auras.
|
||||
// remove glow vision
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
target->RemoveFlag(PLAYER_FIELD_BYTES2,PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW);
|
||||
|
||||
// if not have different invisibility auras.
|
||||
// remove glow vision
|
||||
if (!target->m_invisibilityMask && target->GetTypeId() == TYPEID_PLAYER)
|
||||
target->RemoveFlag(PLAYER_FIELD_BYTES2,PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW);
|
||||
target->m_invisibility.DelFlag(type);
|
||||
}
|
||||
|
||||
target->UpdateObjectVisibility();
|
||||
target->m_invisibility.AddValue(type, -GetAmount());
|
||||
}
|
||||
|
||||
target->UpdateObjectVisibility();
|
||||
}
|
||||
|
||||
void AuraEffect::HandleModStealthDetect(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
{
|
||||
if (!(mode & AURA_EFFECT_HANDLE_REAL))
|
||||
return;
|
||||
|
||||
Unit * target = aurApp->GetTarget();
|
||||
StealthType type = StealthType(GetMiscValue());
|
||||
|
||||
if (apply)
|
||||
{
|
||||
target->m_stealthDetect.AddFlag(type);
|
||||
target->m_stealthDetect.AddValue(type, GetAmount());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!target->HasAuraType(SPELL_AURA_MOD_STEALTH_DETECT))
|
||||
target->m_stealthDetect.DelFlag(type);
|
||||
|
||||
target->m_stealthDetect.AddValue(type, -GetAmount());
|
||||
}
|
||||
|
||||
target->UpdateObjectVisibility();
|
||||
}
|
||||
|
||||
void AuraEffect::HandleModStealth(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
@@ -2754,6 +2780,7 @@ void AuraEffect::HandleModStealth(AuraApplication const * aurApp, uint8 mode, bo
|
||||
return;
|
||||
|
||||
Unit * target = aurApp->GetTarget();
|
||||
StealthType type = StealthType(GetMiscValue());
|
||||
|
||||
if (apply)
|
||||
{
|
||||
@@ -2763,23 +2790,44 @@ void AuraEffect::HandleModStealth(AuraApplication const * aurApp, uint8 mode, bo
|
||||
target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
|
||||
}
|
||||
|
||||
target->m_stealth.AddFlag( type);
|
||||
target->m_stealth.AddValue(type, GetAmount());
|
||||
|
||||
target->SetStandFlags(UNIT_STAND_FLAGS_CREEP);
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
target->SetFlag(PLAYER_FIELD_BYTES2, 0x2000);
|
||||
|
||||
// apply only if not in GM invisibility (and overwrite invisibility state)
|
||||
if (target->GetVisibility() != VISIBILITY_OFF)
|
||||
target->SetVisibility(VISIBILITY_GROUP_STEALTH);
|
||||
}
|
||||
else if (!target->HasAuraType(SPELL_AURA_MOD_STEALTH)) // if last SPELL_AURA_MOD_STEALTH
|
||||
else
|
||||
{
|
||||
target->RemoveStandFlags(UNIT_STAND_FLAGS_CREEP);
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
target->RemoveFlag(PLAYER_FIELD_BYTES2, 0x2000);
|
||||
target->m_stealth.AddValue(type, -GetAmount());
|
||||
|
||||
if (target->GetVisibility() != VISIBILITY_OFF)
|
||||
target->SetVisibility(VISIBILITY_ON);
|
||||
if (!target->HasAuraType(SPELL_AURA_MOD_STEALTH)) // if last SPELL_AURA_MOD_STEALTH
|
||||
{
|
||||
target->m_stealth.DelFlag(type);
|
||||
|
||||
target->RemoveStandFlags(UNIT_STAND_FLAGS_CREEP);
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
target->RemoveFlag(PLAYER_FIELD_BYTES2, 0x2000);
|
||||
}
|
||||
}
|
||||
|
||||
target->UpdateObjectVisibility();
|
||||
}
|
||||
|
||||
void AuraEffect::HandleModStealthLevel(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
{
|
||||
if (!(mode & AURA_EFFECT_HANDLE_REAL))
|
||||
return;
|
||||
|
||||
Unit * target = aurApp->GetTarget();
|
||||
StealthType type = StealthType(GetMiscValue());
|
||||
|
||||
if (apply)
|
||||
target->m_stealth.AddValue(type, GetAmount());
|
||||
else
|
||||
target->m_stealth.AddValue(type, -GetAmount());
|
||||
|
||||
target->UpdateObjectVisibility();
|
||||
}
|
||||
|
||||
void AuraEffect::HandleSpiritOfRedemption(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
@@ -2823,12 +2871,19 @@ void AuraEffect::HandleAuraGhost(AuraApplication const * aurApp, uint8 mode, boo
|
||||
return;
|
||||
|
||||
if (apply)
|
||||
{
|
||||
target->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST);
|
||||
target->m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST);
|
||||
target->m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (target->HasAuraType(SPELL_AURA_GHOST))
|
||||
return;
|
||||
|
||||
target->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST);
|
||||
target->m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE);
|
||||
target->m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3315,9 +3370,9 @@ void AuraEffect::HandleFeignDeath(AuraApplication const * aurApp, uint8 mode, bo
|
||||
*/
|
||||
|
||||
UnitList targets;
|
||||
Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(target, target, target->GetMap()->GetVisibilityDistance());
|
||||
Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(target, target, target->GetMap()->GetVisibilityRange());
|
||||
Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(target, targets, u_check);
|
||||
target->VisitNearbyObject(target->GetMap()->GetVisibilityDistance(), searcher);
|
||||
target->VisitNearbyObject(target->GetMap()->GetVisibilityRange(), searcher);
|
||||
for (UnitList::iterator iter = targets.begin(); iter != targets.end(); ++iter)
|
||||
{
|
||||
if (!(*iter)->hasUnitState(UNIT_STAT_CASTING))
|
||||
@@ -3601,11 +3656,11 @@ void AuraEffect::HandleAuraModStalked(AuraApplication const * aurApp, uint8 mode
|
||||
else
|
||||
{
|
||||
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
|
||||
if (target->HasAuraType(GetAuraType()))
|
||||
return;
|
||||
|
||||
target->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TRACK_UNIT);
|
||||
if (!target->HasAuraType(GetAuraType()))
|
||||
target->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TRACK_UNIT);
|
||||
}
|
||||
|
||||
target->UpdateObjectVisibility();
|
||||
}
|
||||
|
||||
void AuraEffect::HandleAuraUntrackable(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
@@ -4022,7 +4077,7 @@ void AuraEffect::HandleModPossessPet(AuraApplication const * aurApp, uint8 mode,
|
||||
{
|
||||
pet->RemoveCharmedBy(caster);
|
||||
|
||||
if (!pet->IsWithinDistInMap(caster, pet->GetMap()->GetVisibilityDistance()))
|
||||
if (!pet->IsWithinDistInMap(caster, pet->GetMap()->GetVisibilityRange()))
|
||||
pet->Remove(PET_SAVE_NOT_IN_SLOT, true);
|
||||
else
|
||||
{
|
||||
@@ -6349,6 +6404,46 @@ void AuraEffect::HandleAuraOpenStable(AuraApplication const * aurApp, uint8 mode
|
||||
// client auto close stable dialog at !apply aura
|
||||
}
|
||||
|
||||
void AuraEffect::HandleAuraModFakeInebriation(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
{
|
||||
if (!(mode & AURA_EFFECT_HANDLE_REAL))
|
||||
return;
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (apply)
|
||||
{
|
||||
target->m_invisibilityDetect.AddFlag( INVISIBILITY_DRUNK);
|
||||
target->m_invisibilityDetect.AddValue(INVISIBILITY_DRUNK, GetAmount());
|
||||
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
int32 oldval = target->ToPlayer()->GetInt32Value(PLAYER_FAKE_INEBRIATION);
|
||||
target->ToPlayer()->SetInt32Value(PLAYER_FAKE_INEBRIATION, oldval + GetAmount());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool removeDetect = !target->HasAuraType(SPELL_AURA_MOD_FAKE_INEBRIATE);
|
||||
|
||||
target->m_invisibilityDetect.AddValue(INVISIBILITY_DRUNK, -GetAmount());
|
||||
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
int32 oldval = target->ToPlayer()->GetInt32Value(PLAYER_FAKE_INEBRIATION);
|
||||
target->ToPlayer()->SetInt32Value(PLAYER_FAKE_INEBRIATION, oldval - GetAmount());
|
||||
|
||||
if (removeDetect)
|
||||
removeDetect = !target->ToPlayer()->GetDrunkValue();
|
||||
}
|
||||
|
||||
if (removeDetect)
|
||||
target->m_invisibilityDetect.DelFlag(INVISIBILITY_DRUNK);
|
||||
}
|
||||
|
||||
target->UpdateObjectVisibility();
|
||||
}
|
||||
|
||||
void AuraEffect::HandleAuraSetVehicle(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
{
|
||||
if (!(mode & AURA_EFFECT_HANDLE_REAL))
|
||||
|
||||
@@ -108,9 +108,11 @@ class AuraEffect
|
||||
// aura type not have immediate effect at add/remove and handled by ID in other code place
|
||||
}
|
||||
// visibility & phases
|
||||
void HandleInvisibilityDetect(AuraApplication const * aurApp, uint8 mode, bool apply) const;
|
||||
void HandleInvisibility(AuraApplication const * aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModInvisibilityDetect(AuraApplication const * aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModInvisibility(AuraApplication const * aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModStealth(AuraApplication const * aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModStealthLevel(AuraApplication const * aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModStealthDetect(AuraApplication const * aurApp, uint8 mode, bool apply) const;
|
||||
void HandleSpiritOfRedemption(AuraApplication const * aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraGhost(AuraApplication const * aurApp, uint8 mode, bool apply) const;
|
||||
void HandlePhase(AuraApplication const * aurApp, uint8 mode, bool apply) const;
|
||||
@@ -257,6 +259,7 @@ class AuraEffect
|
||||
void HandleAuraLinked(AuraApplication const * aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraOpenStable(AuraApplication const * aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraSetVehicle(AuraApplication const * aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModFakeInebriation(AuraApplication const * aurApp, uint8 mode, bool apply) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1396,18 +1396,6 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool
|
||||
|
||||
if (!m_caster->IsFriendlyTo(unit))
|
||||
{
|
||||
// reset damage to 0 if target has Invisibility and isn't visible for caster
|
||||
// I do not think this is a correct way to fix it. Sanctuary effect should make all delayed spells invalid
|
||||
// for delayed spells ignore not visible explicit target
|
||||
if (m_spellInfo->speed > 0.0f && unit == m_targets.getUnitTarget()
|
||||
&& (unit->m_invisibilityMask || m_caster->m_invisibilityMask)
|
||||
&& !m_caster->canSeeOrDetect(unit, true))
|
||||
{
|
||||
// that was causing CombatLog errors
|
||||
// return SPELL_MISS_EVADE;
|
||||
return SPELL_MISS_MISS; // miss = do not send anything here
|
||||
}
|
||||
|
||||
unit->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_HITBYSPELL);
|
||||
//TODO: This is a hack. But we do not know what types of stealth should be interrupted by CC
|
||||
if ((m_customAttr & SPELL_ATTR_CU_AURA_CC) && unit->IsControlledByPlayer())
|
||||
@@ -1793,7 +1781,7 @@ void Spell::SearchChainTarget(std::list<Unit*> &TagUnitMap, float max_range, uin
|
||||
break;
|
||||
while ((m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE
|
||||
&& !m_caster->isInFrontInMap(*next, max_range))
|
||||
|| !m_caster->canSeeOrDetect(*next, false)
|
||||
|| !m_caster->canSeeOrDetect(*next)
|
||||
|| !cur->IsWithinLOSInMap(*next))
|
||||
{
|
||||
++next;
|
||||
@@ -3118,9 +3106,7 @@ void Spell::cast(bool skipCheck)
|
||||
{
|
||||
// three check: prepare, cast (m_casttime > 0), hit (delayed)
|
||||
if (m_casttime && target->isAlive()
|
||||
&& (target->m_invisibilityMask || m_caster->m_invisibilityMask
|
||||
|| target->GetVisibility() == VISIBILITY_GROUP_STEALTH)
|
||||
&& !target->IsFriendlyTo(m_caster) && !m_caster->canSeeOrDetect(target, true))
|
||||
&& !target->IsFriendlyTo(m_caster) && !m_caster->canSeeOrDetect(target))
|
||||
{
|
||||
SendCastResult(SPELL_FAILED_BAD_TARGETS);
|
||||
SendInterrupted(0);
|
||||
@@ -4846,8 +4832,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
if (target->hasUnitState(UNIT_STAT_UNATTACKABLE))
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
if (!m_IsTriggeredSpell && (target->HasAuraType(SPELL_AURA_MOD_STEALTH)
|
||||
|| target->m_invisibilityMask) && !m_caster->canSeeOrDetect(target, true))
|
||||
if (!m_IsTriggeredSpell && !m_caster->canSeeOrDetect(target))
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
@@ -6014,7 +5999,7 @@ SpellCastResult Spell::CheckItems()
|
||||
|
||||
TypeContainerVisitor<Trinity::GameObjectSearcher<Trinity::GameObjectFocusCheck>, GridTypeMapContainer > object_checker(checker);
|
||||
Map& map = *m_caster->GetMap();
|
||||
cell.Visit(p, object_checker, map, *m_caster, map.GetVisibilityDistance());
|
||||
cell.Visit(p, object_checker, map, *m_caster, m_caster->GetVisibilityRange());
|
||||
|
||||
if (!ok)
|
||||
return SPELL_FAILED_REQUIRES_SPELL_FOCUS;
|
||||
|
||||
@@ -752,7 +752,7 @@ namespace Trinity
|
||||
{
|
||||
Unit *target = (Unit*)itr->getSource();
|
||||
|
||||
if (!target->InSamePhase(i_source))
|
||||
if (!i_source->canSeeOrDetect(target, true))
|
||||
continue;
|
||||
|
||||
switch (i_TargetType)
|
||||
|
||||
@@ -5327,9 +5327,9 @@ void Spell::EffectSanctuary(SpellEffIndex /*effIndex*/)
|
||||
return;
|
||||
|
||||
std::list<Unit*> targets;
|
||||
Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(unitTarget, unitTarget, m_caster->GetMap()->GetVisibilityDistance());
|
||||
Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(unitTarget, unitTarget, m_caster->GetMap()->GetVisibilityRange());
|
||||
Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(unitTarget, targets, u_check);
|
||||
unitTarget->VisitNearbyObject(m_caster->GetMap()->GetVisibilityDistance(), searcher);
|
||||
unitTarget->VisitNearbyObject(m_caster->GetMap()->GetVisibilityRange(), searcher);
|
||||
for (std::list<Unit*>::iterator iter = targets.begin(); iter != targets.end(); ++iter)
|
||||
{
|
||||
if (!(*iter)->hasUnitState(UNIT_STAT_CASTING))
|
||||
|
||||
Reference in New Issue
Block a user