mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-21 01:37:13 +07:00
Campaign tweaks
This commit is contained in:
parent
784a280bef
commit
76ff55d7f1
@ -483,6 +483,7 @@ launch.text = Launch
|
||||
research.multiplayer = Only the host can research items.
|
||||
uncover = Uncover
|
||||
configure = Configure Loadout
|
||||
|
||||
#TODO
|
||||
loadout = Loadout
|
||||
resources = Resources
|
||||
|
@ -112,7 +112,7 @@ public class TechTree implements ContentList{
|
||||
node(Items.graphite, with(Items.coal, 1000), () -> {
|
||||
|
||||
node(graphitePress, () -> {
|
||||
node(Items.titanium, with(Items.graphite, 6000, Items.copper, 10000, Items.lead, 10000), () -> {
|
||||
node(Items.titanium, with(Items.graphite, 3000, Items.copper, 7000, Items.lead, 7000), () -> {
|
||||
node(pneumaticDrill, () -> {
|
||||
node(Items.sporePod, with(Items.coal, 5000, Items.graphite, 5000, Items.lead, 5000), () -> {
|
||||
node(cultivator, () -> {
|
||||
|
@ -45,6 +45,8 @@ public class SectorInfo{
|
||||
public boolean attack = false;
|
||||
/** Wave # from state */
|
||||
public int wave = 1, winWave = -1;
|
||||
/** Waves this sector can survive if under attack. Based on wave in info. <0 means uncalculated. */
|
||||
public int wavesSurvived = -1;
|
||||
/** Time between waves. */
|
||||
public float waveSpacing = 60 * 60 * 2;
|
||||
/** Damage dealt to sector. */
|
||||
|
@ -84,7 +84,7 @@ public class Universe{
|
||||
if(state.hasSector()){
|
||||
//update sector light
|
||||
float light = state.getSector().getLight();
|
||||
float alpha = Mathf.clamp(Mathf.map(light, 0f, 0.8f, 0.1f, 1f));
|
||||
float alpha = Mathf.clamp(Mathf.map(light, 0f, 0.8f, 0.2f, 1f));
|
||||
|
||||
//assign and map so darkness is not 100% dark
|
||||
state.rules.ambientLight.a = 1f - alpha;
|
||||
|
@ -23,7 +23,7 @@ import static mindustry.Vars.*;
|
||||
public class SectorDamage{
|
||||
//direct damage is for testing only
|
||||
private static final boolean direct = false, rubble = true;
|
||||
private static final int maxWavesSimulated = 50;
|
||||
private static final int maxWavesSimulated = 50, maxRetWave = 100;
|
||||
|
||||
/** @return calculated capture progress of the enemy */
|
||||
public static float getDamage(SectorInfo info){
|
||||
@ -32,6 +32,17 @@ public class SectorDamage{
|
||||
|
||||
/** @return calculated capture progress of the enemy */
|
||||
public static float getDamage(SectorInfo info, int wavesPassed){
|
||||
return getDamage(info, wavesPassed, false);
|
||||
}
|
||||
|
||||
/** @return maximum waves survived, up to maxRetWave. */
|
||||
public static int getWavesSurvived(SectorInfo info){
|
||||
return (int)getDamage(info, maxRetWave, true);
|
||||
}
|
||||
|
||||
/** @return calculated capture progress of the enemy if retWave if false, otherwise return the maximum waves survived as int.
|
||||
* if it survives all the waves, returns maxRetWave. */
|
||||
public static float getDamage(SectorInfo info, int wavesPassed, boolean retWave){
|
||||
float health = info.sumHealth;
|
||||
int wave = info.wave;
|
||||
float waveSpace = info.waveSpacing;
|
||||
@ -43,7 +54,7 @@ public class SectorDamage{
|
||||
int waveEnd = wave + wavesPassed;
|
||||
|
||||
//do not simulate every single wave if there's too many
|
||||
if(wavesPassed > maxWavesSimulated){
|
||||
if(wavesPassed > maxWavesSimulated && !retWave){
|
||||
waveBegin = waveEnd - maxWavesSimulated;
|
||||
}
|
||||
|
||||
@ -66,6 +77,8 @@ public class SectorDamage{
|
||||
//sector is lost, enemy took too long.
|
||||
if(timeDestroyEnemy > timeDestroyBase){
|
||||
health = 0f;
|
||||
//return current wave if simulating
|
||||
if(retWave) return i - waveBegin;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -80,6 +93,11 @@ public class SectorDamage{
|
||||
}
|
||||
}
|
||||
|
||||
//survived everything
|
||||
if(retWave){
|
||||
return maxRetWave;
|
||||
}
|
||||
|
||||
return 1f - Mathf.clamp(health / info.sumHealth);
|
||||
}
|
||||
|
||||
@ -318,8 +336,7 @@ public class SectorDamage{
|
||||
info.sumDps = sumDps * 1.5f;
|
||||
info.sumRps = sumRps;
|
||||
|
||||
//finally, find an equation to put it all together and produce a 0-1 number
|
||||
//due to the way most defenses are structured, this number will likely need a ^4 power or so
|
||||
info.wavesSurvived = getWavesSurvived(info);
|
||||
}
|
||||
|
||||
public static void apply(float fraction){
|
||||
|
@ -39,17 +39,6 @@ public class Sector{
|
||||
this.id = tile.id;
|
||||
}
|
||||
|
||||
/** @return a copy of the items in this sector - may be core items, or stored data. */
|
||||
public ItemSeq getItems(){
|
||||
if(isBeingPlayed()){
|
||||
ItemSeq out = new ItemSeq();
|
||||
if(state.rules.defaultTeam.core() != null) out.add(state.rules.defaultTeam.core().items);
|
||||
return out;
|
||||
}else{
|
||||
return info.items;
|
||||
}
|
||||
}
|
||||
|
||||
public Seq<Sector> near(){
|
||||
tmpSeq1.clear();
|
||||
for(Ptile tile : tile.tiles){
|
||||
@ -181,7 +170,7 @@ public class Sector{
|
||||
|
||||
//for sectors being played on, add items directly
|
||||
if(isBeingPlayed()){
|
||||
count.add(state.rules.defaultTeam.items());
|
||||
if(state.rules.defaultTeam.core() != null) count.add(state.rules.defaultTeam.items());
|
||||
}else{
|
||||
//add items already present
|
||||
count.add(info.items);
|
||||
|
@ -38,7 +38,7 @@ public class LaunchLoadoutDialog extends BaseDialog{
|
||||
|
||||
addCloseListener();
|
||||
|
||||
ItemSeq sitems = sector.getItems();
|
||||
ItemSeq sitems = sector.items();
|
||||
|
||||
//updates sum requirements
|
||||
Runnable update = () -> {
|
||||
@ -59,7 +59,7 @@ public class LaunchLoadoutDialog extends BaseDialog{
|
||||
table.image(s.item.icon(Cicon.small)).left();
|
||||
int as = schems.get(s.item), al = launches.get(s.item);
|
||||
|
||||
String amountStr = "[lightgray]" + (al + " + [accent]" + as + "[lightgray]");
|
||||
String amountStr = (al + as) + "[gray] (" + (al + " + " + as + ")");
|
||||
|
||||
table.add(
|
||||
sitems.has(s.item, s.amount) ? amountStr :
|
||||
|
@ -380,6 +380,12 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
stable.row();
|
||||
stable.add("[accent]" + (int)(sector.info.damage * 100) + "% damaged");
|
||||
stable.row();
|
||||
|
||||
if(sector.info.wavesSurvived >= 0 && sector.info.wavesSurvived - sector.info.wavesPassed >= 0 && !sector.isBeingPlayed()){
|
||||
boolean plus = (sector.info.wavesSurvived - sector.info.wavesPassed) >= 99;
|
||||
stable.add("[accent]Will survive " + (sector.info.wavesSurvived - sector.info.wavesPassed) + (plus ? "+" : "") + " waves");
|
||||
stable.row();
|
||||
}
|
||||
}
|
||||
|
||||
if(sector.save != null && sector.info.resources.any()){
|
||||
@ -416,14 +422,16 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
}
|
||||
}
|
||||
|
||||
ItemSeq items = sector.items();
|
||||
|
||||
//stored resources
|
||||
if(sector.hasBase() && sector.info.items.total > 0){
|
||||
if(sector.hasBase() && items.total > 0){
|
||||
|
||||
stable.add("@sectors.stored").row();
|
||||
stable.table(t -> {
|
||||
t.left();
|
||||
|
||||
t.table(res -> {
|
||||
ItemSeq items = sector.items();
|
||||
|
||||
int i = 0;
|
||||
for(ItemStack stack : items){
|
||||
|
@ -217,7 +217,7 @@ public class CoreBlock extends StorageBlock{
|
||||
|
||||
@Override
|
||||
public void drawLight(){
|
||||
Drawf.light(team, x, y, 30f * size, Pal.accent, 0.5f + Mathf.absin(20f, 0.1f));
|
||||
Drawf.light(team, x, y, 30f + 20f * size, Pal.accent, 0.65f + Mathf.absin(20f, 0.1f));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user