Make Base AI walls correspond to tier

This commit is contained in:
Anuken
2021-09-10 21:11:57 -04:00
parent decc570867
commit cccce6badd
2 changed files with 14 additions and 10 deletions

View File

@@ -12,6 +12,7 @@ import mindustry.game.*;
import mindustry.game.Schematic.*;
import mindustry.game.Teams.*;
import mindustry.gen.*;
import mindustry.maps.generators.*;
import mindustry.type.*;
import mindustry.world.*;
import mindustry.world.blocks.defense.*;
@@ -25,7 +26,6 @@ import static mindustry.Vars.*;
public class BaseAI{
private static final Vec2 axis = new Vec2(), rotator = new Vec2();
private static final float correctPercent = 0.5f;
private static final int attempts = 4;
private static final float emptyChance = 0.01f;
private static final int timerStep = 0, timerSpawn = 1, timerRefreshPath = 2;
@@ -46,6 +46,7 @@ public class BaseAI{
boolean calculating, startedCalculating;
int calcCount = 0;
int totalCalcs = 0;
Block wallType;
public BaseAI(TeamData data){
this.data = data;
@@ -53,6 +54,10 @@ public class BaseAI{
public void update(){
if(wallType == null){
wallType = BaseGenerator.getDifficultyWall(1, data.team.rules().aiTier / 0.8f);
}
if(data.team.rules().aiCoreSpawn && timer.get(timerSpawn, 60 * 2.5f) && data.hasCore()){
CoreBlock block = (CoreBlock)data.core().block;
int coreUnits = Groups.unit.count(u -> u.team == data.team && u.type == block.unitType);
@@ -271,7 +276,7 @@ public class BaseAI{
}
private void tryWalls(){
Block wall = Blocks.copperWall;
Block wall = wallType;
Building spawnt = state.rules.defaultTeam.core() != null ? state.rules.defaultTeam.core() : data.team.core();
Tile spawn = spawnt == null ? null : spawnt.tile;