Boost unit rebuild/assist commands
This commit is contained in:
@@ -47,6 +47,8 @@ public class BuilderAI extends AIController{
|
|||||||
|
|
||||||
if(target != null && shouldShoot()){
|
if(target != null && shouldShoot()){
|
||||||
unit.lookAt(target);
|
unit.lookAt(target);
|
||||||
|
}else if(!unit.type.flying){
|
||||||
|
unit.lookAt(unit.prefRotation());
|
||||||
}
|
}
|
||||||
|
|
||||||
unit.updateBuilding = true;
|
unit.updateBuilding = true;
|
||||||
@@ -55,6 +57,8 @@ public class BuilderAI extends AIController{
|
|||||||
following = assistFollowing;
|
following = assistFollowing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean moving = false;
|
||||||
|
|
||||||
if(following != null){
|
if(following != null){
|
||||||
retreatTimer = 0f;
|
retreatTimer = 0f;
|
||||||
//try to follow and mimic someone
|
//try to follow and mimic someone
|
||||||
@@ -83,6 +87,7 @@ public class BuilderAI extends AIController{
|
|||||||
var core = unit.closestCore();
|
var core = unit.closestCore();
|
||||||
if(core != null && !unit.within(core, retreatDst)){
|
if(core != null && !unit.within(core, retreatDst)){
|
||||||
moveTo(core, retreatDst);
|
moveTo(core, retreatDst);
|
||||||
|
moving = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -114,7 +119,8 @@ public class BuilderAI extends AIController{
|
|||||||
|
|
||||||
if(valid){
|
if(valid){
|
||||||
//move toward the plan
|
//move toward the plan
|
||||||
moveTo(req.tile(), unit.type.buildRange - 20f);
|
moveTo(req.tile(), unit.type.buildRange - 20f, 20f);
|
||||||
|
moving = !unit.within(req.tile(), unit.type.buildRange - 10f);
|
||||||
}else{
|
}else{
|
||||||
//discard invalid plan
|
//discard invalid plan
|
||||||
unit.plans.removeFirst();
|
unit.plans.removeFirst();
|
||||||
@@ -124,6 +130,7 @@ public class BuilderAI extends AIController{
|
|||||||
|
|
||||||
if(assistFollowing != null){
|
if(assistFollowing != null){
|
||||||
moveTo(assistFollowing, assistFollowing.type.hitSize + unit.type.hitSize/2f + 60f);
|
moveTo(assistFollowing, assistFollowing.type.hitSize + unit.type.hitSize/2f + 60f);
|
||||||
|
moving = !unit.within(assistFollowing, assistFollowing.type.hitSize + unit.type.hitSize/2f + 65f);
|
||||||
}
|
}
|
||||||
|
|
||||||
//follow someone and help them build
|
//follow someone and help them build
|
||||||
@@ -186,6 +193,10 @@ public class BuilderAI extends AIController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!unit.type.flying){
|
||||||
|
unit.updateBoosting(moving || unit.floorOn().isDuct || unit.floorOn().damageTaken > 0f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean nearEnemy(int x, int y){
|
protected boolean nearEnemy(int x, int y){
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public class StatusEffect extends UnlockableContent{
|
|||||||
boolean reacts = false;
|
boolean reacts = false;
|
||||||
|
|
||||||
for(var e : opposites.toSeq().sort()){
|
for(var e : opposites.toSeq().sort()){
|
||||||
stats.add(Stat.opposites, e.emoji() + "" + e);
|
stats.add(Stat.opposites, e.emoji() + e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(reactive){
|
if(reactive){
|
||||||
|
|||||||
@@ -828,6 +828,10 @@ public class UnitType extends UnlockableContent implements Senseable{
|
|||||||
|
|
||||||
if(canBoost){
|
if(canBoost){
|
||||||
cmds.add(UnitCommand.boostCommand);
|
cmds.add(UnitCommand.boostCommand);
|
||||||
|
|
||||||
|
if(buildSpeed > 0f){
|
||||||
|
cmds.add(UnitCommand.rebuildCommand, UnitCommand.assistCommand);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//healing, mining and building is only supported for flying units; pathfinding to ambiguously reachable locations is hard.
|
//healing, mining and building is only supported for flying units; pathfinding to ambiguously reachable locations is hard.
|
||||||
|
|||||||
Reference in New Issue
Block a user