Tau mech implemented

This commit is contained in:
Anuken
2018-08-22 23:29:14 -04:00
parent 8d9ec206bf
commit 30dd089c8b
29 changed files with 744 additions and 545 deletions

View File

@@ -12,6 +12,7 @@ import io.anuke.mindustry.type.ContentList;
public class AmmoTypes implements ContentList{
public static AmmoType bulletCopper, bulletDense, bulletThorium, bulletSilicon, bulletPyratite,
shotgunTungsten, bombExplosive, bombIncendiary, bombOil, shellCarbide, flamerThermite, weaponMissile, weaponMissileSwarm, bulletMech,
healBlaster,
flakLead, flakExplosive, flakPlastic, flakSurge, missileExplosive, missileIncindiary, missileSurge,
artilleryDense, artilleryPlastic, artilleryHoming, artilleryIncindiary, artilleryExplosive,
basicFlame, lancerLaser, lightning, spectreLaser, meltdownLaser, fuseShotgun, oil, water, lava, cryofluid;
@@ -28,6 +29,13 @@ public class AmmoTypes implements ContentList{
inaccuracy = 5f;
}};
healBlaster = new AmmoType(TurretBullets.healBullet){{
shootEffect = ShootFx.shootHeal;
smokeEffect = BulletFx.hitLaser;
reloadMultiplier = 1f;
inaccuracy = 2f;
}};
shotgunTungsten = new AmmoType(WeaponBullets.tungstenShotgun){{
shootEffect = ShootFx.shootBig;
smokeEffect = ShootFx.shootBigSmoke;

View File

@@ -2,18 +2,29 @@ package io.anuke.mindustry.content;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.content.fx.UnitFx;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.Unit;
import io.anuke.mindustry.entities.Units;
import io.anuke.mindustry.entities.effect.Fire;
import io.anuke.mindustry.game.Content;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.graphics.Shaders;
import io.anuke.mindustry.type.ContentList;
import io.anuke.mindustry.type.Mech;
import io.anuke.mindustry.type.Upgrade;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.Core;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Graphics;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.util.Mathf;
import static io.anuke.mindustry.Vars.tilesize;
import static io.anuke.mindustry.Vars.world;
public class Mechs implements ContentList{
public static Mech alpha, delta, tau, omega, dart, javelin, trident, halberd;
@@ -33,34 +44,98 @@ public class Mechs implements ContentList{
maxSpeed = 4f;
}};
delta = new Mech("delta-mech", false){{
drillPower = -1;
speed = 0.75f;
boostSpeed = 0.95f;
itemCapacity = 15;
armor = 30f;
weaponOffsetX = -1;
itemCapacity = 15;
weaponOffsetY = -1;
weapon = Weapons.shockgun;
trailColorTo = Color.valueOf("d3ddff");
maxSpeed = 5f;
}};
delta = new Mech("delta-mech", false){
{
drillPower = -1;
speed = 0.75f;
boostSpeed = 0.95f;
itemCapacity = 15;
armor = 30f;
weaponOffsetX = -1;
itemCapacity = 15;
weaponOffsetY = -1;
weapon = Weapons.shockgun;
trailColorTo = Color.valueOf("d3ddff");
maxSpeed = 5f;
altChargeAlpha = 0.05f;
}
tau = new Mech("tau-mech", false){{
drillPower = 3;
mineSpeed = 3f;
itemCapacity = 70;
speed = 0.44f;
drag = 0.35f;
boostSpeed = 0.8f;
weapon = Weapons.blaster;
maxSpeed = 5f;
armor = 30f;
}};
@Override
public void updateAlt(Player player){
if(player.altHeat > 0.01f){
player.applyEffect(StatusEffects.overdrive, 0.1f);
}
}
@Override
public void draw(Player player){
super.draw(player);
player.hitTime = Math.max(player.hitTime, player.altHeat * Unit.hitDuration);
}
};
tau = new Mech("tau-mech", false){
protected float healRange = 60f;
protected float healAmount = 10f;
protected Rectangle rect = new Rectangle();
{
drillPower = 4;
mineSpeed = 3f;
itemCapacity = 70;
weaponOffsetY = -1;
weaponOffsetX = 1;
speed = 0.44f;
drag = 0.35f;
boostSpeed = 0.8f;
weapon = Weapons.healBlaster;
maxSpeed = 5f;
armor = 30f;
altChargeAlpha = 0.05f;
trailColorTo = Palette.heal;
}
@Override
public void draw(Player player){
super.draw(player);
player.hitTime = Math.max(player.hitTime, player.altHeat * Unit.hitDuration);
}
@Override
public void updateAlt(Player player){
if(player.altHeat >= 0.91f){
Effects.effect(UnitFx.healWave, player);
rect.setSize(healRange*2f).setCenter(player.x, player.y);
Units.getNearby(player.getTeam(), rect, unit -> {
if(unit.distanceTo(player) <= healRange){
if(unit.health < unit.maxHealth()){
Effects.effect(UnitFx.heal, unit);
}
unit.healBy(healAmount);
}
});
int blockRange = (int)(healRange/tilesize);
int px = world.toTile(player.x), py = world.toTile(player.y);
for(int x = -blockRange; x <= blockRange; x++){
for(int y = -blockRange; y <= blockRange; y++){
if(Mathf.dst(x, y) > blockRange) continue;
Tile tile = world.tile(px + x, py + y);
if(tile != null){
Fire.extinguish(tile, 1000f);
}
}
}
player.altHeat = 0f;
}
}
};
omega = new Mech("omega-mech", false){
protected TextureRegion armorRegion;
{
drillPower = 2;
mineSpeed = 1.5f;
@@ -76,6 +151,11 @@ public class Mechs implements ContentList{
armor = 50f;
}
@Override
public float getRotationAlpha(Player player){
return 0.6f - player.altHeat * 0.3f;
}
@Override
public float spreadX(Player player){
return player.altHeat*2f;

View File

@@ -129,6 +129,7 @@ public class Recipes implements ContentList{
new Recipe(units, UpgradeBlocks.javelinFactory, new ItemStack(Items.lead, 200), new ItemStack(Items.silicon, 250), new ItemStack(Items.titanium, 300), new ItemStack(Items.plastanium, 200));
new Recipe(units, UpgradeBlocks.deltaFactory, new ItemStack(Items.densealloy, 160), new ItemStack(Items.silicon, 220), new ItemStack(Items.titanium, 250)).setDesktop();
new Recipe(units, UpgradeBlocks.omegaFactory, new ItemStack(Items.densealloy, 160), new ItemStack(Items.silicon, 220), new ItemStack(Items.titanium, 250)).setDesktop();
new Recipe(units, UpgradeBlocks.tauFactory, new ItemStack(Items.densealloy, 160), new ItemStack(Items.silicon, 220), new ItemStack(Items.titanium, 250)).setDesktop();
//new Recipe(units, UpgradeBlocks.deltaFactory, new ItemStack(Items.copper, 30), new ItemStack(Items.lead, 50), new ItemStack(Items.silicon, 30));

View File

@@ -45,6 +45,7 @@ public class UnitTypes implements ContentList{
speed = 0.3f;
maxVelocity = 1.9f;
drag = 0.01f;
weapon = Weapons.chainBlaster;
isFlying = true;
}};

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, chainBlaster, shockgun, sapper, swarmer, bomber, flakgun, flamethrower, missiles;
public static Weapon blaster, healBlaster, chainBlaster, shockgun, sapper, swarmer, bomber, flakgun, flamethrower, missiles;
@Override
public void load(){
@@ -22,6 +22,15 @@ public class Weapons implements ContentList{
ammo = AmmoTypes.bulletMech;
}};
healBlaster = new Weapon("heal-blaster"){{
length = 1.5f;
reload = 30f;
roundrobin = false;
ejectEffect = Fx.none;
recoil = 2f;
ammo = AmmoTypes.healBlaster;
}};
missiles = new Weapon("missiles"){{
length = 1.5f;
reload = 40f;

View File

@@ -30,11 +30,41 @@ import io.anuke.ucore.util.Mathf;
import static io.anuke.mindustry.Vars.world;
public class TurretBullets extends BulletList implements ContentList{
public static BulletType fireball, basicFlame, lancerLaser, fuseShot, waterShot, cryoShot, lavaShot, oilShot, lightning, driverBolt;
public static BulletType fireball, basicFlame, lancerLaser, fuseShot, waterShot, cryoShot, lavaShot, oilShot, lightning, driverBolt, healBullet;
@Override
public void load(){
healBullet = new BulletType(5.2f, 25){
float healAmount = 14f;
{
hiteffect = BulletFx.hitLaser;
despawneffect = BulletFx.hitLaser;
collidesTeam = true;
}
@Override
public void draw(Bullet b){
Draw.color(Palette.heal);
Lines.stroke(2f);
Lines.lineAngleCenter(b.x, b.y, b.angle(), 7f);
Draw.color(Color.WHITE);
Lines.lineAngleCenter(b.x, b.y, b.angle(), 3f);
Draw.reset();
}
@Override
public void hitTile(Bullet b, Tile tile){
super.hit(b);
if(tile.getTeam() == b.getTeam()){
Effects.effect(BlockFx.healBlock, tile.drawx(), tile.drawy(), tile.block().size);
tile.entity.health += healAmount;
tile.entity.health = Mathf.clamp(tile.entity.health, 0, tile.block().health);
}
}
};
fireball = new BulletType(1f, 4){
{
pierce = true;

View File

@@ -19,7 +19,7 @@ public class BlockFx extends FxList implements ContentList{
public static Effect reactorsmoke, nuclearsmoke, nuclearcloud, redgeneratespark, generatespark, fuelburn, plasticburn,
pulverize, pulverizeRed, pulverizeRedder, pulverizeSmall, pulverizeMedium, producesmoke, smeltsmoke, formsmoke, blastsmoke,
lava, dooropen, doorclose, dooropenlarge, doorcloselarge, purify, purifyoil, purifystone, generate, mine, mineBig, mineHuge,
smelt, teleportActivate, teleport, teleportOut, ripple, bubble, commandSend;
smelt, teleportActivate, teleport, teleportOut, ripple, bubble, commandSend, healBlock;
@Override
public void load(){
@@ -284,5 +284,12 @@ public class BlockFx extends FxList implements ContentList{
Lines.poly(e.x, e.y, 40, 4f + e.finpow() * 120f);
Draw.color();
});
healBlock = new Effect(20, e -> {
Draw.color(Palette.heal);
Lines.stroke(2f * e.fout() + 0.5f);
Lines.square(e.x, e.y, 1f + (e.fin() * e.rotation * tilesize/2f-1f));
Draw.color();
});
}
}

View File

@@ -11,7 +11,7 @@ import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf;
public class BulletFx extends FxList implements ContentList{
public static Effect hitBulletSmall, hitBulletBig, hitFlameSmall, hitLiquid, hitLancer, despawn, flakExplosion, blastExplosion, plasticExplosion,
public static Effect hitBulletSmall, hitBulletBig, hitFlameSmall, hitLiquid, hitLaser, hitLancer, despawn, flakExplosion, blastExplosion, plasticExplosion,
artilleryTrail, incendTrail, missileTrail;
@Override
@@ -82,6 +82,13 @@ public class BulletFx extends FxList implements ContentList{
Draw.reset();
});
hitLaser = new Effect(8, e -> {
Draw.color(Color.WHITE, Palette.heal, e.fin());
Lines.stroke(0.5f + e.fout());
Lines.circle(e.x, e.y, e.fin()*5f);
Draw.reset();
});
despawn = new Effect(12, e -> {
Draw.color(Palette.lighterOrange, Color.GRAY, e.fin());
Lines.stroke(e.fout());

View File

@@ -13,7 +13,7 @@ import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf;
public class ShootFx extends FxList implements ContentList{
public static Effect shootSmall, shootSmallSmoke, shootBig, shootBig2, shootBigSmoke, shootBigSmoke2, shootSmallFlame, shootLiquid, shellEjectSmall, shellEjectMedium, shellEjectBig, lancerLaserShoot, lancerLaserShootSmoke, lancerLaserCharge, lancerLaserChargeBegin, lightningCharge, lightningShoot;
public static Effect shootSmall, shootHeal, shootSmallSmoke, shootBig, shootBig2, shootBigSmoke, shootBigSmoke2, shootSmallFlame, shootLiquid, shellEjectSmall, shellEjectMedium, shellEjectBig, lancerLaserShoot, lancerLaserShootSmoke, lancerLaserCharge, lancerLaserChargeBegin, lightningCharge, lightningShoot;
@Override
public void load(){
@@ -26,6 +26,14 @@ public class ShootFx extends FxList implements ContentList{
Draw.reset();
});
shootHeal = new Effect(8, e -> {
Draw.color(Palette.heal);
float w = 1f + 5 * e.fout();
Shapes.tri(e.x, e.y, w, 17f * e.fout(), e.rotation);
Shapes.tri(e.x, e.y, w, 4f * e.fout(), e.rotation + 180f);
Draw.reset();
});
shootSmallSmoke = new Effect(20f, e -> {
Draw.color(Palette.lighterOrange, Color.LIGHT_GRAY, Color.GRAY, e.fin());

View File

@@ -11,7 +11,7 @@ import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf;
public class UnitFx extends FxList implements ContentList{
public static Effect vtolHover, unitDrop, unitPickup, unitLand, pickup;
public static Effect vtolHover, unitDrop, unitPickup, unitLand, pickup, healWave, heal;
@Override
public void load(){
@@ -53,5 +53,19 @@ public class UnitFx extends FxList implements ContentList{
Lines.spikes(e.x, e.y, 1f + e.fin() * 6f, e.fout() * 4f, 6);
Draw.reset();
});
healWave = new Effect(22, e -> {
Draw.color(Palette.heal);
Lines.stroke(e.fout() * 2f);
Lines.poly(e.x, e.y, 30, 4f + e.finpow() * 60f);
Draw.color();
});
heal = new Effect(11, e -> {
Draw.color(Palette.heal);
Lines.stroke(e.fout() * 2f);
Lines.poly(e.x, e.y, 10, 2f + e.finpow() * 7f);
Draw.color();
});
}
}