From 1e25ba2d8e38046f0ebed52a8676289ac879da6b Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 28 Aug 2018 12:12:08 -0400 Subject: [PATCH] Implemented ammo types for cyclone --- .../io/anuke/mindustry/content/AmmoTypes.java | 1 + .../content/blocks/TurretBlocks.java | 66 +++++++++++-------- .../content/bullets/ArtilleryBullets.java | 2 + .../content/bullets/FlakBullets.java | 25 ++++++- .../anuke/mindustry/content/fx/BulletFx.java | 26 +++++++- 5 files changed, 88 insertions(+), 32 deletions(-) diff --git a/core/src/io/anuke/mindustry/content/AmmoTypes.java b/core/src/io/anuke/mindustry/content/AmmoTypes.java index 6e652a262b..a0da332ba8 100644 --- a/core/src/io/anuke/mindustry/content/AmmoTypes.java +++ b/core/src/io/anuke/mindustry/content/AmmoTypes.java @@ -131,6 +131,7 @@ public class AmmoTypes implements ContentList{ flakSurge = new AmmoType(Items.surgealloy, FlakBullets.surge, 5){{ shootEffect = ShootFx.shootBig; smokeEffect = ShootFx.shootBigSmoke; + reloadMultiplier = 2f; }}; //missiles diff --git a/core/src/io/anuke/mindustry/content/blocks/TurretBlocks.java b/core/src/io/anuke/mindustry/content/blocks/TurretBlocks.java index 8962d890be..ba451b38c9 100644 --- a/core/src/io/anuke/mindustry/content/blocks/TurretBlocks.java +++ b/core/src/io/anuke/mindustry/content/blocks/TurretBlocks.java @@ -11,7 +11,6 @@ import io.anuke.mindustry.world.blocks.defense.turrets.*; import io.anuke.ucore.graphics.Draw; import io.anuke.ucore.util.Angles; import io.anuke.ucore.util.Mathf; -import io.anuke.ucore.util.Strings; public class TurretBlocks extends BlockList implements ContentList{ public static Block duo, /*scatter,*/ @@ -142,35 +141,46 @@ public class TurretBlocks extends BlockList implements ContentList{ health = 380; }}; - salvo = new BurstTurret("salvo"){{ - size = 2; - range = 120f; - ammoTypes = new AmmoType[]{AmmoTypes.bulletCopper, AmmoTypes.bulletDense, AmmoTypes.bulletPyratite, AmmoTypes.bulletThorium, AmmoTypes.bulletSilicon}; - reload = 40f; - restitution = 0.03f; - ammoEjectBack = 3f; - cooldown = 0.03f; - recoil = 3f; - shootShake = 2f; - burstSpacing = 4; - shots = 3; - ammoUseEffect = ShootFx.shellEjectBig; + salvo = new BurstTurret("salvo"){ + TextureRegion[] panels = new TextureRegion[2]; - drawer = (tile, entity) -> { - Draw.rect(region, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90); - float offsetx = (int) (Mathf.abscurve(Mathf.curve(entity.reload / reload, 0.3f, 0.2f)) * 3f); - float offsety = -(int) (Mathf.abscurve(Mathf.curve(entity.reload / reload, 0.3f, 0.2f)) * 2f); + @Override + public void load() { + super.load(); + panels[0] = Draw.region(name + "-panel-left"); + panels[1] = Draw.region(name + "-panel-right"); + } - for(int i : Mathf.signs){ - float rot = entity.rotation + 90 * i; - Draw.rect(name + "-panel-" + Strings.dir(i), - tile.drawx() + tr2.x + Angles.trnsx(rot, offsetx, offsety), - tile.drawy() + tr2.y + Angles.trnsy(rot, -offsetx, offsety), entity.rotation - 90); - } - }; + { + size = 2; + range = 120f; + ammoTypes = new AmmoType[]{AmmoTypes.bulletCopper, AmmoTypes.bulletDense, AmmoTypes.bulletPyratite, AmmoTypes.bulletThorium, AmmoTypes.bulletSilicon}; + reload = 40f; + restitution = 0.03f; + ammoEjectBack = 3f; + cooldown = 0.03f; + recoil = 3f; + shootShake = 2f; + burstSpacing = 4; + shots = 3; + ammoUseEffect = ShootFx.shellEjectBig; - health = 360; - }}; + drawer = (tile, entity) -> { + Draw.rect(region, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90); + float offsetx = (int) (Mathf.abscurve(Mathf.curve(entity.reload / reload, 0.3f, 0.2f)) * 3f); + float offsety = -(int) (Mathf.abscurve(Mathf.curve(entity.reload / reload, 0.3f, 0.2f)) * 2f); + + for(int i : Mathf.signs){ + float rot = entity.rotation + 90 * i; + Draw.rect(panels[i == -1 ? 0 : 1], + tile.drawx() + tr2.x + Angles.trnsx(rot, offsetx, offsety), + tile.drawy() + tr2.y + Angles.trnsy(rot, -offsetx, offsety), entity.rotation - 90); + } + }; + + health = 360; + } + }; ripple = new ArtilleryTurret("ripple"){{ ammoTypes = new AmmoType[]{AmmoTypes.artilleryDense, AmmoTypes.artilleryHoming, AmmoTypes.artilleryIncindiary, AmmoTypes.artilleryExplosive, AmmoTypes.artilleryPlastic}; @@ -193,7 +203,7 @@ public class TurretBlocks extends BlockList implements ContentList{ cyclone = new ItemTurret("cyclone"){{ ammoTypes = new AmmoType[]{AmmoTypes.flakExplosive, AmmoTypes.flakPlastic, AmmoTypes.flakSurge}; xRand = 4f; - reload = 8f; + reload = 10f; range = 140f; size = 3; recoil = 3f; diff --git a/core/src/io/anuke/mindustry/content/bullets/ArtilleryBullets.java b/core/src/io/anuke/mindustry/content/bullets/ArtilleryBullets.java index 352a432442..3ad7de9383 100644 --- a/core/src/io/anuke/mindustry/content/bullets/ArtilleryBullets.java +++ b/core/src/io/anuke/mindustry/content/bullets/ArtilleryBullets.java @@ -1,6 +1,7 @@ package io.anuke.mindustry.content.bullets; import io.anuke.mindustry.content.fx.BulletFx; +import io.anuke.mindustry.content.fx.Fx; import io.anuke.mindustry.entities.bullet.ArtilleryBulletType; import io.anuke.mindustry.entities.bullet.BasicBulletType; import io.anuke.mindustry.entities.bullet.BulletType; @@ -33,6 +34,7 @@ public class ArtilleryBullets extends BulletList implements ContentList{ lifetime = 15f; backColor = Palette.plastaniumBack; frontColor = Palette.plastaniumFront; + despawneffect = Fx.none; } }; diff --git a/core/src/io/anuke/mindustry/content/bullets/FlakBullets.java b/core/src/io/anuke/mindustry/content/bullets/FlakBullets.java index fafd1f4a1b..4dcd8512ea 100644 --- a/core/src/io/anuke/mindustry/content/bullets/FlakBullets.java +++ b/core/src/io/anuke/mindustry/content/bullets/FlakBullets.java @@ -1,8 +1,13 @@ package io.anuke.mindustry.content.bullets; +import io.anuke.mindustry.content.fx.BulletFx; +import io.anuke.mindustry.entities.bullet.Bullet; import io.anuke.mindustry.entities.bullet.BulletType; import io.anuke.mindustry.entities.bullet.FlakBulletType; +import io.anuke.mindustry.entities.effect.Lightning; +import io.anuke.mindustry.graphics.Palette; import io.anuke.mindustry.type.ContentList; +import io.anuke.ucore.util.Mathf; public class FlakBullets extends BulletList implements ContentList{ public static BulletType plastic, explosive, surge; @@ -13,19 +18,33 @@ public class FlakBullets extends BulletList implements ContentList{ plastic = new FlakBulletType(4f, 5){ { - + splashDamageRadius = 40f; + fragBullet = ArtilleryBullets.plasticFrag; + fragBullets = 4; + hiteffect = BulletFx.plasticExplosion; + frontColor = Palette.plastaniumFront; + backColor = Palette.plastaniumBack; } }; explosive = new FlakBulletType(4f, 5){ { - + //default bullet type, no changes } }; - surge = new FlakBulletType(4f, 5){ + surge = new FlakBulletType(4f, 7){ { + splashDamage = 33f; + } + @Override + public void despawned(Bullet b) { + super.despawned(b); + + for (int i = 0; i < 2; i++) { + Lightning.create(b.getTeam(), BulletFx.hitLancer, Palette.surge, damage, b.x, b.y, Mathf.random(360f), 12); + } } }; } diff --git a/core/src/io/anuke/mindustry/content/fx/BulletFx.java b/core/src/io/anuke/mindustry/content/fx/BulletFx.java index c44e4dece0..6608b0eadf 100644 --- a/core/src/io/anuke/mindustry/content/fx/BulletFx.java +++ b/core/src/io/anuke/mindustry/content/fx/BulletFx.java @@ -12,7 +12,7 @@ import io.anuke.ucore.util.Mathf; public class BulletFx extends FxList implements ContentList{ public static Effect hitBulletSmall, hitBulletBig, hitFlameSmall, hitLiquid, hitLaser, hitLancer, despawn, flakExplosion, blastExplosion, plasticExplosion, - artilleryTrail, incendTrail, missileTrail, absorb, flakExplosionBig; + artilleryTrail, incendTrail, missileTrail, absorb, flakExplosionBig, plasticExplosionFlak; @Override public void load(){ @@ -149,6 +149,30 @@ public class BulletFx extends FxList implements ContentList{ Draw.reset(); }); + plasticExplosionFlak = new Effect(28, e -> { + + Draw.color(Palette.plastaniumFront); + e.scaled(7, i -> { + Lines.stroke(3f * i.fout()); + Lines.circle(e.x, e.y, 3f + i.fin() * 34f); + }); + + Draw.color(Color.GRAY); + + Angles.randLenVectors(e.id, 7, 2f + 30f * e.finpow(), (x, y) -> { + Fill.circle(e.x + x, e.y + y, e.fout() * 4f + 0.5f); + }); + + Draw.color(Palette.plastaniumBack); + Lines.stroke(1f * e.fout()); + + Angles.randLenVectors(e.id + 1, 4, 1f + 30f * e.finpow(), (x, y) -> { + Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), 1f + e.fout() * 3f); + }); + + Draw.reset(); + }); + blastExplosion = new Effect(22, e -> { Draw.color(Palette.missileYellow);