Core/Units: Allow mind controlling non-controllable vehicles (for example players that become vehicle during boss encounters or creatures that only are vehicles to show non standard power type)

Closes #24562
This commit is contained in:
Shauren
2020-05-06 16:45:03 +02:00
committed by Ovahlord
parent 73efb99005
commit ef25a19326
4 changed files with 12 additions and 2 deletions

View File

@@ -11849,7 +11849,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
charmer->RemoveAurasByType(SPELL_AURA_MOUNTED);
ASSERT(type != CHARM_TYPE_POSSESS || charmer->GetTypeId() == TYPEID_PLAYER);
ASSERT((type == CHARM_TYPE_VEHICLE) == IsVehicle());
ASSERT((type == CHARM_TYPE_VEHICLE) == (GetVehicleKit() && GetVehicleKit()->IsControllableVehicle()));
TC_LOG_DEBUG("entities.unit", "SetCharmedBy: charmer %u (GUID %u), charmed %u (GUID %u), type %u.", charmer->GetEntry(), charmer->GetGUID().GetCounter(), GetEntry(), GetGUID().GetCounter(), uint32(type));

View File

@@ -626,6 +626,15 @@ bool Vehicle::IsVehicleInUse() const
return false;
}
bool Vehicle::IsControllableVehicle() const
{
for (SeatMap::const_iterator itr = Seats.begin(); itr != Seats.end(); ++itr)
if (itr->second.SeatInfo->HasFlag(VEHICLE_SEAT_FLAG_CAN_CONTROL))
return true;
return false;
}
/**
* @fn void Vehicle::InitMovementInfoForBase()
*

View File

@@ -60,6 +60,7 @@ class TC_GAME_API Vehicle : public TransportBase
void RelocatePassengers();
void RemoveAllPassengers();
bool IsVehicleInUse() const;
bool IsControllableVehicle() const;
void SetLastShootPos(Position const& pos) { _lastShootPos.Relocate(pos); }
Position const& GetLastShootPos() const { return _lastShootPos; }

View File

@@ -7369,7 +7369,7 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff, Position const* lo
case SPELL_AURA_MOD_POSSESS:
case SPELL_AURA_MOD_CHARM:
case SPELL_AURA_AOE_CHARM:
if (target->GetTypeId() == TYPEID_UNIT && target->IsVehicle())
if (target->GetVehicleKit() && target->GetVehicleKit()->IsControllableVehicle())
return false;
if (target->IsMounted())
return false;