New item bars / Map bugfixes / Stub wave editing

This commit is contained in:
Anuken
2019-03-13 21:26:53 -04:00
parent ecb77b0283
commit f2662045ed
31 changed files with 163 additions and 56 deletions
@@ -1,20 +1,26 @@
package io.anuke.mindustry.game;
import io.anuke.arc.util.serialization.Json;
import io.anuke.arc.util.serialization.Json.Serializable;
import io.anuke.arc.util.serialization.JsonValue;
import io.anuke.mindustry.entities.type.BaseUnit;
import io.anuke.mindustry.type.ContentType;
import io.anuke.mindustry.type.ItemStack;
import io.anuke.mindustry.type.StatusEffect;
import io.anuke.mindustry.type.UnitType;
import static io.anuke.mindustry.Vars.content;
/**
* A spawn group defines spawn information for a specific type of unit, with optional extra information like
* weapon equipped, ammo used, and status effects.
* Each spawn group can have multiple sub-groups spawned in different areas of the map.
*/
public class SpawnGroup{
public class SpawnGroup implements Serializable{
protected static final int never = Integer.MAX_VALUE;
/**The unit type spawned*/
public final UnitType type;
public UnitType type;
/**When this spawn should end*/
protected int end = never;
/**When this spawn should start*/
@@ -36,6 +42,10 @@ public class SpawnGroup{
this.type = type;
}
public SpawnGroup(){
//serialization use only
}
/**Returns the amount of units spawned on a specific wave.*/
public int getUnitsSpawned(int wave){
if(wave < begin || wave > end || (wave - begin) % spacing != 0){
@@ -64,6 +74,30 @@ public class SpawnGroup{
return unit;
}
@Override
public void write (Json json) {
json.writeObjectStart();
json.writeValue("type", type.name);
json.writeValue("begin", begin);
json.writeValue("end", end);
json.writeValue("spacing", spacing);
json.writeValue("max", max);
json.writeValue("scaling", unitScaling);
json.writeValue("amount", unitAmount);
json.writeObjectEnd();
}
@Override
public void read (Json json, JsonValue data) {
type = content.getByName(ContentType.unit, data.getString("type", "dagger"));
begin = data.getInt("begin", 0);
end = data.getInt("end", never);
spacing = data.getInt("spacing", 1);
max = data.getInt("spacing", 40);
unitScaling = data.getFloat("scaling", never);
unitAmount = data.getInt("amount", 1);
}
@Override
public String toString(){
return "SpawnGroup{" +
+3 -3
View File
@@ -28,9 +28,9 @@ public class Stats{
public RankResult calculateRank(Zone zone, boolean launched){
float score = 0;
//each new launch period adds onto the rank 1.5 'points'
//each new launch period adds onto the rank 'points'
if(wavesLasted >= zone.conditionWave){
score += (float)((wavesLasted - zone.conditionWave) / zone.launchPeriod + 1) * 1.5f;
score += (float)((wavesLasted - zone.conditionWave) / zone.launchPeriod + 1) * 1.3f;
}
int capacity = zone.loadout.core().itemCapacity;
@@ -42,7 +42,7 @@ public class Stats{
frac += Mathf.clamp((float)itemsDelivered.get(item, 0) / capacity) / (float)obtainable.size;
}
score += frac*2.4f;
score += frac*2.0f;
if(!launched){
score *= 0.5f;