Merge pull request #4726 from ille/baa2252bd31718e93ccc3e97aa81afeecb5ec9c3
Core/GameObject: implement stealth/invisibility for traps
This commit is contained in:
@@ -228,13 +228,13 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
|
|||||||
if (GetGOInfo()->trap.stealthed)
|
if (GetGOInfo()->trap.stealthed)
|
||||||
{
|
{
|
||||||
m_stealth.AddFlag(STEALTH_TRAP);
|
m_stealth.AddFlag(STEALTH_TRAP);
|
||||||
m_stealth.AddValue(STEALTH_TRAP, 300);
|
m_stealth.AddValue(STEALTH_TRAP, 70);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetGOInfo()->trap.invisible)
|
if (GetGOInfo()->trap.invisible)
|
||||||
{
|
{
|
||||||
m_invisibility.AddFlag(INVISIBILITY_TRAP);
|
m_invisibility.AddFlag(INVISIBILITY_TRAP);
|
||||||
m_invisibility.AddValue(INVISIBILITY_TRAP, 70);
|
m_invisibility.AddValue(INVISIBILITY_TRAP, 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -850,6 +850,20 @@ bool GameObject::IsAlwaysVisibleFor(WorldObject const* seer) const
|
|||||||
if (IsTransport())
|
if (IsTransport())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (!seer)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Always seen by owner and friendly units
|
||||||
|
if (uint64 guid = GetOwnerGUID())
|
||||||
|
{
|
||||||
|
if (seer->GetGUID() == guid)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
Unit* owner = GetOwner();
|
||||||
|
if (owner && seer->isType(TYPEMASK_UNIT) && owner->IsFriendlyTo(((Unit*)seer)))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1812,6 +1812,10 @@ bool WorldObject::CanDetectStealthOf(WorldObject const* obj) const
|
|||||||
|
|
||||||
// Apply modifiers
|
// Apply modifiers
|
||||||
detectionValue += m_stealthDetect.GetValue(StealthType(i));
|
detectionValue += m_stealthDetect.GetValue(StealthType(i));
|
||||||
|
if (obj->isType(TYPEMASK_GAMEOBJECT))
|
||||||
|
if (Unit* owner = ((GameObject*)obj)->GetOwner())
|
||||||
|
detectionValue -= int32(owner->getLevelForTarget(this) - 1) * 5;
|
||||||
|
|
||||||
detectionValue -= obj->m_stealth.GetValue(StealthType(i));
|
detectionValue -= obj->m_stealth.GetValue(StealthType(i));
|
||||||
|
|
||||||
// Calculate max distance
|
// Calculate max distance
|
||||||
|
|||||||
Reference in New Issue
Block a user