mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 10:26:28 +01:00
Core/Spells: Implement CREATURE_TYPEFLAGS_PROJECTILE_COLLISION, and solve some targeting problems with TARGET_DEST_TRAJ
This commit is contained in:
@@ -2595,8 +2595,8 @@ enum CreatureTypeFlags
|
||||
CREATURE_TYPEFLAGS_EXOTIC = 0x00010000, // Can be tamed by hunter as exotic pet
|
||||
CREATURE_TYPEFLAGS_UNK17 = 0x00020000, // ? Related to vehicles/pvp?
|
||||
CREATURE_TYPEFLAGS_UNK18 = 0x00040000, // ? Related to vehicle/siege weapons?
|
||||
CREATURE_TYPEFLAGS_UNK19 = 0x00080000,
|
||||
CREATURE_TYPEFLAGS_PROJECTILE_COLLISION = 0x00080000, // Projectiles can collide with this creature - interacts with TARGET_DEST_TRAJ
|
||||
CREATURE_TYPEFLAGS_UNK20 = 0x00100000,
|
||||
CREATURE_TYPEFLAGS_UNK21 = 0x00200000,
|
||||
CREATURE_TYPEFLAGS_UNK22 = 0x00400000,
|
||||
CREATURE_TYPEFLAGS_UNK23 = 0x00800000, // ? First seen in 3.2.2. Related to banner/backpack of creature/companion?
|
||||
|
||||
@@ -1514,10 +1514,24 @@ void Spell::SelectImplicitTrajTargets(SpellEffIndex effIndex)
|
||||
std::list<WorldObject*>::const_iterator itr = targets.begin();
|
||||
for (; itr != targets.end(); ++itr)
|
||||
{
|
||||
if (!m_caster->HasInLine(*itr, 5.0f))
|
||||
continue;
|
||||
|
||||
if (m_spellInfo->CheckTarget(m_caster, *itr, true) != SPELL_CAST_OK)
|
||||
continue;
|
||||
|
||||
if (Unit* unitTarget = (*itr)->ToUnit())
|
||||
if (m_caster == *itr || m_caster->IsOnVehicle(unitTarget) || (unitTarget)->GetVehicle())//(*itr)->IsOnVehicle(m_caster))
|
||||
{
|
||||
if (m_caster == *itr || m_caster->IsOnVehicle(unitTarget) || unitTarget->GetVehicle())
|
||||
continue;
|
||||
|
||||
if (Creature* creatureTarget = unitTarget->ToCreature())
|
||||
{
|
||||
if (!(creatureTarget->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_PROJECTILE_COLLISION))
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
const float size = std::max((*itr)->GetObjectSize() * 0.7f, 1.0f); // 1/sqrt(3)
|
||||
/// @todo all calculation should be based on src instead of m_caster
|
||||
const float objDist2d = m_targets.GetSrcPos()->GetExactDist2d(*itr) * std::cos(m_targets.GetSrcPos()->GetRelativeAngle(*itr));
|
||||
|
||||
Reference in New Issue
Block a user