Pad ammo autofill / Per-mission waves / Better core resource selection

This commit is contained in:
Anuken
2018-08-05 23:19:11 -04:00
parent 6904d4693f
commit 468e092422
7 changed files with 42 additions and 6 deletions

View File

@@ -49,9 +49,7 @@ public class Logic extends Module{
state.set(State.playing);
state.wavetime = wavespace * state.difficulty.timeScaling * 2;
//fill inventory with items for debugging
for(TeamData team : state.teams.getTeams()){
for(TeamData team : state.teams.getTeams(true)){
for(Tile tile : team.cores){
if(debug){
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);
}

View File

@@ -110,6 +110,12 @@ public class UnitInventory implements Saveable{
ammos.add(entry);
}
public void fillAmmo(AmmoType type){
totalAmmo = ammoCapacity();
ammos.clear();
ammos.add(new AmmoEntry(type, ammoCapacity()));
}
public int capacity(){
return unit.getItemCapacity();
}

View File

@@ -26,7 +26,7 @@ public class Sector{
/**Missions of this sector-- what needs to be accomplished to unlock it.*/
public transient Array<Mission> missions = new Array<>();
/**Enemies spawned at this sector.*/
public transient Array<SpawnGroup> spawns = new Array<>();
public transient Array<SpawnGroup> spawns;
/**Ores that appear in this sector.*/
public transient Array<Item> ores = new Array<>();
/**Difficulty of the sector, measured by calculating distance from origin and applying scaling.*/

View File

@@ -133,13 +133,16 @@ public class Sectors{
}
private void initSector(Sector sector){
double waveChance = 0.3;
sector.difficulty = (int)(Mathf.dst(sector.x, sector.y));
sector.spawns = sector.missions.first().getWaves(sector);
if(sector.difficulty == 0){
sector.missions.add(new WaveMission(10));
}else{
sector.missions.add(new BattleMission());
//sector.missions.add(new WaveMission(Math.min(10 + sector.difficulty*5 + Mathf.randomSeed(sector.getSeed(), 0, 5)*5, 100)));
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))
: new BattleMission());
}
//add all ores for now since material differences aren't well handled yet

View File

@@ -4,7 +4,9 @@ import com.badlogic.gdx.math.GridPoint2;
import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.content.blocks.StorageBlocks;
import io.anuke.mindustry.game.GameMode;
import io.anuke.mindustry.game.SpawnGroup;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.maps.Sector;
import io.anuke.mindustry.maps.generation.Generation;
import io.anuke.ucore.scene.ui.layout.Table;
@@ -14,6 +16,10 @@ public interface Mission{
GameMode getMode();
void display(Table table);
default Array<SpawnGroup> getWaves(Sector sector){
return new Array<>();
}
default Array<GridPoint2> getSpawnPoints(Generation gen){
return Array.with();
}

View File

@@ -3,7 +3,10 @@ package io.anuke.mindustry.maps.missions;
import com.badlogic.gdx.math.GridPoint2;
import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.game.GameMode;
import io.anuke.mindustry.game.SpawnGroup;
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.ucore.scene.ui.layout.Table;
import io.anuke.ucore.util.Bundles;
@@ -17,6 +20,12 @@ public class WaveMission implements Mission{
this.target = target;
}
@Override
public Array<SpawnGroup> getWaves(Sector sector){
Array<SpawnGroup> spawns = new Array<>();
return Waves.getSpawns();
}
@Override
public void generate(Generation gen){
int coreX = gen.width/2, coreY = gen.height/2;

View File

@@ -14,6 +14,7 @@ import io.anuke.mindustry.gen.Call;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.graphics.Shaders;
import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.type.AmmoType;
import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.ItemStack;
import io.anuke.mindustry.world.BarType;
@@ -70,6 +71,12 @@ public class UnitPad extends Block{
unit.set(tile.drawx(), tile.drawy());
unit.add();
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);
}
}
}