mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 16:38:42 +01:00
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:
@@ -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));
|
||||
|
||||
|
||||
@@ -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()
|
||||
*
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user