Slightly better core upgrade effect
This commit is contained in:
@@ -125,7 +125,11 @@ public class Units{
|
||||
* @return whether the target is invalid
|
||||
*/
|
||||
public static boolean invalidateTarget(Posc target, Team team, float x, float y, float range){
|
||||
return target == null || (range != Float.MAX_VALUE && !target.within(x, y, range + (target instanceof Sized hb ? hb.hitSize()/2f : 0f))) || (target instanceof Teamc t && t.team() == team) || (target instanceof Healthc h && !h.isValid());
|
||||
return target == null ||
|
||||
(range != Float.MAX_VALUE && !target.within(x, y, range + (target instanceof Sized hb ? hb.hitSize()/2f : 0f))) ||
|
||||
(target instanceof Teamc t && t.team() == team) ||
|
||||
(target instanceof Healthc h && !h.isValid()) ||
|
||||
(target instanceof Unit u && !u.type.targetable);
|
||||
}
|
||||
|
||||
/** See {@link #invalidateTarget(Posc, Team, float, float, float)} */
|
||||
@@ -253,7 +257,7 @@ public class Units{
|
||||
cdist = 0f;
|
||||
|
||||
nearbyEnemies(team, x - range, y - range, range*2f, range*2f, e -> {
|
||||
if(e.dead() || !predicate.get(e) || e.team == Team.derelict) return;
|
||||
if(e.dead() || !predicate.get(e) || e.team == Team.derelict || !e.type.targetable) return;
|
||||
|
||||
float dst2 = e.dst2(x, y) - (e.hitSize * e.hitSize);
|
||||
if(dst2 < range*range && (result == null || dst2 < cdist)){
|
||||
@@ -274,7 +278,7 @@ public class Units{
|
||||
cpriority = -99999f;
|
||||
|
||||
nearbyEnemies(team, x - range, y - range, range*2f, range*2f, e -> {
|
||||
if(e.dead() || !predicate.get(e) || e.team == Team.derelict || !e.within(x, y, range + e.hitSize/2f)) return;
|
||||
if(e.dead() || !predicate.get(e) || e.team == Team.derelict || !e.within(x, y, range + e.hitSize/2f) || !e.type.targetable) return;
|
||||
|
||||
float cost = sort.cost(e, x, y);
|
||||
if((result == null || cost < cdist) && e.type.targetPriority >= cpriority){
|
||||
|
||||
Reference in New Issue
Block a user