Skip to content

Commit

Permalink
Core/Movement: Correct the allowed distance to target before a reposi…
Browse files Browse the repository at this point in the history
…tioning is necessary. #20173

Also getting rid of the wordserveur config parameter 'TargetPosRecalculateRange' since it is no longer needed.
  • Loading branch information
chaodhib committed Jan 6, 2018
1 parent 137955d commit b8caae8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 26 deletions.
Expand Up @@ -61,7 +61,13 @@ bool TargetedMovementGenerator<T, D>::DoUpdate(T* owner, uint32 diff)
{
_timer.Reset(100);

float distance = owner->GetCombatReach() + sWorld->getRate(RATE_TARGET_POS_RECALCULATION_RANGE);
/*
the allowed distance between target and mover before the mover needs to reposition in order to keep attacking
= attack range - contactPointDistance
The contactPointDistance is the distance between mover & target after each new repositioning of the mover. it's the distance between the target and the point given by the method Unit::GetContactPoint().
! this following value is good when there is no offset ! when there is one, being more lenient could be possible (need investigation).
*/
float distance = owner->GetCombatReach() + 4.0f / 3.0f - CONTACT_DISTANCE;
if (owner->IsPet() && (owner->GetCharmerOrOwnerGUID() == GetTarget()->GetGUID()))
distance = 1.f; // pet following owner

Expand Down
13 changes: 0 additions & 13 deletions src/server/game/World/World.cpp
Expand Up @@ -574,19 +574,6 @@ void World::LoadConfigSettings(bool reload)
for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i) playerBaseMoveSpeed[i] = baseMoveSpeed[i] * rate_values[RATE_MOVESPEED];
rate_values[RATE_CORPSE_DECAY_LOOTED] = sConfigMgr->GetFloatDefault("Rate.Corpse.Decay.Looted", 0.5f);

rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = sConfigMgr->GetFloatDefault("TargetPosRecalculateRange", 1.5f);
if (rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] < CONTACT_DISTANCE)
{
TC_LOG_ERROR("server.loading", "TargetPosRecalculateRange (%f) must be >= %f. Using %f instead.", rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], CONTACT_DISTANCE, CONTACT_DISTANCE);
rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = CONTACT_DISTANCE;
}
else if (rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] > NOMINAL_MELEE_RANGE)
{
TC_LOG_ERROR("server.loading", "TargetPosRecalculateRange (%f) must be <= %f. Using %f instead.",
rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], NOMINAL_MELEE_RANGE, NOMINAL_MELEE_RANGE);
rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = NOMINAL_MELEE_RANGE;
}

rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = sConfigMgr->GetFloatDefault("DurabilityLoss.OnDeath", 10.0f);
if (rate_values[RATE_DURABILITY_LOSS_ON_DEATH] < 0.0f)
{
Expand Down
1 change: 0 additions & 1 deletion src/server/game/World/World.h
Expand Up @@ -453,7 +453,6 @@ enum Rates
RATE_TALENT,
RATE_CORPSE_DECAY_LOOTED,
RATE_INSTANCE_RESET_TIME,
RATE_TARGET_POS_RECALCULATION_RANGE,
RATE_DURABILITY_LOSS_ON_DEATH,
RATE_DURABILITY_LOSS_DAMAGE,
RATE_DURABILITY_LOSS_PARRY,
Expand Down
11 changes: 0 additions & 11 deletions src/server/worldserver/worldserver.conf.dist
Expand Up @@ -418,17 +418,6 @@ DetectPosCollision = 1

CheckGameObjectLoS = 1

#
# TargetPosRecalculateRange
# Description: Max distance from movement target point (+moving unit size) and targeted
# object (+size) after that new target movement point calculated.
# Range: 0.5-5.0
# Default: 1.5
# 0.5 - (Minimum, Contact Range, More sensitive reaction to target movement)
# 5.0 - (Maximum, Melee attack range, Less CPU usage)

TargetPosRecalculateRange = 1.5

#
# UpdateUptimeInterval
# Description: Update realm uptime period (in minutes).
Expand Down

0 comments on commit b8caae8

Please sign in to comment.