Include distance in foreshadow targetting (#5221)

* Include distance in foreshadow targetting

* Divide by larger number
This commit is contained in:
MEEP of Faith 2021-05-07 15:35:58 -07:00 committed by GitHub
parent ac8c81a0d5
commit 8d1a34b652
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -26,7 +26,7 @@ public class DefenderAI extends AIController{
//find unit to follow if not in rally mode //find unit to follow if not in rally mode
if(command() != UnitCommand.rally){ if(command() != UnitCommand.rally){
//Sort by max health and closer target. //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; if(result != null) return result;
} }

View File

@ -1,6 +1,7 @@
package mindustry.content; package mindustry.content;
import arc.graphics.*; import arc.graphics.*;
import arc.math.*;
import arc.struct.*; import arc.struct.*;
import mindustry.*; import mindustry.*;
import mindustry.ctype.*; import mindustry.ctype.*;
@ -1754,7 +1755,7 @@ public class Blocks implements ContentList{
size = 4; size = 4;
shootCone = 2f; shootCone = 2f;
shootSound = Sounds.railgun; 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; coolantMultiplier = 0.4f;