Campaign balance / Smarter power node placement
This commit is contained in:
@@ -17,6 +17,7 @@ import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.defense.*;
|
||||
import mindustry.world.blocks.distribution.*;
|
||||
import mindustry.world.blocks.production.*;
|
||||
import mindustry.world.blocks.storage.*;
|
||||
import mindustry.world.blocks.storage.CoreBlock.*;
|
||||
@@ -271,6 +272,10 @@ public class BaseAI{
|
||||
}
|
||||
|
||||
Tile o = world.tile(tile.x + p.x, tile.y + p.y);
|
||||
if(o != null && (o.block() instanceof PayloadAcceptor || o.block() instanceof PayloadConveyor)){
|
||||
break;
|
||||
}
|
||||
|
||||
if(o != null && o.team() == data.team && !(o.block() instanceof Wall)){
|
||||
any = true;
|
||||
break;
|
||||
|
||||
@@ -121,7 +121,7 @@ public class TechTree implements ContentList{
|
||||
|
||||
});
|
||||
|
||||
node(waterExtractor, () -> {
|
||||
node(waterExtractor, Seq.with(new SectorComplete(saltFlats)), () -> {
|
||||
node(oilExtractor, () -> {
|
||||
|
||||
});
|
||||
|
||||
@@ -340,10 +340,10 @@ public class Waves{
|
||||
step += (int)(rand.random(15, 30) * Mathf.lerp(1f, 0.5f, difficulty));
|
||||
}
|
||||
|
||||
int bossWave = (int)(rand.random(50, 70) * Mathf.lerp(1f, 0.5f, difficulty));
|
||||
int bossWave = (int)(rand.random(50, 70) * Mathf.lerp(1f, 0.75f, difficulty));
|
||||
int bossSpacing = (int)(rand.random(25, 40) * Mathf.lerp(1f, 0.6f, difficulty));
|
||||
|
||||
int bossTier = difficulty < 0.5 ? 3 : 4;
|
||||
int bossTier = difficulty < 0.6 ? 3 : 4;
|
||||
|
||||
//main boss progression
|
||||
out.add(new SpawnGroup(Structs.random(species)[bossTier]){{
|
||||
@@ -411,7 +411,7 @@ public class Waves{
|
||||
}
|
||||
|
||||
//shift back waves on higher difficulty for a harder start
|
||||
int shift = Math.max((int)(difficulty * 15 - 5), 0);
|
||||
int shift = Math.max((int)(difficulty * 14 - 5), 0);
|
||||
|
||||
for(SpawnGroup group : out){
|
||||
group.begin -= shift;
|
||||
|
||||
@@ -47,6 +47,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
/** Maximum line length. */
|
||||
final static int maxLength = 100;
|
||||
final static Rect r1 = new Rect(), r2 = new Rect();
|
||||
final static Seq<Point2> tmpPoints = new Seq<>(), tmpPoints2 = new Seq<>();
|
||||
|
||||
public final OverlayFragment frag = new OverlayFragment();
|
||||
|
||||
@@ -1164,27 +1165,39 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
points = Placement.normalizeLine(startX, startY, endX, endY);
|
||||
}
|
||||
|
||||
if(block instanceof PowerNode){
|
||||
Seq<Point2> skip = new Seq<>();
|
||||
if(block instanceof PowerNode node){
|
||||
var base = tmpPoints2;
|
||||
var result = tmpPoints.clear();
|
||||
|
||||
for(int i = 1; i < points.size; i++){
|
||||
int overlaps = 0;
|
||||
Point2 point = points.get(i);
|
||||
base.selectFrom(points, p -> p == points.first() || p == points.peek() || Build.validPlace(block, player.team(), p.x, p.y, rotation, false));
|
||||
boolean addedLast = false;
|
||||
|
||||
//check with how many powernodes the *next* tile will overlap
|
||||
for(int j = 0; j < i; j++){
|
||||
if(!skip.contains(points.get(j)) && ((PowerNode)block).overlaps(world.tile(point.x, point.y), world.tile(points.get(j).x, points.get(j).y))){
|
||||
overlaps++;
|
||||
outer:
|
||||
for(int i = 0; i < base.size;){
|
||||
var point = base.get(i);
|
||||
result.add(point);
|
||||
if(i == base.size - 1) addedLast = true;
|
||||
|
||||
//find the furthest node that overlaps this one
|
||||
for(int j = base.size - 1; j > i; j--){
|
||||
var other = base.get(j);
|
||||
boolean over = node.overlaps(world.tile(point.x, point.y), world.tile(other.x, other.y));
|
||||
|
||||
if(over){
|
||||
//add node to list and start searching for node that overlaps the next one
|
||||
i = j;
|
||||
continue outer;
|
||||
}
|
||||
}
|
||||
|
||||
//if it's more than one, it can bridge the gap
|
||||
if(overlaps > 1){
|
||||
skip.add(points.get(i-1));
|
||||
}
|
||||
//if it got here, that means nothing was found. try to proceed to the next node anyway
|
||||
i ++;
|
||||
}
|
||||
//remove skipped points
|
||||
points.removeAll(skip);
|
||||
|
||||
if(!addedLast) result.add(base.peek());
|
||||
|
||||
points.clear();
|
||||
points.addAll(result);
|
||||
}
|
||||
|
||||
float angle = Angles.angle(startX, startY, endX, endY);
|
||||
|
||||
@@ -241,35 +241,10 @@ public class Placement{
|
||||
}
|
||||
|
||||
public static class NormalizeDrawResult{
|
||||
float x, y, x2, y2;
|
||||
public float x, y, x2, y2;
|
||||
}
|
||||
|
||||
public static class NormalizeResult{
|
||||
public int x, y, x2, y2, rotation;
|
||||
|
||||
boolean isX(){
|
||||
return Math.abs(x2 - x) > Math.abs(y2 - y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns length of greater edge of the selection.
|
||||
*/
|
||||
int getLength(){
|
||||
return Math.max(x2 - x, y2 - y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the X position of a specific index along this area as a line.
|
||||
*/
|
||||
int getScaledX(int i){
|
||||
return x + (x2 - x > y2 - y ? i : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Y position of a specific index along this area as a line.
|
||||
*/
|
||||
int getScaledY(int i){
|
||||
return y + (x2 - x > y2 - y ? 0 : i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ public class Planet extends UnlockableContent{
|
||||
}
|
||||
|
||||
if(sector.hasEnemyBase()){
|
||||
sum += 1f;
|
||||
sum += 0.88f;
|
||||
}
|
||||
|
||||
sector.threat = sector.preset == null ? Math.min(sum / 5f, 1.2f) : Mathf.clamp(sector.preset.difficulty / 10f);
|
||||
|
||||
Reference in New Issue
Block a user