Implemented new spawnlist

This commit is contained in:
Anuken 2018-06-27 13:54:50 -04:00
parent 5cefecced8
commit 6364b9e06b
17 changed files with 694 additions and 440 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 315 B

After

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 126 KiB

View File

@ -30,6 +30,8 @@ public class WaveSpawner {
public WaveSpawner(){
Events.on(WorldLoadEvent.class, this::reset);
WaveCreator.testWaves(0, 200);
}
public void write(DataOutput output) throws IOException{
@ -77,14 +79,16 @@ public class WaveSpawner {
}
}
int addGround = groundGroups - groundSpawns.size, addFly = flyGroups - flySpawns.size;
//add extra groups if the total exceeds it
for (int i = 0; i < groundGroups - groundSpawns.size; i++) {
for (int i = 0; i < addGround; i++) {
GroundSpawn spawn = new GroundSpawn();
findLocation(spawn);
groundSpawns.add(spawn);
}
for (int i = 0; i < flyGroups - flySpawns.size; i++) {
for (int i = 0; i < addFly; i++) {
FlyerSpawn spawn = new FlyerSpawn();
findLocation(spawn);
flySpawns.add(spawn);

View File

@ -10,7 +10,7 @@ import io.anuke.mindustry.type.ContentList;
public class AmmoTypes implements ContentList {
public static AmmoType bulletTungsten, bulletLead, bulletCarbide, bulletThorium, bulletSilicon, bulletThermite,
shotgunTungsten, bombExplosive, bombIncendiary,
shotgunTungsten, bombExplosive, bombIncendiary, bombOil, shellCarbide, flamerThermite,
flakLead, flakExplosive, flakPlastic, flakSurge, missileExplosive, missileIncindiary, missileSurge,
artilleryCarbide, artilleryThorium, artilleryPlastic, artilleryHoming, artilleryIncindiary,
basicFlame, lancerLaser, lightning, spectreLaser, meltdownLaser, fuseShotgun, oil, water, lava, cryofluid;
@ -18,6 +18,38 @@ public class AmmoTypes implements ContentList {
@Override
public void load() {
//weapon specific
shotgunTungsten = new AmmoType(Items.tungsten, WeaponBullets.tungstenShotgun, 2) {{
shootEffect = ShootFx.shootBig;
smokeEffect = ShootFx.shootBigSmoke;
recoil = 1f;
}};
shellCarbide = new AmmoType(Items.carbide, WeaponBullets.shellCarbide, 2) {{
shootEffect = ShootFx.shootBig;
smokeEffect = ShootFx.shootBigSmoke;
}};
bombExplosive = new AmmoType(Items.blastCompound, WeaponBullets.bombExplosive, 3) {{
shootEffect = Fx.none;
smokeEffect = Fx.none;
}};
bombIncendiary = new AmmoType(Items.thermite, WeaponBullets.bombIncendiary, 3) {{
shootEffect = Fx.none;
smokeEffect = Fx.none;
}};
bombOil = new AmmoType(Items.coal, WeaponBullets.bombOil, 3) {{
shootEffect = Fx.none;
smokeEffect = Fx.none;
}};
flamerThermite = new AmmoType(Items.thermite, TurretBullets.basicFlame, 3) {{
shootEffect = ShootFx.shootSmallFlame;
}};
//bullets
bulletLead = new AmmoType(Items.lead, StandardBullets.lead, 5) {{
@ -56,24 +88,6 @@ public class AmmoTypes implements ContentList {
inaccuracy = 3f;
}};
//shotgun (delta mech)
shotgunTungsten = new AmmoType(Items.tungsten, WeaponBullets.tungstenShotgun, 2) {{
shootEffect = ShootFx.shootBig;
smokeEffect = ShootFx.shootBigSmoke;
recoil = 1f;
}};
bombExplosive = new AmmoType(Items.blastCompound, WeaponBullets.bombExplosive, 3) {{
shootEffect = Fx.none;
smokeEffect = Fx.none;
}};
bombIncendiary = new AmmoType(Items.thermite, WeaponBullets.bombIncendiary, 3) {{
shootEffect = Fx.none;
smokeEffect = Fx.none;
}};
//flak
flakLead = new AmmoType(Items.lead, FlakBullets.lead, 5) {{

View File

@ -71,6 +71,9 @@ public class Recipes implements ContentList{
new Recipe(crafting, CraftingBlocks.blastMixer, new ItemStack(Items.tungsten, 60), new ItemStack(Items.lead, 60), new ItemStack(Items.carbide, 40));
new Recipe(crafting, CraftingBlocks.cryofluidmixer, new ItemStack(Items.lead, 130), new ItemStack(Items.silicon, 80), new ItemStack(Items.titanium, 90));
new Recipe(crafting, CraftingBlocks.melter, new ItemStack(Items.tungsten, 60), new ItemStack(Items.lead, 70), new ItemStack(Items.carbide, 90));
new Recipe(crafting, CraftingBlocks.incinerator, new ItemStack(Items.carbide, 10), new ItemStack(Items.lead, 30));
//processing
new Recipe(crafting, CraftingBlocks.biomatterCompressor, new ItemStack(Items.lead, 70), new ItemStack(Items.silicon, 60));
new Recipe(crafting, CraftingBlocks.separator, new ItemStack(Items.tungsten, 60), new ItemStack(Items.carbide, 50));
@ -113,7 +116,7 @@ public class Recipes implements ContentList{
//new Recipe(units, UpgradeBlocks.deltaFactory, new ItemStack(Items.tungsten, 30), new ItemStack(Items.lead, 50), new ItemStack(Items.silicon, 30));
//actual unit related stuff
new Recipe(units, UnitBlocks.droneFactory, new ItemStack(Items.tungsten, 30), new ItemStack(Items.lead, 50), new ItemStack(Items.silicon, 80));
new Recipe(units, UnitBlocks.droneFactory, new ItemStack(Items.tungsten, 50), new ItemStack(Items.lead, 90), new ItemStack(Items.silicon, 130));
new Recipe(units, UnitBlocks.repairPoint, new ItemStack(Items.lead, 30), new ItemStack(Items.tungsten, 30), new ItemStack(Items.silicon, 30));
new Recipe(units, UnitBlocks.resupplyPoint, new ItemStack(Items.lead, 30), new ItemStack(Items.tungsten, 30), new ItemStack(Items.silicon, 30));

View File

@ -18,6 +18,7 @@ public class UnitTypes implements ContentList {
maxVelocity = 0.8f;
ammoCapacity = 0;
range = 50f;
health = 45;
}};
scout = new UnitType("scout", Scout.class, Scout::new){{
@ -25,7 +26,8 @@ public class UnitTypes implements ContentList {
speed = 0.2f;
drag = 0.4f;
range = 40f;
weapon = Weapons.blaster;
weapon = Weapons.chainBlaster;
health = 70;
}};
titan = new UnitType("titan", Titan.class, Titan::new){{
@ -33,7 +35,8 @@ public class UnitTypes implements ContentList {
speed = 0.18f;
drag = 0.4f;
range = 10f;
weapon = Weapons.shockgun;
weapon = Weapons.chainBlaster;
health = 260;
}};
vtol = new UnitType("vtol", Vtol.class, Vtol::new){{
@ -45,7 +48,7 @@ public class UnitTypes implements ContentList {
}};
monsoon = new UnitType("monsoon", Monsoon.class, Monsoon::new){{
health = 300;
health = 230;
speed = 0.2f;
maxVelocity = 1.5f;
drag = 0.01f;

View File

@ -9,7 +9,7 @@ import io.anuke.mindustry.type.Upgrade;
import io.anuke.mindustry.type.Weapon;
public class Weapons implements ContentList {
public static Weapon blaster, shockgun, sapper, swarmer, bomber;
public static Weapon blaster, chainBlaster, shockgun, sapper, swarmer, bomber, flakgun, flamethrower;
@Override
public void load() {
@ -22,6 +22,14 @@ public class Weapons implements ContentList {
setAmmo(AmmoTypes.bulletLead);
}};
chainBlaster = new Weapon("chain-blaster") {{
length = 1.5f;
reload = 20f;
roundrobin = true;
ejectEffect = ShootFx.shellEjectSmall;
setAmmo(AmmoTypes.bulletLead, AmmoTypes.bulletCarbide, AmmoTypes.bulletTungsten, AmmoTypes.bulletSilicon, AmmoTypes.bulletThorium);
}};
shockgun = new Weapon("shockgun") {{
length = 1f;
reload = 50f;
@ -34,6 +42,27 @@ public class Weapons implements ContentList {
setAmmo(AmmoTypes.shotgunTungsten);
}};
flakgun = new Weapon("flakgun") {{
length = 1f;
reload = 70f;
roundrobin = true;
shots = 1;
inaccuracy = 3f;
recoil = 3f;
velocityRnd = 0.1f;
ejectEffect = ShootFx.shellEjectMedium;
setAmmo(AmmoTypes.shellCarbide);
}};
flamethrower = new Weapon("flamethrower") {{
length = 1f;
reload = 14f;
roundrobin = true;
recoil = 1f;
ejectEffect = Fx.none;
setAmmo(AmmoTypes.flamerThermite);
}};
sapper = new Weapon("sapper") {{
length = 1.5f;
reload = 12f;
@ -58,7 +87,7 @@ public class Weapons implements ContentList {
ejectEffect = Fx.none;
velocityRnd = 1f;
inaccuracy = 40f;
setAmmo(AmmoTypes.bombExplosive, AmmoTypes.bombIncendiary);
setAmmo(AmmoTypes.bombExplosive, AmmoTypes.bombIncendiary, AmmoTypes.bombOil);
}};
}

View File

@ -1,11 +1,15 @@
package io.anuke.mindustry.content.bullets;
import com.badlogic.gdx.graphics.Color;
import io.anuke.mindustry.content.Liquids;
import io.anuke.mindustry.content.fx.BlockFx;
import io.anuke.mindustry.content.fx.BulletFx;
import io.anuke.mindustry.entities.bullet.BasicBulletType;
import io.anuke.mindustry.entities.bullet.BombBulletType;
import io.anuke.mindustry.entities.bullet.Bullet;
import io.anuke.mindustry.entities.bullet.BulletType;
import io.anuke.mindustry.entities.effect.Fire;
import io.anuke.mindustry.entities.effect.Puddle;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.util.Mathf;
@ -13,7 +17,7 @@ import io.anuke.ucore.util.Mathf;
import static io.anuke.mindustry.Vars.world;
public class WeaponBullets extends BulletList {
public static BulletType tungstenShotgun, bombExplosive, bombIncendiary;
public static BulletType tungstenShotgun, bombExplosive, bombIncendiary, bombOil, shellCarbide;
@Override
public void load() {
@ -58,5 +62,38 @@ public class WeaponBullets extends BulletList {
}
}
};
bombOil = new BombBulletType(3f, 3f, "shell"){
{
bulletWidth = 8f;
bulletHeight = 12f;
hiteffect = BlockFx.pulverize;
backColor = new Color(0x4f4f4fff);
frontColor = Color.GRAY;
}
@Override
public void hit(Bullet b, float x, float y) {
super.hit(b, x, y);
for (int i = 0; i < 3; i++) {
Tile tile = world.tileWorld(x + Mathf.range(8f), y + Mathf.range(8f));
Puddle.deposit(tile, Liquids.oil, 5f);
}
}
};
shellCarbide = new BasicBulletType(3.4f, 20, "bullet") {
{
bulletWidth = 10f;
bulletHeight = 12f;
bulletShrink = 0.4f;
lifetime = 40f;
drag = 0.025f;
fragBullets = 5;
hiteffect = BulletFx.flakExplosion;
fragBullet = tungstenShotgun;
}
};
}
}

View File

@ -179,6 +179,8 @@ public class Puddle extends BaseEntity implements SaveTrait, Poolable, DrawTrait
//effects-only code
if(amount >= maxLiquid/2f && updateTime <= 0f){
Units.getNearby(rect.setSize(Mathf.clamp(amount/(maxLiquid/1.5f))*10f).setCenter(x, y), unit -> {
if(unit.isFlying()) return;
unit.getHitbox(rect2);
if(!rect.overlaps(rect2)) return;

View File

@ -155,7 +155,7 @@ public abstract class GroundUnit extends BaseUnit {
@Override
public void readSave(DataInput stream) throws IOException{
weapon = Upgrade.getByID(weapon.id);
weapon = Upgrade.getByID(stream.readByte());
super.readSave(stream);
}
@ -229,7 +229,7 @@ public abstract class GroundUnit extends BaseUnit {
state.set(resupply);
}else if(target != null){
if(core != null){
if(dst > inventory.getAmmo().getRange() * 0.7f){
if(dst > inventory.getAmmo().getRange() * 0.5f){
moveToCore();
}

View File

@ -8,8 +8,6 @@ import io.anuke.mindustry.type.ItemStack;
import io.anuke.mindustry.type.StatusEffect;
import io.anuke.mindustry.type.Weapon;
import static io.anuke.mindustry.Vars.state;
/**A spawn group defines spawn information for a specific type of unit, with optional extra information like
* weapon equipped, ammo used, and status effects.
* Each spawn group can have multiple sub-groups spawned in different areas of the map.*/
@ -50,7 +48,7 @@ public class SpawnGroup {
if(wave < begin || wave > end || (wave - begin) % spacing != 0){
return 0;
}
float scaling = this.unitScaling * state.difficulty.enemyScaling;
float scaling = this.unitScaling;
return Math.min(unitAmount-1 + Math.max((int)((wave / spacing) / scaling), 1), max);
}
@ -75,7 +73,7 @@ public class SpawnGroup {
}
if(effect != null){
unit.applyEffect(effect, 1f);
unit.applyEffect(effect, 10000f);
}
if(items != null){

View File

@ -2,7 +2,9 @@ package io.anuke.mindustry.game;
import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.content.StatusEffects;
import io.anuke.mindustry.content.UnitTypes;
import io.anuke.mindustry.content.Weapons;
import io.anuke.mindustry.type.ItemStack;
public class WaveCreator{
@ -10,24 +12,149 @@ public class WaveCreator{
public static Array<SpawnGroup> getSpawns(){
return Array.with(
new SpawnGroup(UnitTypes.scout){{
end = 5;
}},
new SpawnGroup(UnitTypes.titan){{
begin = 6;
}},
new SpawnGroup(UnitTypes.scout){{
begin = 6;
items = new ItemStack(Items.thermite, 100);
end = 8;
unitScaling = 2;
}},
new SpawnGroup(UnitTypes.vtol){{
begin = 4;
end = 6;
}},
new SpawnGroup(UnitTypes.scout){{
begin = 11;
unitScaling = 2;
spacing = 2;
max = 4;
}},
new SpawnGroup(UnitTypes.titan){{
begin = 8;
spacing = 3;
unitScaling = 2;
end = 30;
}},
new SpawnGroup(UnitTypes.scout){{
begin = 10;
unitScaling = 2;
unitAmount = 1;
spacing = 2;
ammoItem = Items.tungsten;
end = 30;
}},
new SpawnGroup(UnitTypes.titan){{
begin = 28;
spacing = 3;
unitScaling = 2;
weapon = Weapons.flamethrower;
end = 40;
}},
new SpawnGroup(UnitTypes.titan){{
begin = 45;
spacing = 3;
unitScaling = 2;
weapon = Weapons.flamethrower;
effect = StatusEffects.overdrive;
}},
new SpawnGroup(UnitTypes.titan){{
begin = 120;
spacing = 2;
unitScaling = 3;
unitAmount = 5;
weapon = Weapons.flakgun;
effect = StatusEffects.overdrive;
}},
new SpawnGroup(UnitTypes.vtol){{
begin = 14;
unitScaling = 2;
spacing = 2;
end = 39;
max = 7;
}},
new SpawnGroup(UnitTypes.scout){{
begin = 82;
spacing = 3;
unitAmount = 4;
groupAmount = 2;
unitScaling = 3;
effect = StatusEffects.overdrive;
ammoItem = Items.silicon;
}},
new SpawnGroup(UnitTypes.scout){{
begin = 41;
spacing = 5;
unitAmount = 1;
unitScaling = 3;
effect = StatusEffects.shielded;
ammoItem = Items.thorium;
max = 10;
}},
new SpawnGroup(UnitTypes.scout){{
begin = 25;
spacing = 3;
unitAmount = 4;
groupAmount = 2;
effect = StatusEffects.overdrive;
items = new ItemStack(Items.blastCompound, 60);
end = 60;
}},
new SpawnGroup(UnitTypes.scout){{
begin = 42;
spacing = 3;
unitAmount = 4;
groupAmount = 2;
effect = StatusEffects.overdrive;
items = new ItemStack(Items.thermite, 100);
end = 130;
}},
new SpawnGroup(UnitTypes.monsoon){{
begin = 16;
begin = 35;
ammoItem = Items.blastCompound;
unitAmount = 2;
unitScaling = 3;
max = 8;
}},
new SpawnGroup(UnitTypes.vtol){{
begin = 50;
unitAmount = 4;
unitScaling = 3;
spacing = 5;
groupAmount = 2;
effect = StatusEffects.overdrive;
max = 8;
}},
new SpawnGroup(UnitTypes.monsoon){{
begin = 53;
ammoItem = Items.thermite;
unitAmount = 2;
unitScaling = 3;
spacing = 4;
max = 8;
end = 74;
}},
new SpawnGroup(UnitTypes.monsoon){{
begin = 53;
ammoItem = Items.coal;
unitAmount = 2;
unitScaling = 3;
spacing = 4;
max = 8;
end = 74;
}}
);
}
@ -38,11 +165,21 @@ public class WaveCreator{
System.out.print(i+": ");
int total = 0;
for(SpawnGroup spawn : spawns){
int a = spawn.getUnitsSpawned(i);
int a = spawn.getUnitsSpawned(i) * spawn.getGroupsSpawned(i);
total += a;
if(a > 0){
System.out.print(a+"x" + spawn.type.name);
if(spawn.weapon != null){
System.out.print(":" + spawn.weapon.name);
}
if(spawn.ammoItem != null){
System.out.print(":" + spawn.ammoItem.name);
}
System.out.print(" ");
}
}
System.out.print(" (" + total + ")");

View File

@ -78,8 +78,14 @@ public class Generators {
image.draw(type.legRegion, true, false);
image.draw(type.region);
image.draw(type.weapon.equipRegion, -(int)type.weaponOffsetX, (int)type.weaponOffsetY, false, false);
image.draw(type.weapon.equipRegion, (int)type.weaponOffsetX, (int)type.weaponOffsetY, true, false);
image.draw(type.weapon.equipRegion,
-(int)type.weaponOffsetX + (image.width() - type.weapon.equipRegion.getRegionWidth())/2,
(int)type.weaponOffsetY - (image.height() - type.weapon.equipRegion.getRegionHeight())/2,
false, false);
image.draw(type.weapon.equipRegion,
(int)type.weaponOffsetX + (image.width() - type.weapon.equipRegion.getRegionWidth())/2,
(int)type.weaponOffsetY - (image.height() - type.weapon.equipRegion.getRegionHeight())/2,
true, false);
}
image.save("unit-icon-" + type.name);