From 316adf63ee16dabf5360081b5773bcc5f6a07df5 Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 6 Aug 2021 11:07:30 -0400 Subject: [PATCH] Multi-target zenith AI --- core/src/mindustry/content/UnitTypes.java | 5 +++++ core/src/mindustry/entities/comp/PuddleComp.java | 4 ++-- core/src/mindustry/type/UnitType.java | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index 571f01f9ad..ed9d68beb3 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -935,6 +935,8 @@ public class UnitTypes implements ContentList{ engineOffset = 5.5f; range = 140f; targetAir = false; + //as default AI, flares are not very useful in core rushes, they attack nothing in the way + playerTargetFlags = new BlockFlag[]{null}; targetFlags = new BlockFlag[]{BlockFlag.generator, null}; commandLimit = 4; circleTarget = true; @@ -969,6 +971,8 @@ public class UnitTypes implements ContentList{ range = 140f; faceTarget = false; armor = 3f; + //do not rush core, attack closest + playerTargetFlags = new BlockFlag[]{null}; targetFlags = new BlockFlag[]{BlockFlag.factory, null}; commandLimit = 5; circleTarget = true; @@ -1006,6 +1010,7 @@ public class UnitTypes implements ContentList{ range = 140f; hitSize = 20f; lowAltitude = true; + forceMultiTarget = true; armor = 5f; targetFlags = new BlockFlag[]{BlockFlag.launchPad, BlockFlag.storage, BlockFlag.battery, null}; diff --git a/core/src/mindustry/entities/comp/PuddleComp.java b/core/src/mindustry/entities/comp/PuddleComp.java index 0e9e779c58..63b3f25f6a 100644 --- a/core/src/mindustry/entities/comp/PuddleComp.java +++ b/core/src/mindustry/entities/comp/PuddleComp.java @@ -41,7 +41,7 @@ abstract class PuddleComp implements Posc, Puddlec, Drawc{ @Import int id; @Import float x, y; - transient float accepting, updateTime, lastRipple; + transient float accepting, updateTime, lastRipple = Time.time + Mathf.random(40f); float amount; Tile tile; Liquid liquid; @@ -73,7 +73,7 @@ abstract class PuddleComp implements Posc, Puddlec, Drawc{ amount = Mathf.clamp(amount, 0, maxLiquid); - if(amount <= 0f){ + if(amount <= 0f || Puddles.get(tile) != self()){ remove(); } diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index 93efe9b5bc..0640400182 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java @@ -121,6 +121,7 @@ public class UnitType extends UnlockableContent{ public boolean canHeal = false; /** If true, all weapons will attack the same target. */ public boolean singleTarget = false; + public boolean forceMultiTarget = false; public ObjectSet immunities = new ObjectSet<>(); public Sound deathSound = Sounds.bang; @@ -319,7 +320,7 @@ public class UnitType extends UnlockableContent{ } clipSize = Math.max(clipSize, lightRadius * 1.1f); - singleTarget = weapons.size <= 1; + singleTarget = weapons.size <= 1 && !forceMultiTarget; if(itemCapacity < 0){ itemCapacity = Math.max(Mathf.round((int)(hitSize * 4.3), 10), 10);