Campaign changes

This commit is contained in:
Anuken
2020-11-13 11:33:31 -05:00
parent 4e7d6e9a9d
commit 0908176079
76 changed files with 137 additions and 49 deletions

View File

@@ -1179,7 +1179,7 @@ public class Blocks implements ContentList{
size = 2;
floating = true;
ambientSound = Sounds.hum;
ambientSoundVolume = 0.04f;
ambientSoundVolume = 0.06f;
}};
steamGenerator = new BurnerGenerator("steam-generator"){{
@@ -1217,13 +1217,13 @@ public class Blocks implements ContentList{
solarPanel = new SolarGenerator("solar-panel"){{
requirements(Category.power, with(Items.lead, 10, Items.silicon, 15));
powerProduction = 0.07f;
powerProduction = 0.08f;
}};
largeSolarPanel = new SolarGenerator("solar-panel-large"){{
requirements(Category.power, with(Items.lead, 100, Items.silicon, 145, Items.phaseFabric, 15));
size = 3;
powerProduction = 0.95f;
powerProduction = 1f;
}};
thoriumReactor = new NuclearReactor("thorium-reactor"){{

View File

@@ -358,6 +358,7 @@ public class Bullets implements ContentList{
shootEffect = Fx.shootBig;
pierceCap = 2;
pierceBuilding = true;
knockback = 0.7f;
}};
standardIncendiaryBig = new BasicBulletType(7f, 60, "bullet"){{

View File

@@ -8,7 +8,7 @@ import static mindustry.content.Planets.*;
public class SectorPresets implements ContentList{
public static SectorPreset
groundZero,
craters, frozenForest, ruinousShores, stainedMountains, tarFields, fungalPass,
craters, biomassFacility, frozenForest, ruinousShores, stainedMountains, tarFields, fungalPass,
saltFlats, overgrowth,
impact0078, desolateRift, nuclearComplex;
@@ -31,6 +31,11 @@ public class SectorPresets implements ContentList{
difficulty = 2;
}};
biomassFacility = new SectorPreset("biomassResearchFacility", serpulo, 81){{
captureWave = 20;
difficulty = 3;
}};
craters = new SectorPreset("craters", serpulo, 18){{
captureWave = 20;
difficulty = 2;
@@ -50,7 +55,7 @@ public class SectorPresets implements ContentList{
difficulty = 4;
}};
overgrowth = new SectorPreset("overgrowth", serpulo, 22){{
overgrowth = new SectorPreset("overgrowth", serpulo, 134){{
difficulty = 5;
}};

View File

@@ -115,7 +115,7 @@ public class TechTree implements ContentList{
node(Items.titanium, with(Items.graphite, 3000, Items.copper, 7000, Items.lead, 7000), () -> {
node(pneumaticDrill, () -> {
node(Items.sporePod, with(Items.coal, 4000, Items.graphite, 4000, Items.lead, 4000), () -> {
node(cultivator, () -> {
node(cultivator, Seq.with(new SectorComplete(biomassFacility)), () -> {
});
});
@@ -524,24 +524,31 @@ public class TechTree implements ContentList{
});
});
node(stainedMountains, Seq.with(
node(biomassFacility, Seq.with(
new SectorComplete(frozenForest),
new Research(pneumaticDrill),
new Research(powerNode),
new Research(steamGenerator)
new Research(steamGenerator),
new Research(scatter),
new Research(graphitePress)
), () -> {
node(fungalPass, Seq.with(
new SectorComplete(stainedMountains),
new Research(groundFactory),
new Research(door),
node(stainedMountains, Seq.with(
new SectorComplete(biomassFacility),
new Research(pneumaticDrill),
new Research(siliconSmelter)
), () -> {
node(nuclearComplex, Seq.with(
new SectorComplete(fungalPass),
new Research(thermalGenerator),
new Research(laserDrill)
node(fungalPass, Seq.with(
new SectorComplete(stainedMountains),
new Research(groundFactory),
new Research(door),
new Research(siliconSmelter)
), () -> {
node(nuclearComplex, Seq.with(
new SectorComplete(fungalPass),
new Research(thermalGenerator),
new Research(laserDrill)
), () -> {
});
});
});
});

View File

@@ -80,6 +80,13 @@ public class Logic implements ApplicationListener{
state.wavetime = state.rules.waveSpacing;
SectorDamage.applyCalculatedDamage();
//make sure damaged buildings are counted
for(Tile tile : world.tiles){
if(tile.build != null && tile.build.damaged()){
indexer.notifyTileDamaged(tile.build);
}
}
}
//reset values

View File

@@ -381,7 +381,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
}
//remove units spawned by the core
if(spawnedByCore && !isPlayer()){
if(spawnedByCore && !isPlayer() && !dead){
Call.unitDespawn(self());
}
}

View File

@@ -124,7 +124,7 @@ public class SectorInfo{
//assign new wave patterns when the version changes
if(waveVersion != Waves.waveVersion && state.rules.sector.preset == null){
state.rules.spawns = Waves.generate(state.rules.sector.baseCoverage);
state.rules.spawns = Waves.generate(state.rules.sector.threat);
}
CoreBuild entity = state.rules.defaultTeam.core();

View File

@@ -285,7 +285,7 @@ public class Waves{
for(int i = start; i < cap;){
int f = i;
int next = rand.random(8, 16) + curTier * 4;
int next = rand.random(8, 16) + (int)Mathf.lerp(4f, 0f, difficulty) + curTier * 4;
float shieldAmount = Math.max((i - shieldStart) * shieldsPerWave, 0);
int space = start == 0 ? 1 : rand.random(1, 2);
@@ -296,8 +296,8 @@ public class Waves{
unitAmount = f == start ? 1 : 6 / (int)scaling[ctier];
begin = f;
end = f + next >= cap ? never : f + next;
max = 14;
unitScaling = (difficulty < 0.4f ? rand.random(2f, 4f) : rand.random(1f, 3f)) * scaling[ctier];
max = 13;
unitScaling = (difficulty < 0.4f ? rand.random(2.5f, 4f) : rand.random(1f, 4f)) * scaling[ctier];
shields = shieldAmount;
shieldScaling = shieldsPerWave;
spacing = space;

View File

@@ -401,7 +401,6 @@ public class DesktopInput extends InputHandler{
ui.schematics.hide();
}else{
ui.schematics.show();
ui.schematics.focusSearchField();
}
}

View File

@@ -13,6 +13,7 @@ import mindustry.gen.*;
import mindustry.type.*;
import mindustry.world.*;
import mindustry.world.blocks.defense.*;
import mindustry.world.blocks.distribution.*;
import mindustry.world.blocks.power.*;
import mindustry.world.blocks.production.*;
import mindustry.world.meta.*;
@@ -38,9 +39,6 @@ public class BaseGenerator{
Mathf.rand.setSeed(sector.id);
//TODO limit base size
float costBudget = 1000;
Seq<Block> wallsSmall = content.blocks().select(b -> b instanceof Wall && b.size == 1 && b.buildVisibility == BuildVisibility.shown && !(b instanceof Door));
Seq<Block> wallsLarge = content.blocks().select(b -> b instanceof Wall && b.size == 2 && b.buildVisibility == BuildVisibility.shown && !(b instanceof Door));
@@ -51,10 +49,12 @@ public class BaseGenerator{
//TODO proper difficulty selection
float bracket = difficulty;
float bracketRange = 0.2f;
float baseChance = Mathf.lerp(0.7f, 1.9f, difficulty);
int wallAngle = 70; //180 for full coverage
double resourceChance = 0.5;
double nonResourceChance = 0.0005;
double resourceChance = 0.5 * baseChance;
double nonResourceChance = 0.0005 * baseChance;
BasePart coreschem = bases.cores.getFrac(bracket);
int passes = difficulty < 0.4 ? 1 : difficulty < 0.8 ? 2 : 3;
Block wall = wallsSmall.getFrac(bracket), wallLarge = wallsLarge.getFrac(bracket);
@@ -69,20 +69,22 @@ public class BaseGenerator{
}
}
//random schematics
pass(tile -> {
if(!tile.block().alwaysReplace) return;
for(int i = 0; i < passes; i++){
//random schematics
pass(tile -> {
if(!tile.block().alwaysReplace) return;
if(((tile.overlay().asFloor().itemDrop != null || (tile.drop() != null && Mathf.chance(nonResourceChance)))
if(((tile.overlay().asFloor().itemDrop != null || (tile.drop() != null && Mathf.chance(nonResourceChance)))
|| (tile.floor().liquidDrop != null && Mathf.chance(nonResourceChance * 2))) && Mathf.chance(resourceChance)){
Seq<BasePart> parts = bases.forResource(tile.drop() != null ? tile.drop() : tile.floor().liquidDrop);
if(!parts.isEmpty()){
tryPlace(parts.getFrac(bracket + Mathf.range(bracketRange)), tile.x, tile.y, team);
Seq<BasePart> parts = bases.forResource(tile.drop() != null ? tile.drop() : tile.floor().liquidDrop);
if(!parts.isEmpty()){
tryPlace(parts.getFrac(bracket + Mathf.range(bracketRange)), tile.x, tile.y, team);
}
}else if(Mathf.chance(nonResourceChance)){
tryPlace(bases.parts.getFrac(bracket + Mathf.range(bracketRange)), tile.x, tile.y, team);
}
}else if(Mathf.chance(nonResourceChance)){
tryPlace(bases.parts.getFrac(bracket + Mathf.range(bracketRange)), tile.x, tile.y, team);
}
});
});
}
//replace walls with the correct type (disabled)
if(false)
@@ -100,6 +102,15 @@ public class BaseGenerator{
if(tile.block().alwaysReplace){
boolean any = false;
for(Point2 p : Geometry.d4){
Tile o = tiles.get(tile.x + p.x, tile.y + p.y);
//do not block payloads
if(o != null && (o.block() instanceof PayloadConveyor || o.block() instanceof PayloadAcceptor)){
return;
}
}
for(Point2 p : Geometry.d8){
if(Angles.angleDist(Angles.angle(p.x, p.y), spawn.angleTo(tile)) > wallAngle){
continue;

View File

@@ -19,7 +19,7 @@ public abstract class PlanetGenerator extends BasicGenerator implements HexMeshe
boolean any = false;
float noise = Noise.snoise3(tile.v.x, tile.v.y, tile.v.z, 0.001f, 0.5f);
if(noise > 0.028){
if(noise > 0.027){
any = true;
}

View File

@@ -232,6 +232,10 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
ores.add(Blocks.oreThorium);
}
if(rand.chance(0.25)){
ores.add(Blocks.oreScrap);
}
FloatSeq frequencies = new FloatSeq();
for(int i = 0; i < ores.size; i++){
frequencies.add(rand.random(-0.09f, 0.01f) - i * 0.01f);
@@ -250,6 +254,10 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
break;
}
}
if(ore == Blocks.oreScrap && rand.chance(0.33)){
floor = Blocks.metalFloorDamaged;
}
});
trimDark();
@@ -326,7 +334,7 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
}
});
float difficulty = sector.baseCoverage;
float difficulty = sector.threat;
ints.clear();
ints.ensureCapacity(width * height / 4);
@@ -417,7 +425,11 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
state.rules.winWave = sector.info.winWave = 10 + 5 * (int)Math.max(difficulty * 10, 1);
}
float waveTimeDec = 0.4f;
state.rules.waveSpacing = Mathf.lerp(60 * 65 * 2, 60f * 60f * 1f, Math.max(difficulty - waveTimeDec, 0f) / 0.8f);
state.rules.waves = sector.info.waves = true;
state.rules.enemyCoreBuildRadius = 600f;
//TODO better waves
state.rules.spawns = Waves.generate(difficulty);

View File

@@ -186,7 +186,7 @@ public class Planet extends UnlockableContent{
sum += 2f;
}
sector.baseCoverage = sector.preset == null ? Mathf.clamp(sum / 5f) : Mathf.clamp(sector.preset.difficulty / 10f);
sector.threat = sector.preset == null ? Mathf.clamp(sum / 5f) : Mathf.clamp(sector.preset.difficulty / 10f);
}
}

View File

@@ -2,6 +2,8 @@ package mindustry.type;
import arc.*;
import arc.func.*;
import arc.graphics.*;
import arc.math.*;
import arc.math.geom.*;
import arc.struct.*;
import arc.util.*;
@@ -28,7 +30,7 @@ public class Sector{
public SectorInfo info = new SectorInfo();
/** Number 0-1 indicating the difficulty based on nearby bases. */
public float baseCoverage;
public float threat;
public boolean generateEnemyBase;
public Sector(Planet planet, Ptile tile){
@@ -54,6 +56,15 @@ public class Sector{
}
}
/** Displays threat as a formatted string. */
public String displayThreat(){
float step = 0.25f;
String color = Tmp.c1.set(Color.white).lerp(Color.scarlet, Mathf.round(threat, step)).toString();
String[] threats = {"low", "medium", "high", "extreme", "eradication"};
int index = Math.min((int)(threat / step), threats.length - 1);
return "[#" + color + "]" + Core.bundle.get("threat." + threats[index]);
}
/** @return whether this sector can be landed on at all.
* Only sectors adjacent to non-wave sectors can be landed on. */
public boolean unlocked(){

View File

@@ -153,9 +153,9 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
public void renderSectors(Planet planet){
//draw all sector stuff
if(!debugSelect && selectAlpha > 0.01f){
if(selectAlpha > 0.01f){
for(Sector sec : planet.sectors){
if(canSelect(sec) || sec.unlocked()){
if(canSelect(sec) || sec.unlocked() || debugSelect){
Color color =
sec.hasBase() ? Tmp.c2.set(Team.sharded.color).lerp(Team.crux.color, sec.hasEnemyBase() ? 0.5f : 0f) :
@@ -389,7 +389,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
stable.add(sector.save != null ? sector.save.getPlayTime() : "@sectors.unexplored").row();
if(sector.isAttacked() || !sector.hasBase()){
stable.add("[accent]Difficulty: " + (int)(sector.baseCoverage * 10)).row();
stable.add("[accent]Threat: " + sector.displayThreat()).row();
}
//TODO put most info in submenu

View File

@@ -283,6 +283,17 @@ public class SchematicsDialog extends BaseDialog{
Core.scene.setKeyboardFocus(searchField);
}
@Override
public Dialog show(){
super.show();
if(Core.app.isDesktop()){
focusSearchField();
}
return this;
}
public static class SchematicImage extends Image{
public float scaling = 16f;
public float thickness = 4f;

View File

@@ -16,7 +16,7 @@ public class GenericSmelter extends GenericCrafter{
public GenericSmelter(String name){
super(name);
ambientSound = Sounds.smelter;
ambientSoundVolume = 0.06f;
ambientSoundVolume = 0.07f;
}
public class SmelterBuild extends GenericCrafterBuild{