Skip to content

Commit

Permalink
Merge pull request #81 from aaafgcfg/patch-1
Browse files Browse the repository at this point in the history
my-strategy fix
  • Loading branch information
kuviman authored Dec 13, 2019
2 parents df04388 + a00ad3a commit 98c09a6
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 98c09a6

Please sign in to comment.