Merui swap / Bomber command support
This commit is contained in:
@@ -78,11 +78,15 @@ public class CommandAI extends AIController{
|
||||
float engageRange = unit.type.range - 10f;
|
||||
|
||||
if(move){
|
||||
moveTo(vecOut,
|
||||
attackTarget != null && unit.within(attackTarget, engageRange) ? engageRange :
|
||||
unit.isGrounded() ? 0f :
|
||||
attackTarget != null ? engageRange :
|
||||
0f, unit.isFlying() ? 40f : 100f, false, null);
|
||||
if(unit.type.circleTarget && attackTarget != null){
|
||||
circleAttack(80f);
|
||||
}else{
|
||||
moveTo(vecOut,
|
||||
attackTarget != null && unit.within(attackTarget, engageRange) ? engageRange :
|
||||
unit.isGrounded() ? 0f :
|
||||
attackTarget != null ? engageRange :
|
||||
0f, unit.isFlying() ? 40f : 100f, false, null);
|
||||
}
|
||||
|
||||
//calculateFlock().limit(unit.speed() * flockMult)
|
||||
}
|
||||
|
||||
@@ -15,11 +15,11 @@ public class FlyingAI extends AIController{
|
||||
unloadPayloads();
|
||||
|
||||
if(target != null && unit.hasWeapons()){
|
||||
if(!unit.type.circleTarget){
|
||||
if(unit.type.circleTarget){
|
||||
circleAttack(120f);
|
||||
}else{
|
||||
moveTo(target, unit.type.range * 0.8f);
|
||||
unit.lookAt(target);
|
||||
}else{
|
||||
attack(120f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,21 +56,4 @@ public class FlyingAI extends AIController{
|
||||
|
||||
return core;
|
||||
}
|
||||
|
||||
protected void attack(float circleLength){
|
||||
vec.set(target).sub(unit);
|
||||
|
||||
float ang = unit.angleTo(target);
|
||||
float diff = Angles.angleDist(ang, unit.rotation());
|
||||
|
||||
if(diff > 70f && vec.len() < circleLength){
|
||||
vec.setAngle(unit.vel().angle());
|
||||
}else{
|
||||
vec.setAngle(Angles.moveToward(unit.vel().angle(), vec.angle(), 6f));
|
||||
}
|
||||
|
||||
vec.setLength(unit.speed());
|
||||
|
||||
unit.moveAt(vec);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4190,22 +4190,23 @@ public class Blocks{
|
||||
consumePower(2f);
|
||||
}};
|
||||
|
||||
mechFabricator = new UnitFactory("mech-fabricator"){{
|
||||
shipFabricator = new UnitFactory("ship-fabricator"){{
|
||||
requirements(Category.units, with(Items.silicon, 250, Items.beryllium, 200));
|
||||
|
||||
size = 3;
|
||||
configurable = false;
|
||||
plans.add(new UnitPlan(UnitTypes.merui, 60f * 45f, with(Items.beryllium, 50f, Items.silicon, 70f)));
|
||||
plans.add(new UnitPlan(UnitTypes.elude, 60f * 45f, with(Items.beryllium, 50f, Items.silicon, 70f)));
|
||||
regionSuffix = "-dark";
|
||||
fogRadius = 3;
|
||||
researchCostMultiplier = 0.5f;
|
||||
consumePower(2f);
|
||||
}};
|
||||
|
||||
shipFabricator = new UnitFactory("ship-fabricator"){{
|
||||
mechFabricator = new UnitFactory("mech-fabricator"){{
|
||||
requirements(Category.units, with(Items.silicon, 200, Items.graphite, 300, Items.tungsten, 60));
|
||||
size = 3;
|
||||
configurable = false;
|
||||
plans.add(new UnitPlan(UnitTypes.elude, 60f * 40f, with(Items.graphite, 40f, Items.silicon, 70f)));
|
||||
plans.add(new UnitPlan(UnitTypes.merui, 60f * 40f, with(Items.graphite, 40f, Items.silicon, 70f)));
|
||||
regionSuffix = "-dark";
|
||||
fogRadius = 3;
|
||||
researchCostMultiplier = 0.65f;
|
||||
|
||||
@@ -283,13 +283,13 @@ public class ErekirTechTree{
|
||||
|
||||
});
|
||||
|
||||
node(mechFabricator, Seq.with(new OnSector(two)), () -> {
|
||||
node(UnitTypes.merui, () -> {
|
||||
node(shipFabricator, Seq.with(new OnSector(two)), () -> {
|
||||
node(UnitTypes.elude, () -> {
|
||||
|
||||
});
|
||||
|
||||
node(shipFabricator, Seq.with(new OnSector(three)), () -> {
|
||||
node(UnitTypes.elude, () -> {
|
||||
node(mechFabricator, Seq.with(new OnSector(three)), () -> {
|
||||
node(UnitTypes.merui, () -> {
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -234,6 +234,23 @@ public class AIController implements UnitController{
|
||||
}
|
||||
}
|
||||
|
||||
public void circleAttack(float circleLength){
|
||||
vec.set(target).sub(unit);
|
||||
|
||||
float ang = unit.angleTo(target);
|
||||
float diff = Angles.angleDist(ang, unit.rotation());
|
||||
|
||||
if(diff > 70f && vec.len() < circleLength){
|
||||
vec.setAngle(unit.vel().angle());
|
||||
}else{
|
||||
vec.setAngle(Angles.moveToward(unit.vel().angle(), vec.angle(), 6f));
|
||||
}
|
||||
|
||||
vec.setLength(unit.speed());
|
||||
|
||||
unit.moveAt(vec);
|
||||
}
|
||||
|
||||
public void circle(Position target, float circleLength){
|
||||
circle(target, circleLength, unit.speed());
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class Weather extends UnlockableContent{
|
||||
|
||||
public WeatherState create(float intensity, float duration){
|
||||
WeatherState entity = type.get();
|
||||
entity.intensity(intensity);
|
||||
entity.intensity(Mathf.clamp(intensity));
|
||||
entity.init(this);
|
||||
entity.life(duration);
|
||||
entity.add();
|
||||
|
||||
Reference in New Issue
Block a user