1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-09-11 08:15:35 +03:00

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/
/desktop/packr-out/
/desktop/packr-export/
/core/lib/
## Java

View File

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

View File

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

View File

@ -1,12 +1,28 @@
package io.anuke.mindustry;
import java.util.Date;
import io.anuke.mindustry.GameState.State;
import io.anuke.mindustry.io.Formatter;
import io.anuke.ucore.core.Inputs;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.modules.ModuleCore;
public class Mindustry extends ModuleCore {
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
public void init(){

View File

@ -3,8 +3,6 @@ package io.anuke.mindustry;
import static io.anuke.mindustry.Vars.*;
import static io.anuke.ucore.scene.actions.Actions.*;
import java.text.NumberFormat;
import com.badlogic.gdx.Application.ApplicationType;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
@ -701,7 +699,7 @@ public class UI extends SceneModule{
for(Item stack : Inventory.getItemTypes()){
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);
itemtable.add(image).size(8*3).units(Unit.dp);
itemtable.add(label).left();

View File

@ -14,7 +14,7 @@ public class Vars{
//respawn time in frames
public static final float respawnduration = 60*4;
//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
public static final float maxwavespace = 60*60*6;
//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();
}
},
sniper = new BulletType(3f, 20){
sniper = new BulletType(3f, 23){
public void draw(Bullet b){
Draw.color(Color.LIGHT_GRAY);
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;
hitsize = 8f;

View File

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

View File

@ -23,7 +23,7 @@ public class Enemy extends DestructibleEntity{
public final static int maxtier = 4;
protected float speed = 0.3f;
protected float reload = 40;
protected float reload = 32;
protected float range = 60;
protected float length = 4;
protected float rotatespeed = 7f;
@ -47,7 +47,7 @@ public class Enemy extends DestructibleEntity{
hitsize = 5;
maxhealth = 50;
maxhealth = 60;
heal();
}
@ -104,17 +104,21 @@ public class Enemy extends DestructibleEntity{
}
node = cindex;
//node = 0;
//set(World.spawnpoints.get(spawn).worldx(), World.spawnpoints.get(spawn).worldy());
}
@Override
public void added(){
if(bullet != null){
damage = (int)(bullet.damage * (1 + (tier - 1) * 0.5f));
damage = (int)(bullet.damage * (1 + (tier - 1) * 1f));
}
maxhealth *= tier;
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;
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 io.anuke.mindustry.Inventory;
import io.anuke.mindustry.Mindustry;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.entities.enemies.*;
import io.anuke.mindustry.resource.Item;
@ -85,8 +86,6 @@ public class SaveIO{
/**Save file version ID. Should be incremented every breaking release.*/
private static final int fileVersionID = 7;
private static FormatProvider provider = null;
//TODO automatic registration of types?
private static final Array<Class<? extends Enemy>> enemyIDs = Array.with(
Enemy.class,
@ -126,7 +125,7 @@ public class SaveIO{
try(DataInputStream stream = new DataInputStream(fileFor(slot).read())){
stream.readInt();
Date date = new Date(stream.readLong());
return provider.format(date);
return Mindustry.formatter.format(date);
}catch (IOException e){
throw new RuntimeException(e);
}
@ -147,10 +146,6 @@ public class SaveIO{
return Gdx.files.local("mindustry-saves/" + slot + ".mins");
}
public static void setFormatProvider(FormatProvider prov){
provider = prov;
}
public static void write(FileHandle file){
try(DataOutputStream stream = new DataOutputStream(file.write(false))){
@ -290,6 +285,9 @@ public class SaveIO{
//weapons
Vars.control.getWeapons().clear();
Vars.control.getWeapons().add(Weapon.blaster);
int weapons = stream.readByte();
for(int i = 0; i < weapons; i ++){
@ -400,8 +398,4 @@ public class SaveIO{
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)),
junction(distribution, ProductionBlocks.junction, stack(Item.iron, 2)),
turret(defense, WeaponBlocks.turret, stack(Item.stone, 3)),
dturret(defense, WeaponBlocks.doubleturret, stack(Item.stone, 6)),
machineturret(defense, WeaponBlocks.machineturret, stack(Item.iron, 7), stack(Item.stone, 10)),
shotgunturret(defense, WeaponBlocks.shotgunturret, stack(Item.iron, 9), stack(Item.stone, 10)),
turret(defense, WeaponBlocks.turret, stack(Item.stone, 4)),
dturret(defense, WeaponBlocks.doubleturret, stack(Item.stone, 7)),
machineturret(defense, WeaponBlocks.machineturret, stack(Item.iron, 8), 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)),
sniperturret(defense, WeaponBlocks.sniperturret, stack(Item.iron, 15), stack(Item.steel, 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)),
plasmaturret(defense, WeaponBlocks.plasmaturret, stack(Item.steel, 10), stack(Item.titanium, 10), stack(Item.dirium, 15)),
healturret(defense, WeaponBlocks.repairturret, stack(Item.iron, 25)),
megahealturret(defense, WeaponBlocks.megarepairturret, stack(Item.iron, 15), stack(Item.steel, 25)),
healturret(defense, WeaponBlocks.repairturret, stack(Item.iron, 30)),
megahealturret(defense, WeaponBlocks.megarepairturret, stack(Item.iron, 20), stack(Item.steel, 30)),
drill(production, ProductionBlocks.stonedrill, stack(Item.stone, 16)),
irondrill(production, ProductionBlocks.irondrill, stack(Item.stone, 25)),

View File

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

View File

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

View File

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

View File

@ -98,10 +98,10 @@ public class WeaponBlocks{
{
formalName = "railgun turret";
range = 120;
reload = 60f;
reload = 50f;
bullet = BulletType.sniper;
ammo = Item.steel;
health = 60;
health = 70;
}
},
@ -111,7 +111,7 @@ public class WeaponBlocks{
rotatespeed = 0.1f;
formalName = "flak turret";
range = 120;
reload = 120f;
reload = 100f;
bullet = BulletType.shell;
ammo = Item.coal;
ammoMultiplier = 5;
@ -128,9 +128,10 @@ public class WeaponBlocks{
formalName = "laser turret";
range = 60;
reload = 4f;
damage = 9;
damage = 10;
ammo = Item.coal;
health = 110;
ammoMultiplier = 60;
}
},
@ -139,7 +140,7 @@ public class WeaponBlocks{
{
formalName = "tesla turret";
range = 70;
reload = 20f;
reload = 15f;
bullet = BulletType.shell;
ammo = Item.coal;
health = 140;
@ -151,7 +152,7 @@ public class WeaponBlocks{
Angles.translation(entity.rotation, 4);
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;
formalName = "plasma turret";
range = 60f;
reload = 3f;
reload = 2f;
bullet = BulletType.plasmaflame;
ammo = Item.coal;
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;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
@ -7,8 +8,7 @@ import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
import io.anuke.mindustry.Mindustry;
import io.anuke.mindustry.io.SaveIO;
import io.anuke.mindustry.io.SaveIO.FormatProvider;
import io.anuke.mindustry.io.Formatter;
public class DesktopLauncher {
@ -20,13 +20,19 @@ public class DesktopLauncher {
config.setWindowedMode(800, 600);
config.setWindowIcon("sprites/icon.png");
SaveIO.setFormatProvider(new FormatProvider(){
SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss");
Mindustry.formatter = new Formatter(){
SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm");
@Override
public String format(Date date){
return format.format(date);
}
});
@Override
public String format(int number){
return NumberFormat.getIntegerInstance().format(number);
}
};
Mindustry.args = arg;

View File

@ -1,3 +1,3 @@
org.gradle.daemon=true
org.gradle.jvmargs=-Xms1024m -Xmx2048m
org.gradle.jvmargs=-Xms512m -Xmx1536m
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.GwtApplicationConfiguration;
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.HasVerticalAlignment;
import com.google.gwt.user.client.ui.VerticalPanel;
import io.anuke.mindustry.Mindustry;
import io.anuke.mindustry.io.SaveIO;
import io.anuke.mindustry.io.SaveIO.FormatProvider;
import io.anuke.mindustry.io.Formatter;
public class HtmlLauncher extends GwtApplication {
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){
return "saving not supported";
return format.format(date);
}
});
@Override
public String format(int number){
return NumberFormat.getDecimalFormat().format(number);
}
};
return new Mindustry();
}