Fixed game-over state / Recipe balance

This commit is contained in:
Anuken
2018-08-25 15:35:35 -04:00
parent e392c8f0e6
commit 74d7b43d0f
4 changed files with 36 additions and 25 deletions

View File

@ -22,7 +22,7 @@ public class Items implements ContentList{
lead = new Item("lead", Color.valueOf("8c7fa9")){{
type = ItemType.material;
hardness = 1;
cost = 0.6f;
cost = 0.9f;
}};
densealloy = new Item("dense-alloy", Color.valueOf("b2c6d2")){{
@ -47,7 +47,7 @@ public class Items implements ContentList{
explosiveness = 0.1f;
hardness = 4;
radioactivity = 0.5f;
cost = 1.2f;
cost = 1.4f;
}};
stone = new Item("stone", Color.valueOf("777777")){{
@ -63,7 +63,7 @@ public class Items implements ContentList{
type = ItemType.material;
flammability = 0.1f;
explosiveness = 0.1f;
cost = 1.5f;
cost = 1.6f;
}};
phasematter = new Item("phase-matter", Color.valueOf("f4ba6e")){{

View File

@ -23,7 +23,6 @@ public class Recipes implements ContentList{
new Recipe(defense, DefenseBlocks.thoriumWall, new ItemStack(Items.thorium, 12));
new Recipe(defense, DefenseBlocks.thoriumWallLarge, new ItemStack(Items.thorium, 12 * 4));
//TODO will be added once sprites are ready
new Recipe(defense, DefenseBlocks.phaseWall, new ItemStack(Items.phasematter, 12));
new Recipe(defense, DefenseBlocks.phaseWallLarge, new ItemStack(Items.phasematter, 12 * 4));
@ -125,14 +124,14 @@ public class Recipes implements ContentList{
//UNITS
//bodies
new Recipe(units, UpgradeBlocks.dartFactory, new ItemStack(Items.lead, 150), new ItemStack(Items.silicon, 200), new ItemStack(Items.titanium, 240)).setDesktop(); //dart is desktop only, because it's the starter mobile ship
new Recipe(units, UpgradeBlocks.javelinFactory, new ItemStack(Items.lead, 200), new ItemStack(Items.silicon, 250), new ItemStack(Items.titanium, 300), new ItemStack(Items.plastanium, 200));
new Recipe(units, UpgradeBlocks.tridentFactory, new ItemStack(Items.lead, 200), new ItemStack(Items.silicon, 250), new ItemStack(Items.titanium, 300), new ItemStack(Items.plastanium, 200));
new Recipe(units, UpgradeBlocks.glaiveFactory, new ItemStack(Items.lead, 200), new ItemStack(Items.silicon, 250), new ItemStack(Items.titanium, 300), new ItemStack(Items.plastanium, 200));
new Recipe(units, UpgradeBlocks.dartFactory, new ItemStack(Items.lead, 150), new ItemStack(Items.copper, 150), new ItemStack(Items.silicon, 200), new ItemStack(Items.titanium, 240)).setDesktop(); //dart is desktop only, because it's the starter mobile ship
new Recipe(units, UpgradeBlocks.tridentFactory, new ItemStack(Items.lead, 250), new ItemStack(Items.copper, 250), new ItemStack(Items.silicon, 250), new ItemStack(Items.titanium, 300), new ItemStack(Items.plastanium, 200));
new Recipe(units, UpgradeBlocks.javelinFactory, new ItemStack(Items.lead, 350), new ItemStack(Items.copper, 400), new ItemStack(Items.silicon, 450), new ItemStack(Items.titanium, 500), new ItemStack(Items.plastanium, 400), new ItemStack(Items.phasematter, 200));
new Recipe(units, UpgradeBlocks.glaiveFactory, new ItemStack(Items.lead, 450), new ItemStack(Items.copper, 500), new ItemStack(Items.silicon, 650), new ItemStack(Items.titanium, 700), new ItemStack(Items.plastanium, 600), new ItemStack(Items.surgealloy, 200));
new Recipe(units, UpgradeBlocks.deltaFactory, new ItemStack(Items.densealloy, 160), new ItemStack(Items.silicon, 220), new ItemStack(Items.titanium, 250)).setDesktop();
new Recipe(units, UpgradeBlocks.omegaFactory, new ItemStack(Items.densealloy, 160), new ItemStack(Items.silicon, 220), new ItemStack(Items.titanium, 250)).setDesktop();
new Recipe(units, UpgradeBlocks.tauFactory, new ItemStack(Items.densealloy, 160), new ItemStack(Items.silicon, 220), new ItemStack(Items.titanium, 250)).setDesktop();
new Recipe(units, UpgradeBlocks.tauFactory, new ItemStack(Items.lead, 250), new ItemStack(Items.densealloy, 250), new ItemStack(Items.copper, 250), new ItemStack(Items.silicon, 250));
new Recipe(units, UpgradeBlocks.deltaFactory, new ItemStack(Items.lead, 350), new ItemStack(Items.densealloy, 350), new ItemStack(Items.copper, 400), new ItemStack(Items.silicon, 450), new ItemStack(Items.thorium, 300));
new Recipe(units, UpgradeBlocks.omegaFactory, new ItemStack(Items.lead, 450), new ItemStack(Items.densealloy, 550), new ItemStack(Items.copper, 500), new ItemStack(Items.silicon, 650), new ItemStack(Items.thorium, 600), new ItemStack(Items.surgealloy, 240));
//new Recipe(units, UpgradeBlocks.deltaFactory, new ItemStack(Items.copper, 30), new ItemStack(Items.lead, 50), new ItemStack(Items.silicon, 30));

View File

@ -8,7 +8,6 @@ import io.anuke.mindustry.game.EventType.GameOverEvent;
import io.anuke.mindustry.game.EventType.PlayEvent;
import io.anuke.mindustry.game.EventType.ResetEvent;
import io.anuke.mindustry.game.EventType.WaveEvent;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.game.Teams;
import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.type.Item;
@ -90,18 +89,9 @@ public class Logic extends Module{
Events.fire(WaveEvent.class);
}
//for gameOver to trigger, there must not be no cores remaining at all; obviously this never triggers in PvP
//this never triggers in PvP; only for checking sector game-overs
private void checkGameOver(){
boolean gameOver = true;
for(Team team : Team.all){
if(state.teams.get(team).cores.size > 0){
gameOver = false;
break;
}
}
if(gameOver && !state.gameOver){
if(state.teams.get(defaultTeam).cores.size == 0 && !state.gameOver){
state.gameOver = true;
Events.fire(GameOverEvent.class);
}
@ -123,7 +113,7 @@ public class Logic extends Module{
Timers.update();
}
if(!world.isInvalidMap()){
if(!Net.client() && !world.isInvalidMap()){
checkGameOver();
}

View File

@ -45,6 +45,7 @@ public class ServerControl extends Module{
private ShuffleMode mode;
private int gameOvers;
private boolean inExtraRound;
private Team winnerTeam;
public ServerControl(String[] args){
Settings.defaultList(
@ -106,7 +107,9 @@ public class ServerControl extends Module{
while(map == previous) map = maps.random();
}
Call.onInfoMessage("[SCARLET]Game over![]\nNext selected map:[accent] "+map.name+"[]"
Call.onInfoMessage((state.mode.isPvp && winnerTeam != null
? "[YELLOW]The " + winnerTeam.name() + " team is victorious![]" : "[SCARLET]Game over![]")
+ "\nNext selected map:[accent] "+map.name+"[]"
+ (map.meta.author() != null ? " by[accent] " + map.meta.author() + "[]" : "") + "."+
"\nNew game begins in " + roundExtraTime + " seconds.");
@ -901,6 +904,25 @@ public class ServerControl extends Module{
}
}
private void checkPvPGameOver(){
Team alive = null;
for(Team team : Team.all){
if(state.teams.get(team).cores.size > 0){
if(alive != null){
return;
}
alive = team;
}
}
if(alive != null && !state.gameOver){
state.gameOver = true;
winnerTeam = alive;
Events.fire(GameOverEvent.class);
}
}
@Override
public void update(){