void FleeingMovementGenerator<T>::_setTargetLocation(T* owner) { if (!owner) return; if (owner->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED)) return; if (!_setMoveData(owner)) return; float x, y, z; if (!_getPoint(owner, x, y, z)) return; owner->AddUnitState(UNIT_STATE_FLEEING_MOVE); PathGenerator path(owner); path.SetPathLengthLimit(30.0f); bool result = path.CalculatePath(x, y, z); if (!result || path.GetPathType() & PATHFIND_NOPATH) { _nextCheckTime.Reset(urand(1000, 1500)); return; } Movement::MoveSplineInit init(owner); init.MovebyPath(path.GetPath()); init.SetWalk(false); int32 traveltime = init.Launch(); _nextCheckTime.Reset(traveltime + urand(800, 1500)); }
void FleeingMovementGenerator<T>::_setTargetLocation(T* owner) { if (!owner) return; if (owner->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED)) return; if (!_setMoveData(owner)) return; float x, y, z; if (!_getPoint(owner, x, y, z)) return; // Add LOS check for target point bool isInLOS = VMAP::VMapFactory::createOrGetVMapManager()->isInLineOfSight(owner->GetMapId(), owner->GetPositionX(), owner->GetPositionY(), owner->GetPositionZ() + 2.0f, x, y, z + 2.0f); if (!isInLOS) { i_nextCheckTime.Reset(500); return; } owner->AddUnitState(UNIT_STATE_FLEEING_MOVE); Movement::MoveSplineInit init(owner); init.MoveTo(x,y,z); init.SetWalk(false); init.Launch(); }
void FleeingMovementGenerator<T>::_setTargetLocation(T &owner) { if (!&owner) return; if (owner.HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED)) return; if (!_setMoveData(owner)) return; float x, y, z; if (!_getPoint(owner, x, y, z)) return; owner.AddUnitState(UNIT_STATE_FLEEING_MOVE); PathFinderMovementGenerator path(&owner); path.SetPathLengthLimit(MAX_QUIET_DISTANCE * 2); path.SetUseStrightPath(false); if (!path.Calculate(x, y, z) || path.GetPathType() & PATHFIND_NOPATH) { _nextCheckTime.Reset(urand(500, 1500)); return; } Movement::MoveSplineInit init(owner); init.MovebyPath(path.GetPath()); init.SetWalk(false); int32 traveltime = init.Launch(); _nextCheckTime.Reset(traveltime + urand(100, 1500)); }
void FleeingMovementGenerator<T>::_setTargetLocation(T &owner) { if(!&owner) return; if(owner.HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED)) return; if(!_setMoveData(owner)) return; float x, y, z; if(!_getPoint(owner, x, y, z)) return; owner.AddUnitState(UNIT_STAT_FLEEING_MOVE); PathFinder path(&owner); path.setPathLengthLimit(30.0f); path.calculate(x, y, z); if(path.getPathType() & PATHFIND_NOPATH) { i_nextCheckTime.Reset(urand(1000, 1500)); return; } Movement::MoveSplineInit init(owner); init.MovebyPath(path.getPath()); init.SetWalk(false); int32 traveltime = init.Launch(); i_nextCheckTime.Reset(traveltime + urand(800, 1500)); }
void FleeingMovementGenerator<T>::_setTargetLocation(T &owner) { if (!&owner) return; if (owner.HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED)) return; if (!_setMoveData(owner)) return; float x, y, z; if (!_getPoint(owner, x, y, z)) return; owner.AddUnitState(UNIT_STAT_FLEEING | UNIT_STAT_ROAMING); Traveller<T> traveller(owner); i_destinationHolder.SetDestination(traveller, x, y, z); }
void FleeingMovementGenerator<T>::_setTargetLocation(T& owner) { if (!&owner) return; // ignore in case other no reaction state if (owner.hasUnitState(UNIT_STAT_CAN_NOT_REACT & ~UNIT_STAT_FLEEING)) return; if (!_setMoveData(owner)) return; float x, y, z; if (!_getPoint(owner, x, y, z)) return; owner.addUnitState(UNIT_STAT_FLEEING_MOVE); Traveller<T> traveller(owner); i_destinationHolder.SetDestination(traveller, x, y, z); }
void FleeingMovementGenerator<T>::_setTargetLocation (T &owner) { if (!&owner) return; if (owner.HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED)) return; if (!_setMoveData(owner)) return; float x, y, z; if (!_getPoint(owner, x, y, z)) return; owner.AddUnitState(UNIT_STAT_FLEEING_MOVE); Movement::MoveSplineInit init(owner); init.MoveTo(x, y, z) init.SetWalk(false); init.Launch(); }