No Erekir default AI / Core unit tweaks

This commit is contained in:
Anuken
2022-02-06 20:54:57 -05:00
parent cb110e5e6f
commit ce82b3943e
13 changed files with 147 additions and 73 deletions
@@ -231,7 +231,7 @@ public class BulletType extends Content implements Cloneable{
/** Returns maximum distance the bullet this bullet type has can travel. */
public float range(){
if(rangeOverride > 0) return rangeOverride;
return Mathf.zero(drag) ? speed * lifetime : Math.max(speed * (1f - Mathf.pow(1f - drag, lifetime)) / drag, maxRange);
return Math.max(Mathf.zero(drag) ? speed * lifetime : speed * (1f - Mathf.pow(1f - drag, lifetime)) / drag, maxRange);
}
/** @return continuous damage in damage/sec, or -1 if not continuous. */
@@ -33,6 +33,10 @@ public class AIController implements UnitController{
@Override
public void updateUnit(){
if(disabled()){
return;
}
//use fallback AI when possible
if(useFallback() && (fallback != null || (fallback = fallback()) != null)){
if(fallback.unit != unit) fallback.unit(unit);
@@ -45,6 +49,10 @@ public class AIController implements UnitController{
updateMovement();
}
public boolean disabled(){
return !unit.team.isAI() && !unit.type.defaultAI;
}
@Nullable
public AIController fallback(){
return null;