Skip to content

Commit

Permalink
my-strategy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
aaafgcfg authored Dec 13, 2019
1 parent 7304429 commit a00ad3a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions clients/javascript/my-strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class MyStrategy {
return u.playerId !== unit.playerId;
})
.reduce(function (prev, u) {
let currentDistance = distanceSqr(u, unit);
let currentDistance = distanceSqr(u.position, unit.position);
if (currentDistance < minDistance) {
minDistance = currentDistance;
return u;
Expand All @@ -30,7 +30,7 @@ class MyStrategy {
return box.item instanceof Item.Weapon;
})
.reduce(function (prev, box) {
let currentDistance = distanceSqr(box, unit);
let currentDistance = distanceSqr(box.position, unit.position);
if (currentDistance < minDistance) {
minDistance = currentDistance;
return box;
Expand Down

0 comments on commit a00ad3a

Please sign in to comment.