This commit is contained in:
Anumania 2022-08-23 07:54:54 -07:00
parent 50bab14300
commit e0de900e5d
1 changed files with 3 additions and 3 deletions

View File

@ -1,7 +1,7 @@
function c_doenemyai(target) { function c_doenemyai(target) {
switch target.data.aitype { switch target.data.aitype {
case AI.AFK: case AI.AFK:
var dude = c_findnearestunit(ARMY.US); var dude = c_findnearestunit(target.pos.x,target.pos.y,ARMY.US);
var dist = c_tiledist(target.pos.x, target.pos.y, dude.pos.x, dude.pos.y); var dist = c_tiledist(target.pos.x, target.pos.y, dude.pos.x, dude.pos.y);
if dist.x+dist.y <= target.data.rng.val { if dist.x+dist.y <= target.data.rng.val {
log("started combat") log("started combat")
@ -12,7 +12,7 @@ function c_doenemyai(target) {
target.waiting = true; target.waiting = true;
break; break;
case AI.KILLER: case AI.KILLER:
var dude = c_findnearestunit(ARMY.US); var dude = c_findnearestunit(target.pos.x,target.pos.y,ARMY.US);
repeat(target.data.mov.val) { repeat(target.data.mov.val) {
var guy = c_gettile(target.pos.x, target.pos.y); var guy = c_gettile(target.pos.x, target.pos.y);
if target.pos.x < dude.pos.x { if target.pos.x < dude.pos.x {
@ -41,7 +41,7 @@ function c_doenemyai(target) {
target.waiting = true; target.waiting = true;
break; break;
case AI.WAITER: case AI.WAITER:
var dude = c_findnearestunit(ARMY.US); var dude = c_findnearestunit(target.pos.x,target.pos.y,ARMY.US);
var dist = c_tiledist(target.pos.x, target.pos.y, dude.pos.x, dude.pos.y); var dist = c_tiledist(target.pos.x, target.pos.y, dude.pos.x, dude.pos.y);
if dist.x+dist.y > target.data.mov.val + target.data.rng.val { if dist.x+dist.y > target.data.mov.val + target.data.rng.val {
target.waiting = true; target.waiting = true;