Pad ammo autofill / Per-mission waves / Better core resource selection
This commit is contained in:
@@ -49,9 +49,7 @@ public class Logic extends Module{
|
|||||||
state.set(State.playing);
|
state.set(State.playing);
|
||||||
state.wavetime = wavespace * state.difficulty.timeScaling * 2;
|
state.wavetime = wavespace * state.difficulty.timeScaling * 2;
|
||||||
|
|
||||||
//fill inventory with items for debugging
|
for(TeamData team : state.teams.getTeams(true)){
|
||||||
|
|
||||||
for(TeamData team : state.teams.getTeams()){
|
|
||||||
for(Tile tile : team.cores){
|
for(Tile tile : team.cores){
|
||||||
if(debug){
|
if(debug){
|
||||||
for(Item item : Item.all()){
|
for(Item item : Item.all()){
|
||||||
@@ -66,6 +64,13 @@ public class Logic extends Module{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(TeamData team : state.teams.getTeams(false)){
|
||||||
|
for(Tile tile : team.cores){
|
||||||
|
tile.entity.items.add(Items.tungsten, 2000);
|
||||||
|
tile.entity.items.add(Items.blastCompound, 2000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Events.fire(PlayEvent.class);
|
Events.fire(PlayEvent.class);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,6 +110,12 @@ public class UnitInventory implements Saveable{
|
|||||||
ammos.add(entry);
|
ammos.add(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void fillAmmo(AmmoType type){
|
||||||
|
totalAmmo = ammoCapacity();
|
||||||
|
ammos.clear();
|
||||||
|
ammos.add(new AmmoEntry(type, ammoCapacity()));
|
||||||
|
}
|
||||||
|
|
||||||
public int capacity(){
|
public int capacity(){
|
||||||
return unit.getItemCapacity();
|
return unit.getItemCapacity();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class Sector{
|
|||||||
/**Missions of this sector-- what needs to be accomplished to unlock it.*/
|
/**Missions of this sector-- what needs to be accomplished to unlock it.*/
|
||||||
public transient Array<Mission> missions = new Array<>();
|
public transient Array<Mission> missions = new Array<>();
|
||||||
/**Enemies spawned at this sector.*/
|
/**Enemies spawned at this sector.*/
|
||||||
public transient Array<SpawnGroup> spawns = new Array<>();
|
public transient Array<SpawnGroup> spawns;
|
||||||
/**Ores that appear in this sector.*/
|
/**Ores that appear in this sector.*/
|
||||||
public transient Array<Item> ores = new Array<>();
|
public transient Array<Item> ores = new Array<>();
|
||||||
/**Difficulty of the sector, measured by calculating distance from origin and applying scaling.*/
|
/**Difficulty of the sector, measured by calculating distance from origin and applying scaling.*/
|
||||||
|
|||||||
@@ -133,13 +133,16 @@ public class Sectors{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initSector(Sector sector){
|
private void initSector(Sector sector){
|
||||||
|
double waveChance = 0.3;
|
||||||
|
|
||||||
sector.difficulty = (int)(Mathf.dst(sector.x, sector.y));
|
sector.difficulty = (int)(Mathf.dst(sector.x, sector.y));
|
||||||
|
sector.spawns = sector.missions.first().getWaves(sector);
|
||||||
|
|
||||||
if(sector.difficulty == 0){
|
if(sector.difficulty == 0){
|
||||||
sector.missions.add(new WaveMission(10));
|
sector.missions.add(new WaveMission(10));
|
||||||
}else{
|
}else{
|
||||||
sector.missions.add(new BattleMission());
|
sector.missions.add(Mathf.randomSeed(sector.getSeed() + 1) < waveChance ? new WaveMission(Math.min(10 + sector.difficulty*5 + Mathf.randomSeed(sector.getSeed(), 0, 5)*5, 100))
|
||||||
//sector.missions.add(new WaveMission(Math.min(10 + sector.difficulty*5 + Mathf.randomSeed(sector.getSeed(), 0, 5)*5, 100)));
|
: new BattleMission());
|
||||||
}
|
}
|
||||||
|
|
||||||
//add all ores for now since material differences aren't well handled yet
|
//add all ores for now since material differences aren't well handled yet
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ import com.badlogic.gdx.math.GridPoint2;
|
|||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import io.anuke.mindustry.content.blocks.StorageBlocks;
|
import io.anuke.mindustry.content.blocks.StorageBlocks;
|
||||||
import io.anuke.mindustry.game.GameMode;
|
import io.anuke.mindustry.game.GameMode;
|
||||||
|
import io.anuke.mindustry.game.SpawnGroup;
|
||||||
import io.anuke.mindustry.game.Team;
|
import io.anuke.mindustry.game.Team;
|
||||||
|
import io.anuke.mindustry.maps.Sector;
|
||||||
import io.anuke.mindustry.maps.generation.Generation;
|
import io.anuke.mindustry.maps.generation.Generation;
|
||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
|
|
||||||
@@ -14,6 +16,10 @@ public interface Mission{
|
|||||||
GameMode getMode();
|
GameMode getMode();
|
||||||
void display(Table table);
|
void display(Table table);
|
||||||
|
|
||||||
|
default Array<SpawnGroup> getWaves(Sector sector){
|
||||||
|
return new Array<>();
|
||||||
|
}
|
||||||
|
|
||||||
default Array<GridPoint2> getSpawnPoints(Generation gen){
|
default Array<GridPoint2> getSpawnPoints(Generation gen){
|
||||||
return Array.with();
|
return Array.with();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,10 @@ package io.anuke.mindustry.maps.missions;
|
|||||||
import com.badlogic.gdx.math.GridPoint2;
|
import com.badlogic.gdx.math.GridPoint2;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import io.anuke.mindustry.game.GameMode;
|
import io.anuke.mindustry.game.GameMode;
|
||||||
|
import io.anuke.mindustry.game.SpawnGroup;
|
||||||
import io.anuke.mindustry.game.Team;
|
import io.anuke.mindustry.game.Team;
|
||||||
|
import io.anuke.mindustry.game.Waves;
|
||||||
|
import io.anuke.mindustry.maps.Sector;
|
||||||
import io.anuke.mindustry.maps.generation.Generation;
|
import io.anuke.mindustry.maps.generation.Generation;
|
||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
import io.anuke.ucore.util.Bundles;
|
import io.anuke.ucore.util.Bundles;
|
||||||
@@ -17,6 +20,12 @@ public class WaveMission implements Mission{
|
|||||||
this.target = target;
|
this.target = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Array<SpawnGroup> getWaves(Sector sector){
|
||||||
|
Array<SpawnGroup> spawns = new Array<>();
|
||||||
|
return Waves.getSpawns();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generate(Generation gen){
|
public void generate(Generation gen){
|
||||||
int coreX = gen.width/2, coreY = gen.height/2;
|
int coreX = gen.width/2, coreY = gen.height/2;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import io.anuke.mindustry.gen.Call;
|
|||||||
import io.anuke.mindustry.graphics.Palette;
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
import io.anuke.mindustry.graphics.Shaders;
|
import io.anuke.mindustry.graphics.Shaders;
|
||||||
import io.anuke.mindustry.net.Net;
|
import io.anuke.mindustry.net.Net;
|
||||||
|
import io.anuke.mindustry.type.AmmoType;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
import io.anuke.mindustry.type.ItemStack;
|
import io.anuke.mindustry.type.ItemStack;
|
||||||
import io.anuke.mindustry.world.BarType;
|
import io.anuke.mindustry.world.BarType;
|
||||||
@@ -70,6 +71,12 @@ public class UnitPad extends Block{
|
|||||||
unit.set(tile.drawx(), tile.drawy());
|
unit.set(tile.drawx(), tile.drawy());
|
||||||
unit.add();
|
unit.add();
|
||||||
unit.getVelocity().y = factory.launchVelocity;
|
unit.getVelocity().y = factory.launchVelocity;
|
||||||
|
|
||||||
|
//fill inventory with 1st ammo
|
||||||
|
if(tile.getTeam() == Team.red){
|
||||||
|
AmmoType type = unit.getWeapon().getAmmoType(unit.getWeapon().getAcceptedItems().iterator().next());
|
||||||
|
unit.inventory.fillAmmo(type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user