More balancing

This commit is contained in:
Anuken 2017-09-26 17:03:17 -04:00
parent e85c7d8e50
commit fa6495ceeb
22 changed files with 112 additions and 62 deletions

1
.gitignore vendored
View File

@ -3,6 +3,7 @@
/deploy/ /deploy/
/desktop/packr-out/ /desktop/packr-out/
/desktop/packr-export/ /desktop/packr-export/
/core/lib/
## Java ## Java

View File

@ -1,15 +1,14 @@
package io.anuke.mindustry; package io.anuke.mindustry;
import java.text.NumberFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Locale;
import com.badlogic.gdx.backends.android.AndroidApplication; import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import android.annotation.SuppressLint;
import android.os.Bundle; import android.os.Bundle;
import io.anuke.mindustry.io.SaveIO; import io.anuke.mindustry.io.Formatter;
import io.anuke.mindustry.io.SaveIO.FormatProvider;
public class AndroidLauncher extends AndroidApplication { public class AndroidLauncher extends AndroidApplication {
@Override @Override
@ -18,13 +17,20 @@ public class AndroidLauncher extends AndroidApplication {
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
config.useImmersiveMode = true; config.useImmersiveMode = true;
SaveIO.setFormatProvider(new FormatProvider(){ Mindustry.formatter = new Formatter(){
SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss", Locale.ENGLISH); @SuppressLint("SimpleDateFormat")
SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm");
@Override
public String format(Date date){ public String format(Date date){
return format.format(date); return format.format(date);
} }
});
@Override
public String format(int number){
return NumberFormat.getIntegerInstance().format(number);
}
};
initialize(new Mindustry(), config); initialize(new Mindustry(), config);
} }

View File

@ -95,8 +95,8 @@ public class Control extends Module{
spawns = Array.with( spawns = Array.with(
new EnemySpawn(Enemy.class){{ new EnemySpawn(Enemy.class){{
scaling = 2; scaling = 3;
tierscaleback = 4; tierscaleback = 3;
}}, }},
new EnemySpawn(FastEnemy.class){{ new EnemySpawn(FastEnemy.class){{
after = 2; after = 2;
@ -114,7 +114,8 @@ public class Control extends Module{
}}, }},
new EnemySpawn(RapidEnemy.class){{ new EnemySpawn(RapidEnemy.class){{
after = 7; after = 7;
spacing = 4; spacing = 3;
scaling = 3;
}}, }},
new EnemySpawn(TankEnemy.class){{ new EnemySpawn(TankEnemy.class){{
after = 4; after = 4;
@ -129,13 +130,13 @@ public class Control extends Module{
); );
/*
//TODO remove this debugging //TODO remove this debugging
for(int i = 1; i < 60; i ++){ for(int i = 1; i < 60; i ++){
UCore.log("\n\n--WAVE " + i); UCore.log("\n\n--WAVE " + i);
printEnemies(i); printEnemies(i);
} }
*/
} }
public void reset(){ public void reset(){
@ -250,13 +251,17 @@ public class Control extends Module{
} }
void printEnemies(int wave){ void printEnemies(int wave){
int total = 0;
for(EnemySpawn spawn : spawns){ for(EnemySpawn spawn : spawns){
int spawnamount = spawn.evaluate(wave, 0); int spawnamount = spawn.evaluate(wave, 0);
total += spawnamount;
if(spawnamount > 0){ if(spawnamount > 0){
UCore.log(ClassReflection.getSimpleName(spawn.type) + " t" + spawn.tier(wave, 0) + " x" + spawnamount); UCore.log(ClassReflection.getSimpleName(spawn.type) + " t" + spawn.tier(wave, 0) + " x" + spawnamount);
} }
} }
UCore.log("Total: " + total);
} }
public void enemyDeath(){ public void enemyDeath(){

View File

@ -1,12 +1,28 @@
package io.anuke.mindustry; package io.anuke.mindustry;
import java.util.Date;
import io.anuke.mindustry.GameState.State; import io.anuke.mindustry.GameState.State;
import io.anuke.mindustry.io.Formatter;
import io.anuke.ucore.core.Inputs; import io.anuke.ucore.core.Inputs;
import io.anuke.ucore.core.Timers; import io.anuke.ucore.core.Timers;
import io.anuke.ucore.modules.ModuleCore; import io.anuke.ucore.modules.ModuleCore;
public class Mindustry extends ModuleCore { public class Mindustry extends ModuleCore {
public static String[] args = {}; public static String[] args = {};
public static Formatter formatter = new Formatter(){
@Override
public String format(Date date){
return "invalid date";
}
@Override
public String format(int number){
return number + "";
}
};
@Override @Override
public void init(){ public void init(){

View File

@ -3,8 +3,6 @@ package io.anuke.mindustry;
import static io.anuke.mindustry.Vars.*; import static io.anuke.mindustry.Vars.*;
import static io.anuke.ucore.scene.actions.Actions.*; import static io.anuke.ucore.scene.actions.Actions.*;
import java.text.NumberFormat;
import com.badlogic.gdx.Application.ApplicationType; import com.badlogic.gdx.Application.ApplicationType;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
@ -701,7 +699,7 @@ public class UI extends SceneModule{
for(Item stack : Inventory.getItemTypes()){ for(Item stack : Inventory.getItemTypes()){
Image image = new Image(Draw.region("icon-" + stack.name())); Image image = new Image(Draw.region("icon-" + stack.name()));
Label label = new Label("" + NumberFormat.getIntegerInstance().format(Inventory.getAmount(stack))); Label label = new Label("" + Mindustry.formatter.format(Inventory.getAmount(stack)));
label.setFontScale(fontscale*1.5f); label.setFontScale(fontscale*1.5f);
itemtable.add(image).size(8*3).units(Unit.dp); itemtable.add(image).size(8*3).units(Unit.dp);
itemtable.add(label).left(); itemtable.add(label).left();

View File

@ -14,7 +14,7 @@ public class Vars{
//respawn time in frames //respawn time in frames
public static final float respawnduration = 60*4; public static final float respawnduration = 60*4;
//time between waves in frames //time between waves in frames
public static final float wavespace = 25*60*(android ? 1 : 1); public static final float wavespace = 30*60*(android ? 1 : 1);
//waves can last no longer than 6 minutes, otherwise the next one spawns //waves can last no longer than 6 minutes, otherwise the next one spawns
public static final float maxwavespace = 60*60*6; public static final float maxwavespace = 60*60*6;
//how far away from spawn points the player can't place blocks //how far away from spawn points the player can't place blocks

View File

@ -31,7 +31,7 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
Draw.reset(); Draw.reset();
} }
}, },
sniper = new BulletType(3f, 20){ sniper = new BulletType(3f, 23){
public void draw(Bullet b){ public void draw(Bullet b){
Draw.color(Color.LIGHT_GRAY); Draw.color(Color.LIGHT_GRAY);
Draw.thick(1f); Draw.thick(1f);
@ -45,7 +45,7 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
} }
} }
}, },
shell = new BulletType(1.1f, 80){ shell = new BulletType(1.1f, 85){
{ {
lifetime = 110f; lifetime = 110f;
hitsize = 8f; hitsize = 8f;

View File

@ -7,7 +7,7 @@ public class BlastEnemy extends Enemy{
public BlastEnemy(int spawn) { public BlastEnemy(int spawn) {
super(spawn); super(spawn);
maxhealth = 15; maxhealth = 30;
speed = 0.65f; speed = 0.65f;
bullet = null; bullet = null;
turretrotatespeed = 0f; turretrotatespeed = 0f;

View File

@ -23,7 +23,7 @@ public class Enemy extends DestructibleEntity{
public final static int maxtier = 4; public final static int maxtier = 4;
protected float speed = 0.3f; protected float speed = 0.3f;
protected float reload = 40; protected float reload = 32;
protected float range = 60; protected float range = 60;
protected float length = 4; protected float length = 4;
protected float rotatespeed = 7f; protected float rotatespeed = 7f;
@ -47,7 +47,7 @@ public class Enemy extends DestructibleEntity{
hitsize = 5; hitsize = 5;
maxhealth = 50; maxhealth = 60;
heal(); heal();
} }
@ -104,17 +104,21 @@ public class Enemy extends DestructibleEntity{
} }
node = cindex; node = cindex;
//node = 0;
//set(World.spawnpoints.get(spawn).worldx(), World.spawnpoints.get(spawn).worldy());
} }
@Override @Override
public void added(){ public void added(){
if(bullet != null){ if(bullet != null){
damage = (int)(bullet.damage * (1 + (tier - 1) * 0.5f)); damage = (int)(bullet.damage * (1 + (tier - 1) * 1f));
} }
maxhealth *= tier; maxhealth *= tier;
speed += 0.04f*tier + Mathf.range(0.1f); speed += 0.04f*tier + Mathf.range(0.1f);
reload /= Math.max(tier /1.5f, 1f); reload /= Math.max(tier / 1.5f, 1f);
range += tier*5; range += tier*5;
heal(); heal();

View File

@ -0,0 +1,8 @@
package io.anuke.mindustry.io;
import java.util.Date;
public interface Formatter{
public String format(Date date);
public String format(int number);
}

View File

@ -15,6 +15,7 @@ import com.badlogic.gdx.utils.TimeUtils;
import com.badlogic.gdx.utils.reflect.ClassReflection; import com.badlogic.gdx.utils.reflect.ClassReflection;
import io.anuke.mindustry.Inventory; import io.anuke.mindustry.Inventory;
import io.anuke.mindustry.Mindustry;
import io.anuke.mindustry.Vars; import io.anuke.mindustry.Vars;
import io.anuke.mindustry.entities.enemies.*; import io.anuke.mindustry.entities.enemies.*;
import io.anuke.mindustry.resource.Item; import io.anuke.mindustry.resource.Item;
@ -85,8 +86,6 @@ public class SaveIO{
/**Save file version ID. Should be incremented every breaking release.*/ /**Save file version ID. Should be incremented every breaking release.*/
private static final int fileVersionID = 7; private static final int fileVersionID = 7;
private static FormatProvider provider = null;
//TODO automatic registration of types? //TODO automatic registration of types?
private static final Array<Class<? extends Enemy>> enemyIDs = Array.with( private static final Array<Class<? extends Enemy>> enemyIDs = Array.with(
Enemy.class, Enemy.class,
@ -126,7 +125,7 @@ public class SaveIO{
try(DataInputStream stream = new DataInputStream(fileFor(slot).read())){ try(DataInputStream stream = new DataInputStream(fileFor(slot).read())){
stream.readInt(); stream.readInt();
Date date = new Date(stream.readLong()); Date date = new Date(stream.readLong());
return provider.format(date); return Mindustry.formatter.format(date);
}catch (IOException e){ }catch (IOException e){
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@ -147,10 +146,6 @@ public class SaveIO{
return Gdx.files.local("mindustry-saves/" + slot + ".mins"); return Gdx.files.local("mindustry-saves/" + slot + ".mins");
} }
public static void setFormatProvider(FormatProvider prov){
provider = prov;
}
public static void write(FileHandle file){ public static void write(FileHandle file){
try(DataOutputStream stream = new DataOutputStream(file.write(false))){ try(DataOutputStream stream = new DataOutputStream(file.write(false))){
@ -290,6 +285,9 @@ public class SaveIO{
//weapons //weapons
Vars.control.getWeapons().clear();
Vars.control.getWeapons().add(Weapon.blaster);
int weapons = stream.readByte(); int weapons = stream.readByte();
for(int i = 0; i < weapons; i ++){ for(int i = 0; i < weapons; i ++){
@ -400,8 +398,4 @@ public class SaveIO{
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
public static interface FormatProvider{
public String format(Date date);
}
} }

View File

@ -21,10 +21,10 @@ public enum Recipe{
router(distribution, ProductionBlocks.router, stack(Item.stone, 2)), router(distribution, ProductionBlocks.router, stack(Item.stone, 2)),
junction(distribution, ProductionBlocks.junction, stack(Item.iron, 2)), junction(distribution, ProductionBlocks.junction, stack(Item.iron, 2)),
turret(defense, WeaponBlocks.turret, stack(Item.stone, 3)), turret(defense, WeaponBlocks.turret, stack(Item.stone, 4)),
dturret(defense, WeaponBlocks.doubleturret, stack(Item.stone, 6)), dturret(defense, WeaponBlocks.doubleturret, stack(Item.stone, 7)),
machineturret(defense, WeaponBlocks.machineturret, stack(Item.iron, 7), stack(Item.stone, 10)), machineturret(defense, WeaponBlocks.machineturret, stack(Item.iron, 8), stack(Item.stone, 10)),
shotgunturret(defense, WeaponBlocks.shotgunturret, stack(Item.iron, 9), stack(Item.stone, 10)), shotgunturret(defense, WeaponBlocks.shotgunturret, stack(Item.iron, 10), stack(Item.stone, 10)),
flameturret(defense, WeaponBlocks.flameturret, stack(Item.iron, 12), stack(Item.steel, 9)), flameturret(defense, WeaponBlocks.flameturret, stack(Item.iron, 12), stack(Item.steel, 9)),
sniperturret(defense, WeaponBlocks.sniperturret, stack(Item.iron, 15), stack(Item.steel, 10)), sniperturret(defense, WeaponBlocks.sniperturret, stack(Item.iron, 15), stack(Item.steel, 10)),
laserturret(defense, WeaponBlocks.laserturret, stack(Item.steel, 10), stack(Item.titanium, 10)), laserturret(defense, WeaponBlocks.laserturret, stack(Item.steel, 10), stack(Item.titanium, 10)),
@ -32,8 +32,8 @@ public enum Recipe{
teslaturret(defense, WeaponBlocks.teslaturret, stack(Item.steel, 10), stack(Item.titanium, 15), stack(Item.dirium, 15)), teslaturret(defense, WeaponBlocks.teslaturret, stack(Item.steel, 10), stack(Item.titanium, 15), stack(Item.dirium, 15)),
plasmaturret(defense, WeaponBlocks.plasmaturret, stack(Item.steel, 10), stack(Item.titanium, 10), stack(Item.dirium, 15)), plasmaturret(defense, WeaponBlocks.plasmaturret, stack(Item.steel, 10), stack(Item.titanium, 10), stack(Item.dirium, 15)),
healturret(defense, WeaponBlocks.repairturret, stack(Item.iron, 25)), healturret(defense, WeaponBlocks.repairturret, stack(Item.iron, 30)),
megahealturret(defense, WeaponBlocks.megarepairturret, stack(Item.iron, 15), stack(Item.steel, 25)), megahealturret(defense, WeaponBlocks.megarepairturret, stack(Item.iron, 20), stack(Item.steel, 30)),
drill(production, ProductionBlocks.stonedrill, stack(Item.stone, 16)), drill(production, ProductionBlocks.stonedrill, stack(Item.stone, 16)),
irondrill(production, ProductionBlocks.irondrill, stack(Item.stone, 25)), irondrill(production, ProductionBlocks.irondrill, stack(Item.stone, 25)),

View File

@ -60,6 +60,9 @@ public class UpgradeDialog extends Dialog{
button.setColor(Color.GRAY); button.setColor(Color.GRAY);
}else if(!Inventory.hasItems(weapon.requirements)){ }else if(!Inventory.hasItems(weapon.requirements)){
button.setDisabled(true); button.setDisabled(true);
}else{
button.setDisabled(false);
button.setColor(Color.WHITE);
} }
}); });

View File

@ -58,7 +58,7 @@ public class Generator{
floor = Blocks.iron; floor = Blocks.iron;
} }
if(Noise.nnoise(x, y, 6, 1) > 0.24){ if(Noise.nnoise(x, y, 6, 1) > 0.238){
floor = Blocks.coal; floor = Blocks.coal;
} }

View File

@ -122,7 +122,7 @@ public class ProductionBlocks{
liquidAmount = 19.99f; liquidAmount = 19.99f;
output = Item.coal; output = Item.coal;
health = 50; health = 50;
purifyTime = 80; purifyTime = 70;
} }
@Override @Override
@ -135,11 +135,11 @@ public class ProductionBlocks{
{ {
formalName = "titanium\nextractor"; formalName = "titanium\nextractor";
input = Item.iron; input = Item.iron;
inputAmount = 11; inputAmount = 6;
inputLiquid = Liquid.water; inputLiquid = Liquid.water;
liquidAmount = 40f; liquidAmount = 40f;
liquidCapacity = 41f; liquidCapacity = 41f;
purifyTime = 90; purifyTime = 80;
output = Item.titanium; output = Item.titanium;
health = 70; health = 70;
} }

View File

@ -98,10 +98,10 @@ public class WeaponBlocks{
{ {
formalName = "railgun turret"; formalName = "railgun turret";
range = 120; range = 120;
reload = 60f; reload = 50f;
bullet = BulletType.sniper; bullet = BulletType.sniper;
ammo = Item.steel; ammo = Item.steel;
health = 60; health = 70;
} }
}, },
@ -111,7 +111,7 @@ public class WeaponBlocks{
rotatespeed = 0.1f; rotatespeed = 0.1f;
formalName = "flak turret"; formalName = "flak turret";
range = 120; range = 120;
reload = 120f; reload = 100f;
bullet = BulletType.shell; bullet = BulletType.shell;
ammo = Item.coal; ammo = Item.coal;
ammoMultiplier = 5; ammoMultiplier = 5;
@ -128,9 +128,10 @@ public class WeaponBlocks{
formalName = "laser turret"; formalName = "laser turret";
range = 60; range = 60;
reload = 4f; reload = 4f;
damage = 9; damage = 10;
ammo = Item.coal; ammo = Item.coal;
health = 110; health = 110;
ammoMultiplier = 60;
} }
}, },
@ -139,7 +140,7 @@ public class WeaponBlocks{
{ {
formalName = "tesla turret"; formalName = "tesla turret";
range = 70; range = 70;
reload = 20f; reload = 15f;
bullet = BulletType.shell; bullet = BulletType.shell;
ammo = Item.coal; ammo = Item.coal;
health = 140; health = 140;
@ -151,7 +152,7 @@ public class WeaponBlocks{
Angles.translation(entity.rotation, 4); Angles.translation(entity.rotation, 4);
new TeslaOrb(tile.worldx() + Angles.x(), tile.worldy() + Angles.y(), new TeslaOrb(tile.worldx() + Angles.x(), tile.worldy() + Angles.y(),
70, (int)(8*Vars.multiplier)).add(); 70, (int)(9*Vars.multiplier)).add();
} }
}, },
@ -161,7 +162,7 @@ public class WeaponBlocks{
inaccuracy = 7f; inaccuracy = 7f;
formalName = "plasma turret"; formalName = "plasma turret";
range = 60f; range = 60f;
reload = 3f; reload = 2f;
bullet = BulletType.plasmaflame; bullet = BulletType.plasmaflame;
ammo = Item.coal; ammo = Item.coal;
health = 180; health = 180;

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,6 @@
package io.anuke.mindustry.desktop; package io.anuke.mindustry.desktop;
import java.text.NumberFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
@ -7,8 +8,7 @@ import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration; import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
import io.anuke.mindustry.Mindustry; import io.anuke.mindustry.Mindustry;
import io.anuke.mindustry.io.SaveIO; import io.anuke.mindustry.io.Formatter;
import io.anuke.mindustry.io.SaveIO.FormatProvider;
public class DesktopLauncher { public class DesktopLauncher {
@ -20,13 +20,19 @@ public class DesktopLauncher {
config.setWindowedMode(800, 600); config.setWindowedMode(800, 600);
config.setWindowIcon("sprites/icon.png"); config.setWindowIcon("sprites/icon.png");
SaveIO.setFormatProvider(new FormatProvider(){ Mindustry.formatter = new Formatter(){
SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss"); SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm");
@Override
public String format(Date date){ public String format(Date date){
return format.format(date); return format.format(date);
} }
});
@Override
public String format(int number){
return NumberFormat.getIntegerInstance().format(number);
}
};
Mindustry.args = arg; Mindustry.args = arg;

View File

@ -1,3 +1,3 @@
org.gradle.daemon=true org.gradle.daemon=true
org.gradle.jvmargs=-Xms1024m -Xmx2048m org.gradle.jvmargs=-Xms512m -Xmx1536m
org.gradle.configureondemand=true org.gradle.configureondemand=true

View File

@ -6,13 +6,14 @@ import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.backends.gwt.GwtApplication; import com.badlogic.gdx.backends.gwt.GwtApplication;
import com.badlogic.gdx.backends.gwt.GwtApplicationConfiguration; import com.badlogic.gdx.backends.gwt.GwtApplicationConfiguration;
import com.google.gwt.dom.client.*; import com.google.gwt.dom.client.*;
import com.google.gwt.i18n.client.NumberFormat;
import com.google.gwt.i18n.shared.DateTimeFormat;
import com.google.gwt.user.client.ui.HasHorizontalAlignment; import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment; import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.VerticalPanel;
import io.anuke.mindustry.Mindustry; import io.anuke.mindustry.Mindustry;
import io.anuke.mindustry.io.SaveIO; import io.anuke.mindustry.io.Formatter;
import io.anuke.mindustry.io.SaveIO.FormatProvider;
public class HtmlLauncher extends GwtApplication { public class HtmlLauncher extends GwtApplication {
static final int WIDTH = 800; static final int WIDTH = 800;
@ -54,12 +55,19 @@ public class HtmlLauncher extends GwtApplication {
} }
}); });
SaveIO.setFormatProvider(new FormatProvider(){ Mindustry.formatter = new Formatter(){
DateTimeFormat format = DateTimeFormat.getFormat("EEE, dd MMM yyyy HH:mm:ss");
@Override
public String format(Date date){ public String format(Date date){
return "saving not supported"; return format.format(date);
} }
});
@Override
public String format(int number){
return NumberFormat.getDecimalFormat().format(number);
}
};
return new Mindustry(); return new Mindustry();
} }