Campaign tweaks
This commit is contained in:
@@ -483,6 +483,7 @@ launch.text = Launch
|
|||||||
research.multiplayer = Only the host can research items.
|
research.multiplayer = Only the host can research items.
|
||||||
uncover = Uncover
|
uncover = Uncover
|
||||||
configure = Configure Loadout
|
configure = Configure Loadout
|
||||||
|
|
||||||
#TODO
|
#TODO
|
||||||
loadout = Loadout
|
loadout = Loadout
|
||||||
resources = Resources
|
resources = Resources
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ public class TechTree implements ContentList{
|
|||||||
node(Items.graphite, with(Items.coal, 1000), () -> {
|
node(Items.graphite, with(Items.coal, 1000), () -> {
|
||||||
|
|
||||||
node(graphitePress, () -> {
|
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(pneumaticDrill, () -> {
|
||||||
node(Items.sporePod, with(Items.coal, 5000, Items.graphite, 5000, Items.lead, 5000), () -> {
|
node(Items.sporePod, with(Items.coal, 5000, Items.graphite, 5000, Items.lead, 5000), () -> {
|
||||||
node(cultivator, () -> {
|
node(cultivator, () -> {
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ public class SectorInfo{
|
|||||||
public boolean attack = false;
|
public boolean attack = false;
|
||||||
/** Wave # from state */
|
/** Wave # from state */
|
||||||
public int wave = 1, winWave = -1;
|
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. */
|
/** Time between waves. */
|
||||||
public float waveSpacing = 60 * 60 * 2;
|
public float waveSpacing = 60 * 60 * 2;
|
||||||
/** Damage dealt to sector. */
|
/** Damage dealt to sector. */
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ public class Universe{
|
|||||||
if(state.hasSector()){
|
if(state.hasSector()){
|
||||||
//update sector light
|
//update sector light
|
||||||
float light = state.getSector().getLight();
|
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
|
//assign and map so darkness is not 100% dark
|
||||||
state.rules.ambientLight.a = 1f - alpha;
|
state.rules.ambientLight.a = 1f - alpha;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import static mindustry.Vars.*;
|
|||||||
public class SectorDamage{
|
public class SectorDamage{
|
||||||
//direct damage is for testing only
|
//direct damage is for testing only
|
||||||
private static final boolean direct = false, rubble = true;
|
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 */
|
/** @return calculated capture progress of the enemy */
|
||||||
public static float getDamage(SectorInfo info){
|
public static float getDamage(SectorInfo info){
|
||||||
@@ -32,6 +32,17 @@ public class SectorDamage{
|
|||||||
|
|
||||||
/** @return calculated capture progress of the enemy */
|
/** @return calculated capture progress of the enemy */
|
||||||
public static float getDamage(SectorInfo info, int wavesPassed){
|
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;
|
float health = info.sumHealth;
|
||||||
int wave = info.wave;
|
int wave = info.wave;
|
||||||
float waveSpace = info.waveSpacing;
|
float waveSpace = info.waveSpacing;
|
||||||
@@ -43,7 +54,7 @@ public class SectorDamage{
|
|||||||
int waveEnd = wave + wavesPassed;
|
int waveEnd = wave + wavesPassed;
|
||||||
|
|
||||||
//do not simulate every single wave if there's too many
|
//do not simulate every single wave if there's too many
|
||||||
if(wavesPassed > maxWavesSimulated){
|
if(wavesPassed > maxWavesSimulated && !retWave){
|
||||||
waveBegin = waveEnd - maxWavesSimulated;
|
waveBegin = waveEnd - maxWavesSimulated;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,6 +77,8 @@ public class SectorDamage{
|
|||||||
//sector is lost, enemy took too long.
|
//sector is lost, enemy took too long.
|
||||||
if(timeDestroyEnemy > timeDestroyBase){
|
if(timeDestroyEnemy > timeDestroyBase){
|
||||||
health = 0f;
|
health = 0f;
|
||||||
|
//return current wave if simulating
|
||||||
|
if(retWave) return i - waveBegin;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,6 +93,11 @@ public class SectorDamage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//survived everything
|
||||||
|
if(retWave){
|
||||||
|
return maxRetWave;
|
||||||
|
}
|
||||||
|
|
||||||
return 1f - Mathf.clamp(health / info.sumHealth);
|
return 1f - Mathf.clamp(health / info.sumHealth);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,8 +336,7 @@ public class SectorDamage{
|
|||||||
info.sumDps = sumDps * 1.5f;
|
info.sumDps = sumDps * 1.5f;
|
||||||
info.sumRps = sumRps;
|
info.sumRps = sumRps;
|
||||||
|
|
||||||
//finally, find an equation to put it all together and produce a 0-1 number
|
info.wavesSurvived = getWavesSurvived(info);
|
||||||
//due to the way most defenses are structured, this number will likely need a ^4 power or so
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void apply(float fraction){
|
public static void apply(float fraction){
|
||||||
|
|||||||
@@ -39,17 +39,6 @@ public class Sector{
|
|||||||
this.id = tile.id;
|
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(){
|
public Seq<Sector> near(){
|
||||||
tmpSeq1.clear();
|
tmpSeq1.clear();
|
||||||
for(Ptile tile : tile.tiles){
|
for(Ptile tile : tile.tiles){
|
||||||
@@ -181,7 +170,7 @@ public class Sector{
|
|||||||
|
|
||||||
//for sectors being played on, add items directly
|
//for sectors being played on, add items directly
|
||||||
if(isBeingPlayed()){
|
if(isBeingPlayed()){
|
||||||
count.add(state.rules.defaultTeam.items());
|
if(state.rules.defaultTeam.core() != null) count.add(state.rules.defaultTeam.items());
|
||||||
}else{
|
}else{
|
||||||
//add items already present
|
//add items already present
|
||||||
count.add(info.items);
|
count.add(info.items);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class LaunchLoadoutDialog extends BaseDialog{
|
|||||||
|
|
||||||
addCloseListener();
|
addCloseListener();
|
||||||
|
|
||||||
ItemSeq sitems = sector.getItems();
|
ItemSeq sitems = sector.items();
|
||||||
|
|
||||||
//updates sum requirements
|
//updates sum requirements
|
||||||
Runnable update = () -> {
|
Runnable update = () -> {
|
||||||
@@ -59,7 +59,7 @@ public class LaunchLoadoutDialog extends BaseDialog{
|
|||||||
table.image(s.item.icon(Cicon.small)).left();
|
table.image(s.item.icon(Cicon.small)).left();
|
||||||
int as = schems.get(s.item), al = launches.get(s.item);
|
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(
|
table.add(
|
||||||
sitems.has(s.item, s.amount) ? amountStr :
|
sitems.has(s.item, s.amount) ? amountStr :
|
||||||
|
|||||||
@@ -380,6 +380,12 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
stable.row();
|
stable.row();
|
||||||
stable.add("[accent]" + (int)(sector.info.damage * 100) + "% damaged");
|
stable.add("[accent]" + (int)(sector.info.damage * 100) + "% damaged");
|
||||||
stable.row();
|
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()){
|
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
|
//stored resources
|
||||||
if(sector.hasBase() && sector.info.items.total > 0){
|
if(sector.hasBase() && items.total > 0){
|
||||||
|
|
||||||
stable.add("@sectors.stored").row();
|
stable.add("@sectors.stored").row();
|
||||||
stable.table(t -> {
|
stable.table(t -> {
|
||||||
t.left();
|
t.left();
|
||||||
|
|
||||||
t.table(res -> {
|
t.table(res -> {
|
||||||
ItemSeq items = sector.items();
|
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(ItemStack stack : items){
|
for(ItemStack stack : items){
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ public class CoreBlock extends StorageBlock{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawLight(){
|
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
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user