Campaign tweaks

This commit is contained in:
Anuken
2020-11-27 11:56:01 -05:00
parent e39eceee28
commit 8dd66fb942
8 changed files with 25 additions and 9 deletions

Binary file not shown.

View File

@@ -88,7 +88,7 @@ public class Vars implements Loadable{
/** duration of time between turns in ticks */ /** duration of time between turns in ticks */
public static final float turnDuration = 2 * Time.toMinutes; public static final float turnDuration = 2 * Time.toMinutes;
/** chance of an invasion per turn, 1 = 100% */ /** chance of an invasion per turn, 1 = 100% */
public static final float baseInvasionChance = 1f / 85f; public static final float baseInvasionChance = 1f / 90f;
/** how many turns have to pass before invasions start */ /** how many turns have to pass before invasions start */
public static final int invasionGracePeriod = 20; public static final int invasionGracePeriod = 20;
/** min armor fraction damage; e.g. 0.05 = at least 5% damage */ /** min armor fraction damage; e.g. 0.05 = at least 5% damage */

View File

@@ -55,11 +55,12 @@ public class BaseAI{
public void update(){ public void update(){
if(data.team.rules().aiCoreSpawn && timer.get(timerSpawn, 60 * 2.5f) && data.hasCore()){ if(data.team.rules().aiCoreSpawn && timer.get(timerSpawn, 60 * 2.5f) && data.hasCore()){
CoreBlock block = (CoreBlock)data.core().block; CoreBlock block = (CoreBlock)data.core().block;
int coreUnits = Groups.unit.count(u -> u.team == data.team && u.type == block.unitType);
//create AI core unit //create AI core unit(s)
if(!state.isEditor() && !Groups.unit.contains(u -> u.team() == data.team && u.type == block.unitType)){ if(!state.isEditor() && coreUnits < data.cores.size){
Unit unit = block.unitType.create(data.team); Unit unit = block.unitType.create(data.team);
unit.set(data.core()); unit.set(data.cores.random());
unit.add(); unit.add();
Fx.spawn.at(unit); Fx.spawn.at(unit);
} }

View File

@@ -88,7 +88,7 @@ public class SectorPresets implements ContentList{
}}; }};
nuclearComplex = new SectorPreset("nuclearComplex", serpulo, 130){{ nuclearComplex = new SectorPreset("nuclearComplex", serpulo, 130){{
captureWave = 50; captureWave = 45;
difficulty = 7; difficulty = 7;
}}; }};

View File

@@ -620,7 +620,7 @@ public class UnitTypes implements ContentList{
drag = 0.4f; drag = 0.4f;
hitSize = 12f; hitSize = 12f;
rotateSpeed = 3f; rotateSpeed = 3f;
health = 800; health = 900;
immunities = ObjectSet.with(StatusEffects.burning, StatusEffects.melting); immunities = ObjectSet.with(StatusEffects.burning, StatusEffects.melting);
legCount = 6; legCount = 6;
legLength = 13f; legLength = 13f;
@@ -651,7 +651,7 @@ public class UnitTypes implements ContentList{
bullet = new SapBulletType(){{ bullet = new SapBulletType(){{
sapStrength = 0.4f; sapStrength = 0.4f;
length = 75f; length = 75f;
damage = 18; damage = 20;
shootEffect = Fx.shootSmall; shootEffect = Fx.shootSmall;
hitColor = color = Color.valueOf("bf92f9"); hitColor = color = Color.valueOf("bf92f9");
despawnEffect = Fx.none; despawnEffect = Fx.none;
@@ -671,7 +671,7 @@ public class UnitTypes implements ContentList{
bullet = new SapBulletType(){{ bullet = new SapBulletType(){{
sapStrength = 0.8f; sapStrength = 0.8f;
length = 40f; length = 40f;
damage = 15; damage = 16;
shootEffect = Fx.shootSmall; shootEffect = Fx.shootSmall;
hitColor = color = Color.valueOf("bf92f9"); hitColor = color = Color.valueOf("bf92f9");
despawnEffect = Fx.none; despawnEffect = Fx.none;

View File

@@ -6,6 +6,7 @@ import arc.struct.*;
import arc.util.*; import arc.util.*;
import mindustry.content.*; import mindustry.content.*;
import mindustry.game.EventType.*; import mindustry.game.EventType.*;
import mindustry.game.SectorInfo.*;
import mindustry.maps.*; import mindustry.maps.*;
import mindustry.type.*; import mindustry.type.*;
import mindustry.world.blocks.storage.*; import mindustry.world.blocks.storage.*;
@@ -199,6 +200,13 @@ public class Universe{
} }
} }
sector.info.export.each((item, amount) -> {
if(sector.info.items.get(item) <= 0 && sector.info.production.get(item, ExportStat::new).mean <= 0){
//disable export when production is negative.
sector.info.export.get(item).mean = 0f;
}
});
//add production, making sure that it's capped //add production, making sure that it's capped
sector.info.production.each((item, stat) -> sector.info.items.add(item, Math.min((int)(stat.mean * newSecondsPassed * scl), sector.info.storageCapacity - sector.info.items.get(item)))); sector.info.production.each((item, stat) -> sector.info.items.add(item, Math.min((int)(stat.mean * newSecondsPassed * scl), sector.info.storageCapacity - sector.info.items.get(item))));
//prevent negative values with unloaders //prevent negative values with unloaders

View File

@@ -262,7 +262,7 @@ public abstract class Weather extends UnlockableContent{
/** Creates a weather entry with some approximate weather values. */ /** Creates a weather entry with some approximate weather values. */
public WeatherEntry(Weather weather){ public WeatherEntry(Weather weather){
this(weather, weather.duration * 3f, weather.duration * 6f, weather.duration / 2f, weather.duration * 1.5f); this(weather, weather.duration * 2f, weather.duration * 6f, weather.duration / 2f, weather.duration * 1.5f);
} }
public WeatherEntry(Weather weather, float minFrequency, float maxFrequency, float minDuration, float maxDuration){ public WeatherEntry(Weather weather, float minFrequency, float maxFrequency, float minDuration, float maxDuration){

View File

@@ -57,6 +57,13 @@ public class StorageBlock extends Block{
} }
} }
@Override
public void itemTaken(Item item){
if(linkedCore != null){
linkedCore.itemTaken(item);
}
}
@Override @Override
public int getMaximumAccepted(Item item){ public int getMaximumAccepted(Item item){
return itemCapacity; return itemCapacity;