mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-02 10:34:31 +00:00
procDistanceTime() multiplied the whole travel distance by the Tournament Square speed factor as soon as the distance reached TS_THRESHOLD. That made the trip time jump down at the threshold, so a target just past it arrived dramatically sooner than a nearer one (e.g. a village 41 tiles away raided faster than one 18 tiles away). In T3.6 the Tournament Square only speeds up the part of the journey beyond the threshold: the first TS_THRESHOLD tiles are walked at base speed and the remainder at the boosted speed. Split the computation accordingly so travel time stays monotonic with distance while still rewarding a high-level square. This is a long-standing bug, unrelated to the Generator refactor (which only reformatted the same whole-distance multiplication). The same fix is applied to the duplicate procDistanceTime() in Admin/database.php used by the admin troop-return helper. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -676,8 +676,16 @@ class adm_DB {
|
||||
}
|
||||
$distance = SQRT(POW($xdistance, 2) + POW($ydistance, 2));
|
||||
$speed = $ref;
|
||||
if ($this->getTypeLevel(14, $vid)!= 0 && $distance >= TS_THRESHOLD) {
|
||||
$speed = $speed * ($bid14[$this->getTypeLevel(14, $vid)]['attri'] / 100);
|
||||
$tSquareLevel = $this->getTypeLevel(14, $vid);
|
||||
|
||||
if ($tSquareLevel != 0 && $distance >= TS_THRESHOLD && $speed > 0) {
|
||||
// Tournament Square only speeds up the part of the journey beyond
|
||||
// the threshold (issue #304): the first TS_THRESHOLD tiles are
|
||||
// walked at base speed and the remainder at the boosted speed.
|
||||
$boostedSpeed = $speed * ($bid14[$tSquareLevel]['attri'] / 100);
|
||||
$time = (TS_THRESHOLD / $speed) + (($distance - TS_THRESHOLD) / $boostedSpeed);
|
||||
|
||||
return round($time * 3600 / INCREASE_SPEED);
|
||||
}
|
||||
|
||||
if ($speed!= 0) {
|
||||
|
||||
Reference in New Issue
Block a user