Source reformat
This commit is contained in:
@@ -4,7 +4,7 @@ import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.type.ContentType;
|
||||
|
||||
|
||||
/**Base class for a content type that is loaded in {@link io.anuke.mindustry.core.ContentLoader}.*/
|
||||
/** Base class for a content type that is loaded in {@link io.anuke.mindustry.core.ContentLoader}. */
|
||||
public abstract class Content{
|
||||
public final byte id;
|
||||
|
||||
@@ -19,7 +19,7 @@ public abstract class Content{
|
||||
*/
|
||||
public abstract ContentType getContentType();
|
||||
|
||||
/**Called after all content is created. Do not use to load regions or texture data!*/
|
||||
/** Called after all content is created. Do not use to load regions or texture data! */
|
||||
public void init(){
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.anuke.mindustry.game;
|
||||
|
||||
/**Interface for a list of content to be loaded in {@link io.anuke.mindustry.core.ContentLoader}.*/
|
||||
/** Interface for a list of content to be loaded in {@link io.anuke.mindustry.core.ContentLoader}. */
|
||||
public interface ContentList{
|
||||
/**This method should create all the content.*/
|
||||
/** This method should create all the content. */
|
||||
void load();
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package io.anuke.mindustry.game;
|
||||
|
||||
import io.anuke.arc.collection.Array;
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.content.StatusEffects;
|
||||
import io.anuke.mindustry.content.UnitTypes;
|
||||
import io.anuke.mindustry.content.*;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
|
||||
public class DefaultWaves{
|
||||
@@ -12,158 +10,158 @@ public class DefaultWaves{
|
||||
public static Array<SpawnGroup> get(){
|
||||
if(spawns == null && UnitTypes.dagger != null){
|
||||
spawns = Array.with(
|
||||
new SpawnGroup(UnitTypes.dagger){{
|
||||
end = 8;
|
||||
unitScaling = 1.5f;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.dagger){{
|
||||
end = 8;
|
||||
unitScaling = 1.5f;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.wraith){{
|
||||
begin = 12;
|
||||
end = 14;
|
||||
unitScaling = 1f;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.wraith){{
|
||||
begin = 12;
|
||||
end = 14;
|
||||
unitScaling = 1f;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.dagger){{
|
||||
begin = 11;
|
||||
unitScaling = 1.7f;
|
||||
spacing = 2;
|
||||
max = 4;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.dagger){{
|
||||
begin = 11;
|
||||
unitScaling = 1.7f;
|
||||
spacing = 2;
|
||||
max = 4;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.titan){{
|
||||
begin = 9;
|
||||
spacing = 3;
|
||||
unitScaling = 2;
|
||||
new SpawnGroup(UnitTypes.titan){{
|
||||
begin = 9;
|
||||
spacing = 3;
|
||||
unitScaling = 2;
|
||||
|
||||
end = 30;
|
||||
}},
|
||||
end = 30;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.dagger){{
|
||||
begin = 8;
|
||||
unitScaling = 1;
|
||||
unitAmount = 1;
|
||||
spacing = 2;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.dagger){{
|
||||
begin = 8;
|
||||
unitScaling = 1;
|
||||
unitAmount = 1;
|
||||
spacing = 2;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.titan){{
|
||||
begin = 28;
|
||||
spacing = 3;
|
||||
unitScaling = 1;
|
||||
end = 40;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.titan){{
|
||||
begin = 28;
|
||||
spacing = 3;
|
||||
unitScaling = 1;
|
||||
end = 40;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.titan){{
|
||||
begin = 45;
|
||||
spacing = 3;
|
||||
unitScaling = 2;
|
||||
effect = StatusEffects.overdrive;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.titan){{
|
||||
begin = 45;
|
||||
spacing = 3;
|
||||
unitScaling = 2;
|
||||
effect = StatusEffects.overdrive;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.titan){{
|
||||
begin = 120;
|
||||
spacing = 2;
|
||||
unitScaling = 3;
|
||||
unitAmount = 5;
|
||||
effect = StatusEffects.overdrive;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.titan){{
|
||||
begin = 120;
|
||||
spacing = 2;
|
||||
unitScaling = 3;
|
||||
unitAmount = 5;
|
||||
effect = StatusEffects.overdrive;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.wraith){{
|
||||
begin = 16;
|
||||
unitScaling = 1;
|
||||
spacing = 2;
|
||||
new SpawnGroup(UnitTypes.wraith){{
|
||||
begin = 16;
|
||||
unitScaling = 1;
|
||||
spacing = 2;
|
||||
|
||||
max = 12;
|
||||
}},
|
||||
max = 12;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.dagger){{
|
||||
begin = 82;
|
||||
spacing = 3;
|
||||
unitAmount = 4;
|
||||
unitScaling = 3;
|
||||
effect = StatusEffects.overdrive;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.dagger){{
|
||||
begin = 82;
|
||||
spacing = 3;
|
||||
unitAmount = 4;
|
||||
unitScaling = 3;
|
||||
effect = StatusEffects.overdrive;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.dagger){{
|
||||
begin = 41;
|
||||
spacing = 5;
|
||||
unitAmount = 1;
|
||||
unitScaling = 3;
|
||||
effect = StatusEffects.shielded;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.dagger){{
|
||||
begin = 41;
|
||||
spacing = 5;
|
||||
unitAmount = 1;
|
||||
unitScaling = 3;
|
||||
effect = StatusEffects.shielded;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.fortress){{
|
||||
begin = 40;
|
||||
spacing = 5;
|
||||
unitAmount = 2;
|
||||
unitScaling = 2;
|
||||
max = 20;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.fortress){{
|
||||
begin = 40;
|
||||
spacing = 5;
|
||||
unitAmount = 2;
|
||||
unitScaling = 2;
|
||||
max = 20;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.dagger){{
|
||||
begin = 35;
|
||||
spacing = 3;
|
||||
unitAmount = 4;
|
||||
effect = StatusEffects.overdrive;
|
||||
items = new ItemStack(Items.blastCompound, 60);
|
||||
end = 60;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.dagger){{
|
||||
begin = 35;
|
||||
spacing = 3;
|
||||
unitAmount = 4;
|
||||
effect = StatusEffects.overdrive;
|
||||
items = new ItemStack(Items.blastCompound, 60);
|
||||
end = 60;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.dagger){{
|
||||
begin = 42;
|
||||
spacing = 3;
|
||||
unitAmount = 4;
|
||||
effect = StatusEffects.overdrive;
|
||||
items = new ItemStack(Items.pyratite, 100);
|
||||
end = 130;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.dagger){{
|
||||
begin = 42;
|
||||
spacing = 3;
|
||||
unitAmount = 4;
|
||||
effect = StatusEffects.overdrive;
|
||||
items = new ItemStack(Items.pyratite, 100);
|
||||
end = 130;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.ghoul){{
|
||||
begin = 40;
|
||||
unitAmount = 2;
|
||||
spacing = 2;
|
||||
unitScaling = 3;
|
||||
max = 8;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.ghoul){{
|
||||
begin = 40;
|
||||
unitAmount = 2;
|
||||
spacing = 2;
|
||||
unitScaling = 3;
|
||||
max = 8;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.wraith){{
|
||||
begin = 50;
|
||||
unitAmount = 4;
|
||||
unitScaling = 3;
|
||||
spacing = 5;
|
||||
effect = StatusEffects.overdrive;
|
||||
max = 8;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.wraith){{
|
||||
begin = 50;
|
||||
unitAmount = 4;
|
||||
unitScaling = 3;
|
||||
spacing = 5;
|
||||
effect = StatusEffects.overdrive;
|
||||
max = 8;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.revenant){{
|
||||
begin = 50;
|
||||
unitAmount = 2;
|
||||
unitScaling = 3;
|
||||
spacing = 5;
|
||||
max = 8;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.revenant){{
|
||||
begin = 50;
|
||||
unitAmount = 2;
|
||||
unitScaling = 3;
|
||||
spacing = 5;
|
||||
max = 8;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.ghoul){{
|
||||
begin = 53;
|
||||
unitAmount = 2;
|
||||
unitScaling = 3;
|
||||
spacing = 4;
|
||||
max = 8;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.ghoul){{
|
||||
begin = 53;
|
||||
unitAmount = 2;
|
||||
unitScaling = 3;
|
||||
spacing = 4;
|
||||
max = 8;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.eruptor){{
|
||||
begin = 31;
|
||||
unitAmount = 4;
|
||||
unitScaling = 1;
|
||||
spacing = 3;
|
||||
}},
|
||||
new SpawnGroup(UnitTypes.eruptor){{
|
||||
begin = 31;
|
||||
unitAmount = 4;
|
||||
unitScaling = 1;
|
||||
spacing = 3;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.ghoul){{
|
||||
begin = 90;
|
||||
unitAmount = 2;
|
||||
unitScaling = 3;
|
||||
spacing = 4;
|
||||
max = 8;
|
||||
}}
|
||||
new SpawnGroup(UnitTypes.ghoul){{
|
||||
begin = 90;
|
||||
unitAmount = 2;
|
||||
unitScaling = 3;
|
||||
spacing = 4;
|
||||
max = 8;
|
||||
}}
|
||||
);
|
||||
}
|
||||
return spawns == null ? new Array<>() : spawns;
|
||||
|
||||
@@ -2,15 +2,17 @@ package io.anuke.mindustry.game;
|
||||
|
||||
import io.anuke.arc.Core;
|
||||
|
||||
/**Presets for time between waves.
|
||||
* TODO specify correct time*/
|
||||
/**
|
||||
* Presets for time between waves.
|
||||
* TODO specify correct time
|
||||
*/
|
||||
public enum Difficulty{
|
||||
easy(1.4f),
|
||||
normal(1f),
|
||||
hard(0.5f),
|
||||
insane(0.25f);
|
||||
|
||||
/**Multiplier of the time between waves.*/
|
||||
/** Multiplier of the time between waves. */
|
||||
public final float waveTime;
|
||||
|
||||
private String value;
|
||||
|
||||
@@ -2,14 +2,14 @@ package io.anuke.mindustry.game;
|
||||
|
||||
import io.anuke.arc.Events.Event;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.entities.type.Unit;
|
||||
import io.anuke.mindustry.entities.traits.BuilderTrait;
|
||||
import io.anuke.mindustry.entities.type.Unit;
|
||||
import io.anuke.mindustry.type.Zone;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
public class EventType{
|
||||
|
||||
/**Called when a zone's requirements are met.*/
|
||||
/** Called when a zone's requirements are met. */
|
||||
public static class ZoneRequireCompleteEvent implements Event{
|
||||
public final Zone zone, required;
|
||||
|
||||
@@ -19,7 +19,7 @@ public class EventType{
|
||||
}
|
||||
}
|
||||
|
||||
/**Called when a zone's requirements are met.*/
|
||||
/** Called when a zone's requirements are met. */
|
||||
public static class ZoneConfigureCompleteEvent implements Event{
|
||||
public final Zone zone;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class EventType{
|
||||
}
|
||||
}
|
||||
|
||||
/**Called when the game is first loaded.*/
|
||||
/** Called when the game is first loaded. */
|
||||
public static class GameLoadEvent implements Event{
|
||||
|
||||
}
|
||||
@@ -53,12 +53,12 @@ public class EventType{
|
||||
}
|
||||
}
|
||||
|
||||
/**Called when a game begins and the world is loaded.*/
|
||||
/** Called when a game begins and the world is loaded. */
|
||||
public static class WorldLoadEvent implements Event{
|
||||
|
||||
}
|
||||
|
||||
/**Called from the logic thread. Do not access graphics here!*/
|
||||
/** Called from the logic thread. Do not access graphics here! */
|
||||
public static class TileChangeEvent implements Event{
|
||||
public final Tile tile;
|
||||
|
||||
@@ -84,8 +84,10 @@ public class EventType{
|
||||
}
|
||||
}
|
||||
|
||||
/**Called when block building begins by placing down the BuildBlock.
|
||||
* The tile's block will nearly always be a BuildBlock.*/
|
||||
/**
|
||||
* Called when block building begins by placing down the BuildBlock.
|
||||
* The tile's block will nearly always be a BuildBlock.
|
||||
*/
|
||||
public static class BlockBuildBeginEvent implements Event{
|
||||
public final Tile tile;
|
||||
public final Team team;
|
||||
@@ -110,8 +112,10 @@ public class EventType{
|
||||
}
|
||||
}
|
||||
|
||||
/**Called when a player or drone begins building something.
|
||||
* This does not necessarily happen when a new BuildBlock is created.*/
|
||||
/**
|
||||
* Called when a player or drone begins building something.
|
||||
* This does not necessarily happen when a new BuildBlock is created.
|
||||
*/
|
||||
public static class BuildSelectEvent implements Event{
|
||||
public final Tile tile;
|
||||
public final Team team;
|
||||
|
||||
@@ -2,20 +2,16 @@ package io.anuke.mindustry.game;
|
||||
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.Events;
|
||||
import io.anuke.arc.collection.ObjectIntMap;
|
||||
import io.anuke.arc.collection.ObjectMap;
|
||||
import io.anuke.arc.collection.ObjectSet;
|
||||
import io.anuke.arc.collection.*;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.game.EventType.UnlockEvent;
|
||||
import io.anuke.mindustry.type.ContentType;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.mindustry.type.*;
|
||||
|
||||
import static io.anuke.mindustry.Vars.content;
|
||||
import static io.anuke.mindustry.Vars.state;
|
||||
|
||||
/**Stores player unlocks. Clientside only.*/
|
||||
/** Stores player unlocks. Clientside only. */
|
||||
public class GlobalData{
|
||||
private ObjectMap<ContentType, ObjectSet<String>> unlocked = new ObjectMap<>();
|
||||
private ObjectIntMap<Item> items = new ObjectIntMap<>();
|
||||
@@ -74,7 +70,7 @@ public class GlobalData{
|
||||
return items;
|
||||
}
|
||||
|
||||
/** Returns whether or not this piece of content is unlocked yet.*/
|
||||
/** Returns whether or not this piece of content is unlocked yet. */
|
||||
public boolean isUnlocked(UnlockableContent content){
|
||||
return content.alwaysUnlocked() || unlocked.getOr(content.getContentType(), ObjectSet::new).contains(content.name);
|
||||
}
|
||||
@@ -95,7 +91,7 @@ public class GlobalData{
|
||||
}
|
||||
}
|
||||
|
||||
/** Clears all unlocked content. Automatically saves.*/
|
||||
/** Clears all unlocked content. Automatically saves. */
|
||||
public void reset(){
|
||||
save();
|
||||
}
|
||||
@@ -116,7 +112,7 @@ public class GlobalData{
|
||||
|
||||
//set up default values
|
||||
if(!Core.settings.has("item-" + Items.copper.name)){
|
||||
addItem(Items.copper, 50);
|
||||
addItem(Items.copper, 50);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.anuke.mindustry.game;
|
||||
|
||||
public abstract class MappableContent extends Content {
|
||||
public abstract class MappableContent extends Content{
|
||||
public final String name;
|
||||
|
||||
public MappableContent(String name){
|
||||
|
||||
@@ -3,7 +3,7 @@ package io.anuke.mindustry.game;
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.function.Supplier;
|
||||
|
||||
/**Defines preset rule sets..*/
|
||||
/** Defines preset rule sets.. */
|
||||
public enum RulePreset{
|
||||
survival(() -> new Rules(){{
|
||||
waveTimer = true;
|
||||
|
||||
@@ -3,42 +3,44 @@ package io.anuke.mindustry.game;
|
||||
import io.anuke.annotations.Annotations.Serialize;
|
||||
import io.anuke.arc.collection.Array;
|
||||
|
||||
/**Defines current rules on how the game should function.
|
||||
* Does not store game state, just configuration.*/
|
||||
/**
|
||||
* Defines current rules on how the game should function.
|
||||
* Does not store game state, just configuration.
|
||||
*/
|
||||
@Serialize
|
||||
public class Rules{
|
||||
/**Whether the player has infinite resources.*/
|
||||
/** Whether the player has infinite resources. */
|
||||
public boolean infiniteResources;
|
||||
/**Whether the waves come automatically on a timer. If not, waves come when the play button is pressed.*/
|
||||
/** Whether the waves come automatically on a timer. If not, waves come when the play button is pressed. */
|
||||
public boolean waveTimer = true;
|
||||
/**Whether waves are spawnable at all.*/
|
||||
/** Whether waves are spawnable at all. */
|
||||
public boolean waves;
|
||||
/**Whether the enemy AI has infinite resources in most of their buildings and turrets.*/
|
||||
/** Whether the enemy AI has infinite resources in most of their buildings and turrets. */
|
||||
public boolean enemyCheat;
|
||||
/**Whether the game objective is PvP. Note that this enables automatic hosting.*/
|
||||
/** Whether the game objective is PvP. Note that this enables automatic hosting. */
|
||||
public boolean pvp;
|
||||
/**Whether enemy units drop random items on death.*/
|
||||
/** Whether enemy units drop random items on death. */
|
||||
public boolean unitDrops;
|
||||
/**How fast unit pads build units.*/
|
||||
/** How fast unit pads build units. */
|
||||
public float unitBuildSpeedMultiplier = 1f;
|
||||
/**How much health units start with.*/
|
||||
/** How much health units start with. */
|
||||
public float unitHealthMultiplier = 1f;
|
||||
/**How much damage player mechs deal.*/
|
||||
/** How much damage player mechs deal. */
|
||||
public float playerDamageMultiplier = 1f;
|
||||
/**How much damage any other units deal.*/
|
||||
/** How much damage any other units deal. */
|
||||
public float unitDamageMultiplier = 1f;
|
||||
/**Multiplier for buildings for the player.*/
|
||||
/** Multiplier for buildings for the player. */
|
||||
public float buildCostMultiplier = 1f;
|
||||
/**Multiplier for building speed.*/
|
||||
/** Multiplier for building speed. */
|
||||
public float buildSpeedMultiplier = 1f;
|
||||
/**No-build zone around enemy core radius.*/
|
||||
/** No-build zone around enemy core radius. */
|
||||
public float enemyCoreBuildRadius = 400f;
|
||||
/**Player respawn time in ticks.*/
|
||||
/** Player respawn time in ticks. */
|
||||
public float respawnTime = 60 * 4;
|
||||
/**Time between waves in ticks.*/
|
||||
/** Time between waves in ticks. */
|
||||
public float waveSpacing = 60 * 60 * 2;
|
||||
/**Zone ID, -1 for invalid zone.*/
|
||||
/** Zone ID, -1 for invalid zone. */
|
||||
public byte zone = -1;
|
||||
/**Spawn layout. Since only zones modify this, it should be assigned on save load.*/
|
||||
/** Spawn layout. Since only zones modify this, it should be assigned on save load. */
|
||||
public transient Array<SpawnGroup> spawns = DefaultWaves.get();
|
||||
}
|
||||
|
||||
@@ -2,9 +2,7 @@ package io.anuke.mindustry.game;
|
||||
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.Events;
|
||||
import io.anuke.arc.collection.Array;
|
||||
import io.anuke.arc.collection.IntArray;
|
||||
import io.anuke.arc.collection.IntMap;
|
||||
import io.anuke.arc.collection.*;
|
||||
import io.anuke.arc.files.FileHandle;
|
||||
import io.anuke.arc.util.Strings;
|
||||
import io.anuke.arc.util.Time;
|
||||
@@ -48,7 +46,7 @@ public class Saves{
|
||||
saves.clear();
|
||||
IntArray slots = Core.settings.getObject("save-slots", IntArray.class, IntArray::new);
|
||||
|
||||
for(int i = 0; i < slots.size; i ++){
|
||||
for(int i = 0; i < slots.size; i++){
|
||||
int index = slots.get(i);
|
||||
if(SaveIO.isSaveValid(index)){
|
||||
SaveSlot slot = new SaveSlot(index);
|
||||
@@ -68,7 +66,7 @@ public class Saves{
|
||||
SaveSlot current = this.current;
|
||||
|
||||
if(current != null && !state.is(State.menu)
|
||||
&& !(state.isPaused() && Core.scene.hasDialog())){
|
||||
&& !(state.isPaused() && Core.scene.hasDialog())){
|
||||
if(lastTimestamp != 0){
|
||||
totalPlaytime += Time.timeSinceMillis(lastTimestamp);
|
||||
}
|
||||
|
||||
@@ -4,10 +4,7 @@ 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 io.anuke.mindustry.type.*;
|
||||
|
||||
import static io.anuke.mindustry.Vars.content;
|
||||
|
||||
@@ -19,23 +16,23 @@ import static io.anuke.mindustry.Vars.content;
|
||||
public class SpawnGroup implements Serializable{
|
||||
public static final int never = Integer.MAX_VALUE;
|
||||
|
||||
/**The unit type spawned*/
|
||||
/** The unit type spawned */
|
||||
public UnitType type;
|
||||
/**When this spawn should end*/
|
||||
/** When this spawn should end */
|
||||
public int end = never;
|
||||
/**When this spawn should start*/
|
||||
/** When this spawn should start */
|
||||
public int begin;
|
||||
/**The spacing, in waves, of spawns. For example, 2 = spawns every other wave*/
|
||||
/** The spacing, in waves, of spawns. For example, 2 = spawns every other wave */
|
||||
public int spacing = 1;
|
||||
/**Maximum amount of units that spawn*/
|
||||
/** Maximum amount of units that spawn */
|
||||
public int max = 100;
|
||||
/**How many waves need to pass before the amount of units spawned increases by 1*/
|
||||
/** How many waves need to pass before the amount of units spawned increases by 1 */
|
||||
public float unitScaling = never;
|
||||
/**Amount of enemies spawned initially, with no scaling*/
|
||||
/** Amount of enemies spawned initially, with no scaling */
|
||||
public int unitAmount = 1;
|
||||
/**Status effect applied to the spawned unit. Null to disable.*/
|
||||
/** Status effect applied to the spawned unit. Null to disable. */
|
||||
public StatusEffect effect;
|
||||
/**Items this unit spawns with. Null to disable.*/
|
||||
/** Items this unit spawns with. Null to disable. */
|
||||
public ItemStack items;
|
||||
|
||||
public SpawnGroup(UnitType type){
|
||||
@@ -46,14 +43,14 @@ public class SpawnGroup implements Serializable{
|
||||
//serialization use only
|
||||
}
|
||||
|
||||
/**Returns the amount of units spawned on a specific wave.*/
|
||||
/** Returns the amount of units spawned on a specific wave. */
|
||||
public int getUnitsSpawned(int wave){
|
||||
if(wave < begin || wave > end || (wave - begin) % spacing != 0){
|
||||
return 0;
|
||||
}
|
||||
float scaling = this.unitScaling;
|
||||
|
||||
return Math.min(unitAmount - 1 + Math.max((int) (((wave - begin + 1) / spacing) / scaling), 1), max);
|
||||
return Math.min(unitAmount - 1 + Math.max((int)(((wave - begin + 1) / spacing) / scaling), 1), max);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,25 +4,23 @@ import io.anuke.annotations.Annotations.Serialize;
|
||||
import io.anuke.arc.collection.Array;
|
||||
import io.anuke.arc.collection.ObjectIntMap;
|
||||
import io.anuke.arc.math.Mathf;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.ItemType;
|
||||
import io.anuke.mindustry.type.Zone;
|
||||
import io.anuke.mindustry.type.*;
|
||||
|
||||
@Serialize
|
||||
public class Stats{
|
||||
/**Items delivered to global resoure counter. Zones only.*/
|
||||
/** Items delivered to global resoure counter. Zones only. */
|
||||
public ObjectIntMap<Item> itemsDelivered = new ObjectIntMap<>();
|
||||
/**Enemy (red team) units destroyed.*/
|
||||
/** Enemy (red team) units destroyed. */
|
||||
public int enemyUnitsDestroyed;
|
||||
/**Total waves lasted.*/
|
||||
/** Total waves lasted. */
|
||||
public int wavesLasted;
|
||||
/**Total (ms) time lasted in this save/zone.*/
|
||||
/** Total (ms) time lasted in this save/zone. */
|
||||
public long timeLasted;
|
||||
/**Friendly buildings fully built.*/
|
||||
/** Friendly buildings fully built. */
|
||||
public int buildingsBuilt;
|
||||
/**Friendly buildings fully deconstructed.*/
|
||||
/** Friendly buildings fully deconstructed. */
|
||||
public int buildingsDeconstructed;
|
||||
/**Friendly buildings destroyed.*/
|
||||
/** Friendly buildings destroyed. */
|
||||
public int buildingsDestroyed;
|
||||
|
||||
public RankResult calculateRank(Zone zone, boolean launched){
|
||||
@@ -30,7 +28,7 @@ public class Stats{
|
||||
|
||||
//each new launch period adds onto the rank 'points'
|
||||
if(wavesLasted >= zone.conditionWave){
|
||||
score += (float)((wavesLasted - zone.conditionWave) / zone.launchPeriod + 1) * 1.2f;
|
||||
score += (float)((wavesLasted - zone.conditionWave) / zone.launchPeriod + 1) * 1.2f;
|
||||
}
|
||||
|
||||
int capacity = zone.loadout.core().itemCapacity;
|
||||
@@ -42,13 +40,13 @@ public class Stats{
|
||||
frac += Mathf.clamp((float)itemsDelivered.get(item, 0) / capacity) / (float)obtainable.size;
|
||||
}
|
||||
|
||||
score += frac*1.6f;
|
||||
score += frac * 1.6f;
|
||||
|
||||
if(!launched){
|
||||
score *= 0.5f;
|
||||
}
|
||||
|
||||
int rankIndex = Mathf.clamp((int)(score), 0, Rank.values().length-1);
|
||||
int rankIndex = Mathf.clamp((int)(score), 0, Rank.values().length - 1);
|
||||
Rank rank = Rank.values()[rankIndex];
|
||||
String sign = Math.abs((rankIndex + 0.5f) - score) < 0.2f || rank.name().contains("S") ? "" : (rankIndex + 0.5f) < score ? "-" : "+";
|
||||
|
||||
@@ -57,7 +55,7 @@ public class Stats{
|
||||
|
||||
public static class RankResult{
|
||||
public final Rank rank;
|
||||
/**+ or -*/
|
||||
/** + or - */
|
||||
public final String modifier;
|
||||
|
||||
public RankResult(Rank rank, String modifier){
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
package io.anuke.mindustry.game;
|
||||
|
||||
import io.anuke.arc.collection.Array;
|
||||
import io.anuke.arc.collection.EnumSet;
|
||||
import io.anuke.arc.collection.ObjectSet;
|
||||
import io.anuke.arc.collection.*;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
/**Class for various team-based utilities.*/
|
||||
/** Class for various team-based utilities. */
|
||||
public class Teams{
|
||||
private TeamData[] map = new TeamData[Team.all.length];
|
||||
|
||||
/**
|
||||
* Register a team.
|
||||
*
|
||||
* @param team The team type enum.
|
||||
* @param enemies The array of enemies of this team. Any team not in this array is considered neutral.
|
||||
*/
|
||||
@@ -20,7 +17,7 @@ public class Teams{
|
||||
map[team.ordinal()] = new TeamData(team, EnumSet.of(enemies));
|
||||
}
|
||||
|
||||
/**Returns team data by type.*/
|
||||
/** Returns team data by type. */
|
||||
public TeamData get(Team team){
|
||||
if(map[team.ordinal()] == null){
|
||||
add(team, Array.with(Team.all).select(t -> t != team).toArray(Team.class));
|
||||
@@ -28,18 +25,18 @@ public class Teams{
|
||||
return map[team.ordinal()];
|
||||
}
|
||||
|
||||
/**Returns whether a team is active, e.g. whether it has any cores remaining.*/
|
||||
/** Returns whether a team is active, e.g. whether it has any cores remaining. */
|
||||
public boolean isActive(Team team){
|
||||
//the enemy wave team is always active
|
||||
return (Vars.state.rules.waves && team == Vars.waveTeam) || get(team).cores.size > 0;
|
||||
}
|
||||
|
||||
/**Returns a set of all teams that are enemies of this team.*/
|
||||
/** Returns a set of all teams that are enemies of this team. */
|
||||
public EnumSet<Team> enemiesOf(Team team){
|
||||
return get(team).enemies;
|
||||
}
|
||||
|
||||
/**Returns whether {@param other} is an enemy of {@param #team}.*/
|
||||
/** Returns whether {@param other} is an enemy of {@param #team}. */
|
||||
public boolean areEnemies(Team team, Team other){
|
||||
return enemiesOf(team).contains(other);
|
||||
}
|
||||
|
||||
@@ -5,11 +5,11 @@ import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||
import io.anuke.arc.scene.ui.layout.Table;
|
||||
import io.anuke.mindustry.Vars;
|
||||
|
||||
/**Base interface for an unlockable content type.*/
|
||||
/** Base interface for an unlockable content type. */
|
||||
public abstract class UnlockableContent extends MappableContent{
|
||||
/**Localized, formal name. Never null. Set to block name if not found in bundle.*/
|
||||
/** Localized, formal name. Never null. Set to block name if not found in bundle. */
|
||||
public String localizedName;
|
||||
/**Localized description. May be null.*/
|
||||
/** Localized description. May be null. */
|
||||
public String description;
|
||||
|
||||
public UnlockableContent(String name){
|
||||
@@ -19,24 +19,24 @@ public abstract class UnlockableContent extends MappableContent{
|
||||
this.description = Core.bundle.getOrNull(getContentType() + "." + name + ".description");
|
||||
}
|
||||
|
||||
/**Returns the localized name of this content.*/
|
||||
/** Returns the localized name of this content. */
|
||||
public abstract String localizedName();
|
||||
|
||||
public abstract TextureRegion getContentIcon();
|
||||
|
||||
/**This should show all necessary info about this content in the specified table.*/
|
||||
/** This should show all necessary info about this content in the specified table. */
|
||||
public abstract void displayInfo(Table table);
|
||||
|
||||
/**Called when this content is unlocked. Use this to unlock other related content.*/
|
||||
/** Called when this content is unlocked. Use this to unlock other related content. */
|
||||
public void onUnlock(){
|
||||
}
|
||||
|
||||
/**Whether this content is always hidden in the content info dialog.*/
|
||||
/** Whether this content is always hidden in the content info dialog. */
|
||||
public boolean isHidden(){
|
||||
return false;
|
||||
}
|
||||
|
||||
/**Override to make content always unlocked.*/
|
||||
/** Override to make content always unlocked. */
|
||||
public boolean alwaysUnlocked(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -9,15 +9,15 @@ import io.anuke.arc.util.io.PropertiesUtils;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Version{
|
||||
/**Build type. 'official' for official releases; 'custom' or 'bleeding edge' are also used.*/
|
||||
/** Build type. 'official' for official releases; 'custom' or 'bleeding edge' are also used. */
|
||||
public static String type;
|
||||
/**Build modifier, e.g. 'alpha' or 'release'*/
|
||||
/** Build modifier, e.g. 'alpha' or 'release' */
|
||||
public static String modifier;
|
||||
/**Number specifying the major version, e.g. '4'*/
|
||||
/** Number specifying the major version, e.g. '4' */
|
||||
public static int number;
|
||||
/**Build number, e.g. '43'. set to '-1' for custom builds.*/
|
||||
/** Build number, e.g. '43'. set to '-1' for custom builds. */
|
||||
public static int build = 0;
|
||||
/**Revision number. Used for hotfixes. Does not affect server compatibility.*/
|
||||
/** Revision number. Used for hotfixes. Does not affect server compatibility. */
|
||||
public static int revision = 0;
|
||||
|
||||
public static void init(){
|
||||
|
||||
Reference in New Issue
Block a user