Major turret and bullet refactoring // New effects

This commit is contained in:
Anuken
2018-04-02 21:43:06 -04:00
parent 20b95fa063
commit 54d0cae450
41 changed files with 606 additions and 1100 deletions

View File

@@ -1,4 +1,10 @@
package io.anuke.mindustry.content;
import io.anuke.mindustry.content.bullets.TurretBullets;
import io.anuke.mindustry.resource.AmmoType;
public class AmmoTypes {
public static final AmmoType
basicIron = new AmmoType(Items.iron, TurretBullets.basicIron, 5, 0.9f);
}

View File

@@ -9,11 +9,12 @@ import io.anuke.ucore.util.Mathf;
public class UpgradeRecipes {
private static final ObjectMap<Upgrade, ItemStack[]> recipes = Mathf.map(
Weapons.triblaster, list(stack(Items.iron, 60), stack(Items.steel, 80)),
Weapons.clustergun, list(stack(Items.iron, 300), stack(Items.steel, 80)),
Weapons.vulcan, list(stack(Items.iron, 100), stack(Items.steel, 150), stack(Items.titanium, 80)),
Weapons.beam, list(stack(Items.steel, 260), stack(Items.titanium, 160), stack(Items.densealloy, 120)),
Weapons.shockgun, list(stack(Items.steel, 240), stack(Items.titanium, 160), stack(Items.densealloy, 160))
/*
Weapons.triblaster, list(stack(Items.iron, 60), stack(Items.steel, 80)),
Weapons.clustergun, list(stack(Items.iron, 300), stack(Items.steel, 80)),
Weapons.vulcan, list(stack(Items.iron, 100), stack(Items.steel, 150), stack(Items.titanium, 80)),
Weapons.beam, list(stack(Items.steel, 260), stack(Items.titanium, 160), stack(Items.densealloy, 120)),
Weapons.shockgun, list(stack(Items.steel, 240), stack(Items.titanium, 160), stack(Items.densealloy, 160))*/
);
private static final ItemStack[] empty = {};

View File

@@ -1,60 +1,16 @@
package io.anuke.mindustry.content;
import io.anuke.mindustry.entities.bullets.BulletType;
import io.anuke.mindustry.content.bullets.TurretBullets;
import io.anuke.mindustry.graphics.fx.BulletFx;
import io.anuke.mindustry.resource.Weapon;
public class Weapons {
public static final Weapon
blaster = new Weapon("blaster", 12, BulletType.shot) {
blaster = new Weapon("blaster", 12, TurretBullets.basicIron) {
{
effect = BulletFx.laserShoot;
effect = BulletFx.shootSmall;
length = 2f;
}
},
triblaster = new Weapon("triblaster", 16, BulletType.spread) {
{
shots = 3;
effect = BulletFx.spreadShoot;
roundrobin = true;
}
},
clustergun = new Weapon("clustergun", 26f, BulletType.cluster) {
{
effect = BulletFx.clusterShoot;
inaccuracy = 17f;
roundrobin = true;
shots = 2;
spacing = 0;
}
},
beam = new Weapon("beam", 30f, BulletType.beamlaser) {
{
effect = BulletFx.beamShoot;
inaccuracy = 0;
roundrobin = true;
shake = 2f;
}
},
vulcan = new Weapon("vulcan", 5, BulletType.vulcan) {
{
effect = BulletFx.vulcanShoot;
inaccuracy = 5;
roundrobin = true;
shake = 1f;
inaccuracy = 4f;
}
},
shockgun = new Weapon("shockgun", 36, BulletType.shockshell) {
{
shootsound = "bigshot";
effect = BulletFx.shockShoot;
shake = 2f;
roundrobin = true;
shots = 7;
inaccuracy = 15f;
length = 3.5f;
}
};
}

View File

@@ -1,235 +1,68 @@
package io.anuke.mindustry.content.blocks;
import com.badlogic.gdx.graphics.Color;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.content.Liquids;
import io.anuke.mindustry.entities.bullets.BulletType;
import io.anuke.mindustry.entities.effect.TeslaOrb;
import io.anuke.mindustry.content.AmmoTypes;
import io.anuke.mindustry.graphics.fx.BulletFx;
import io.anuke.mindustry.resource.AmmoType;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.types.defense.LaserTurret;
import io.anuke.mindustry.world.blocks.types.defense.LiquidTurret;
import io.anuke.mindustry.world.blocks.types.defense.PowerTurret;
import io.anuke.mindustry.world.blocks.types.defense.Turret;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf;
import io.anuke.mindustry.world.blocks.types.defense.turrets.DoubleTurret;
import io.anuke.mindustry.world.blocks.types.defense.turrets.LiquidTurret;
import io.anuke.mindustry.world.blocks.types.defense.turrets.PowerTurret;
public class WeaponBlocks{
public static Block
doubleturret = new Turret("doubleturret"){
{
range = 44;
reload = 13f;
bullet = BulletType.stone;
ammo = Items.stone;
health = 45;
shots = 2;
}
@Override
protected void shoot(Tile tile){
TurretEntity entity = tile.entity();
for(int i : Mathf.signs){
tr.trns(entity.rotation, 4, -2 * i);
bullet(tile, entity.rotation);
}
}
},
doubleturret = new DoubleTurret("doubleturret"){{
ammoTypes = new AmmoType[]{AmmoTypes.basicIron};
reload = 40f;
shootEffect = BulletFx.shootSmall;
}},
gatlingturret = new Turret("gatlingturret"){
{
range = 65;
reload = 7f;
bullet = BulletType.iron;
ammo = Items.iron;
health = 65;
}
},
flameturret = new Turret("flameturret"){
{
range = 45f;
reload = 5f;
bullet = BulletType.flame;
ammo = Items.coal;
health = 90;
inaccuracy = 4f;
}
},
railgunturret = new Turret("railgunturret"){
{
shootsound = "railgun";
range = 120;
reload = 50f;
bullet = BulletType.sniper;
ammo = Items.steel;
health = 70;
shootEffect = BulletFx.railshot;
}
},
flakturret = new Turret("flakturret"){
{
shootsound = "bigshot";
rotatespeed = 0.2f;
range = 120;
reload = 55f;
bullet = BulletType.flak;
shots = 3;
inaccuracy = 9f;
ammo = Items.coal;
ammoMultiplier = 5;
health = 110;
shootEffect = BulletFx.mortarshot;
shootShake = 2f;
size = 2;
}
},
laserturret = new LaserTurret("laserturret"){
{
shootsound = "laser";
beamColor = Color.SKY;
range = 60;
reload = 4f;
damage = 10;
health = 110;
powerUsed = 0.2f;
}
},
teslaturret = new PowerTurret("teslaturret"){
{
shootsound = "tesla";
range = 70;
reload = 15f;
bullet = BulletType.shell;
health = 140;
}
@Override
public void shoot(Tile tile){
TurretEntity entity = tile.entity();
float len = 4f;
new TeslaOrb(tile.getTeam(), tile.drawx() + Angles.trnsx(entity.rotation, len), tile.drawy() + Angles.trnsy(entity.rotation, len), range, 9).add();
}
},
magmaturret = new LiquidTurret("magmaturret") {
{
shootsound = "flame2";
inaccuracy = 7f;
range = 90f;
reload = 7f;
bullet = BulletType.plasmaflame;
ammoLiquid = Liquids.lava;
liquidPerShot = 3f;
health = 180*3;
size = 2;
}
},
plasmaturret = new Turret("plasmaturret"){
{
shootsound = "flame2";
inaccuracy = 7f;
range = 60f;
reload = 3f;
bullet = BulletType.plasmaflame;
ammo = Items.coal;
health = 180;
ammoMultiplier = 40;
}
},
chainturret = new Turret("chainturret"){
{
shootsound = "bigshot";
inaccuracy = 8f;
range = 80f;
reload = 8f;
bullet = BulletType.chain;
ammo = Items.thorium;
health = 430;
size = 2;
shootCone = 9f;
ammoMultiplier = 8;
shots = 2;
shootEffect = BulletFx.chainshot;
}
@Override
protected void shoot(Tile tile){
TurretEntity entity = tile.entity();
float len = 8;
float space = 3.5f;
for(int i = -1; i < 1; i ++){
tr.trns(entity.rotation, len, Mathf.sign(i) * space);
bullet(tile, entity.rotation);
Effects.effect(shootEffect, tile.drawx() + tr.x,
tile.drawy() + tr.y, entity.rotation);
}
Effects.shake(1f, 1f, tile.worldx(), tile.worldy());
}
},
titanturret = new Turret("titancannon"){
{
shootsound = "blast";
range = 120f;
reload = 23f;
bullet = BulletType.titanshell;
ammo = Items.thorium;
health = 800;
ammoMultiplier = 4;
size = 3;
rotatespeed = 0.07f;
shootCone = 9f;
shootEffect = BulletFx.titanshot;
shootShake = 3f;
}
},
fornaxcannon = new PowerTurret("fornaxcannon") {
{
shootsound = "blast";
range = 120f;
reload = 23f;
bullet = BulletType.titanshell;
ammo = Items.thorium;
health = 800;
ammoMultiplier = 4;
size = 3;
rotatespeed = 0.07f;
shootCone = 9f;
shootEffect = BulletFx.titanshot;
shootShake = 3f;
}
},
missileturret = new PowerTurret("missileturret") {
{
shootsound = "blast";
range = 120f;
reload = 23f;
bullet = BulletType.titanshell;
ammo = Items.thorium;
health = 800;
ammoMultiplier = 4;
size = 2;
rotatespeed = 0.07f;
shootCone = 9f;
shootEffect = BulletFx.titanshot;
shootShake = 3f;
}
};
}

View File

@@ -0,0 +1,19 @@
package io.anuke.mindustry.content.bullets;
import com.badlogic.gdx.graphics.Color;
import io.anuke.mindustry.entities.Bullet;
import io.anuke.mindustry.entities.BulletType;
import io.anuke.ucore.graphics.Draw;
public class TurretBullets {
public static final BulletType
basicIron = new BulletType(2f, 0) {
@Override
public void draw(Bullet b) {
Draw.color(Color.valueOf("f6e096"));
Draw.rect("bullet", b.x, b.y, b.angle() - 90);
Draw.color();
}
};
}

View File

@@ -0,0 +1,4 @@
package io.anuke.mindustry.content.bullets;
public class UnitBullets {
}

View File

@@ -0,0 +1,15 @@
package io.anuke.mindustry.content.bullets;
import io.anuke.mindustry.entities.Bullet;
import io.anuke.mindustry.entities.BulletType;
public class WeaponBullets {
public static final BulletType
none = new BulletType(0f, 0) {
@Override
public void draw(Bullet b) {
}
};
}