Gamemodes removed

This commit is contained in:
Anuken
2019-01-12 16:55:24 -05:00
parent 777bd60f88
commit 8aa1509f47
49 changed files with 741 additions and 678 deletions
@@ -2,23 +2,21 @@ package io.anuke.mindustry.game;
import io.anuke.arc.Core;
/**Presets for time between waves.
* TODO specify correct time*/
public enum Difficulty{
training(3f, 3f),
easy(1.4f, 1.5f),
normal(1f, 1f),
hard(0.5f, 0.75f),
insane(0.25f, 0.5f);
easy(1.4f),
normal(1f),
hard(0.5f),
insane(0.25f);
/**Multiplier of the time between waves.*/
public final float timeScaling;
/**Multiplier of spawner grace period.*/
public final float spawnerScaling;
public final float waveTime;
private String value;
Difficulty(float timeScaling, float spawnerScaling){
this.timeScaling = timeScaling;
this.spawnerScaling = spawnerScaling;
Difficulty(float waveTime){
this.waveTime = waveTime;
}
@Override
@@ -1,44 +0,0 @@
package io.anuke.mindustry.game;
import io.anuke.arc.Core;
public enum GameMode{
waves,
sandbox{{
infiniteResources = true;
disableWaveTimer = true;
}},
freebuild{{
disableWaveTimer = true;
}},
attack{{
disableWaves = true;
enemyCheat = true;
}},
victory{{
disableWaves = true;
hidden = true;
enemyCheat = false;
showMission = false;
}},
pvp{{
disableWaves = true;
isPvp = true;
enemyCoreBuildRadius = 600f;
respawnTime = 60 * 10;
}};
public boolean infiniteResources, disableWaveTimer, disableWaves, showMission = true, hidden, enemyCheat, isPvp;
public float enemyCoreBuildRadius = 400f;
public float respawnTime = 60 * 4;
public String description(){
return Core.bundle.get("mode." + name() + ".description");
}
@Override
public String toString(){
return Core.bundle.get("mode." + name() + ".name");
}
}
@@ -0,0 +1,46 @@
package io.anuke.mindustry.game;
import io.anuke.arc.Core;
import io.anuke.arc.function.Supplier;
/**Defines preset rule sets..*/
public enum RulePreset{
survival(() -> new Rules(){{
waveTimer = true;
waves = true;
unitDrops = true;
}}),
sandbox(() -> new Rules(){{
infiniteResources = true;
waves = true;
waveTimer = false;
}}),
attack(() -> new Rules(){{
enemyCheat = true;
unitDrops = true;
}}),
pvp(() -> new Rules(){{
pvp = true;
enemyCoreBuildRadius = 600f;
respawnTime = 60 * 10;
}});
private final Supplier<Rules> rules;
RulePreset(Supplier<Rules> rules){
this.rules = rules;
}
public Rules get(){
return rules.get();
}
public String description(){
return Core.bundle.get("mode." + name() + ".description");
}
@Override
public String toString(){
return Core.bundle.get("mode." + name() + ".name");
}
}
@@ -0,0 +1,27 @@
package io.anuke.mindustry.game;
import io.anuke.annotations.Annotations.Serialize;
/**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.*/
public boolean infiniteResources;
/**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.*/
public boolean waves;
/**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.*/
public boolean pvp;
/**Whether enemy units drop random items on death.*/
public boolean unitDrops;
/**No-build zone around enemy core radius.*/
public float enemyCoreBuildRadius = 400f;
/**Player respawn time in ticks.*/
public float respawnTime = 60 * 4;
/**Time between waves in ticks.*/
public float waveSpacing = 60 * 60;
}
@@ -215,10 +215,6 @@ public class Saves{
return meta.difficulty;
}
public GameMode getMode(){
return meta.mode;
}
public boolean isAutosave(){
return Core.settings.getBool("save-" + index + "-autosave", true);
}
+1 -1
View File
@@ -35,7 +35,7 @@ public class Teams{
/**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.mode.disableWaves && team == Vars.waveTeam) || get(team).cores.size > 0;
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.*/