From 8d1a34b652b16698f812a2940e6eafc4ec6c5e0f Mon Sep 17 00:00:00 2001 From: MEEP of Faith <54301439+MEEPofFaith@users.noreply.github.com> Date: Fri, 7 May 2021 15:35:58 -0700 Subject: [PATCH] Include distance in foreshadow targetting (#5221) * Include distance in foreshadow targetting * Divide by larger number --- core/src/mindustry/ai/types/DefenderAI.java | 2 +- core/src/mindustry/content/Blocks.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/ai/types/DefenderAI.java b/core/src/mindustry/ai/types/DefenderAI.java index 1f4275a3ac..93040727e0 100644 --- a/core/src/mindustry/ai/types/DefenderAI.java +++ b/core/src/mindustry/ai/types/DefenderAI.java @@ -26,7 +26,7 @@ public class DefenderAI extends AIController{ //find unit to follow if not in rally mode if(command() != UnitCommand.rally){ //Sort by max health and closer target. - var result = Units.closest(unit.team, x, y, Math.max(range, 400f), u -> !u.dead() && u.type != unit.type, (u, tx, ty) -> -u.maxHealth + Mathf.dst2(u.x, u.y, tx, ty) / 800f); + var result = Units.closest(unit.team, x, y, Math.max(range, 400f), u -> !u.dead() && u.type != unit.type, (u, tx, ty) -> -u.maxHealth + Mathf.dst2(u.x, u.y, tx, ty) / 6400f); if(result != null) return result; } diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index ce383efbbd..042a043228 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -1,6 +1,7 @@ package mindustry.content; import arc.graphics.*; +import arc.math.*; import arc.struct.*; import mindustry.*; import mindustry.ctype.*; @@ -1754,7 +1755,7 @@ public class Blocks implements ContentList{ size = 4; shootCone = 2f; shootSound = Sounds.railgun; - unitSort = (u, x, y) -> -u.maxHealth; + unitSort = (u, x, y) -> -u.maxHealth + Mathf.dst2(u.x, u.y, x, y) / 6400f; coolantMultiplier = 0.4f;