More reasonable AI behavior

This commit is contained in:
Anuken
2020-03-21 14:29:00 -04:00
parent 3563c929af
commit 4813d6c8ff
6 changed files with 31 additions and 10 deletions

View File

@@ -28,7 +28,7 @@ public class FlyingAI extends AIController{
boolean shoot = false;
if(target != null){
attack(40f);
attack(80f);
shoot = unit.inRange(target);
@@ -88,7 +88,7 @@ public class FlyingAI extends AIController{
if(diff > 100f && vec.len() < circleLength){
vec.setAngle(unit.vel().angle());
}else{
vec.setAngle(Mathf.slerpDelta(unit.vel().angle(), vec.angle(), 0.44f));
vec.setAngle(Mathf.slerpDelta(unit.vel().angle(), vec.angle(), 0.6f));
}
vec.setLength(unit.type().speed * Time.delta());

View File

@@ -9,12 +9,13 @@ import mindustry.type.*;
public class UnitTypes implements ContentList{
//TODO reimplement
public static UnitType
wraith, ghoul, revenant, lich, reaper,
ghoul, revenant, lich, reaper,
crawler, titan, fortress, eruptor, chaosArray, eradicator;
public static @EntityDef({Unitc.class, Legsc.class}) UnitType dagger;
public static @EntityDef({Unitc.class, WaterMovec.class}) UnitType vanguard;
public static @EntityDef({Unitc.class, Minerc.class}) UnitType draug;
public static @EntityDef({Unitc.class}) UnitType wraith;
public static @EntityDef({Unitc.class}) UnitType spirit;
public static @EntityDef({Unitc.class, Builderc.class}) UnitType phantom;
@@ -27,7 +28,7 @@ public class UnitTypes implements ContentList{
public void load(){
dagger = new UnitType("dagger"){{
speed = 1f;
speed = 0.5f;
drag = 0.3f;
hitsize = 8f;
mass = 1.75f;
@@ -41,6 +42,25 @@ public class UnitTypes implements ContentList{
}});
}};
wraith = new UnitType("wraith"){{
speed = 3f;
accel = 0.08f;
drag = 0f;
mass = 1.5f;
flying = true;
health = 75;
engineOffset = 5.5f;
range = 140f;
weapons.add(new Weapon(){{
y = 1.5f;
reload = 28f;
alternate = true;
ejectEffect = Fx.shellEjectSmall;
bullet = Bullets.standardCopper;
shootSound = Sounds.shoot;
}});
}};
vanguard = new UnitType("vanguard"){{
speed = 1.3f;
drag = 0.1f;

View File

@@ -211,7 +211,7 @@ public abstract class BulletType extends Content{
bullet.damage(damage < 0 ? this.damage : damage);
bullet.add();
//if(keepVelocity && owner instanceof Velc) bullet.vel().add(((Velc)owner).vel());
if(keepVelocity && owner instanceof Velc) bullet.vel().add(((Velc)owner).vel());
return bullet;
}

View File

@@ -79,8 +79,8 @@ abstract class UnitComp implements Healthc, Velc, Statusc, Teamc, Itemsc, Hitbox
Vec2 v = Geometry.overlap(Tmp.r1, Tmp.r2, true);
float tm = mass() + unit.mass();
float s1 = mass() / tm, s2 = unit.mass() / tm;
move(v.x*s2/scale, v.y*s2/scale);
unit.move(-v.x*s1/scale, -v.y*s1/scale);
impulse(v.x*s2/scale, v.y*s2/scale);
unit.impulse(-v.x*s1/scale, -v.y*s1/scale);
}
@Override

View File

@@ -28,8 +28,8 @@ public class UnitType extends UnlockableContent{
public boolean flying;
public @NonNull Prov<? extends Unitc> constructor;
public @NonNull Prov<? extends UnitController> defaultController = () -> !flying ? new GroundAI() : new FlyingAI();
public float speed = 1.1f, boostSpeed = 0.75f, rotateSpeed = 6f, baseRotateSpeed = 10f;
public float drag = 0.3f, mass = 1f, accel = 0.9f;
public float speed = 1.1f, boostSpeed = 0.75f, rotateSpeed = 5f, baseRotateSpeed = 5f;
public float drag = 0.3f, mass = 1f, accel = 0.5f;
public float health = 200f, range = -1;
public boolean targetAir = true, targetGround = true;
public boolean faceTarget = true, isCounted = true;