Added alpha drone swarm ability

This commit is contained in:
Anuken
2018-08-24 13:54:53 -04:00
parent 5e8686db77
commit 94805259d7
14 changed files with 672 additions and 527 deletions
+35 -5
View File
@@ -11,9 +11,12 @@ import io.anuke.mindustry.entities.Unit;
import io.anuke.mindustry.entities.Units;
import io.anuke.mindustry.entities.effect.Fire;
import io.anuke.mindustry.entities.effect.Lightning;
import io.anuke.mindustry.entities.units.BaseUnit;
import io.anuke.mindustry.entities.units.types.AlphaDrone;
import io.anuke.mindustry.game.Content;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.graphics.Shaders;
import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.type.ContentList;
import io.anuke.mindustry.type.Mech;
import io.anuke.mindustry.world.Tile;
@@ -24,8 +27,7 @@ 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;
import static io.anuke.mindustry.Vars.*;
public class Mechs implements ContentList{
public static Mech alpha, delta, tau, omega, dart, javelin, trident, halberd;
@@ -37,6 +39,7 @@ public class Mechs implements ContentList{
public void load(){
alpha = new Mech("alpha-mech", false){
int maxDrones = 3;
{
drillPower = 1;
mineSpeed = 1.5f;
@@ -44,14 +47,41 @@ public class Mechs implements ContentList{
boostSpeed = 0.85f;
weapon = Weapons.blaster;
maxSpeed = 4f;
altChargeAlpha = 0.03f;
altChargeAlpha = 0.04f;
trailColorTo = Color.valueOf("ffd37f");
}
@Override
public void updateAlt(Player player){
if(player.altHeat >= 0.91f){
if(getDrones(player) >= maxDrones){
player.altHeat = 0f;
}
if(player.altHeat >= 0.91f){
if(!Net.client()) {
AlphaDrone drone = (AlphaDrone) UnitTypes.alphaDrone.create(player.getTeam());
drone.leader = player;
drone.set(player.x, player.y);
drone.add();
Effects.effect(UnitFx.unitLand, player);
}
player.altHeat = 0f;
}
}
@Override
public void draw(Player player){
if(getDrones(player) < maxDrones){
player.hitTime = Math.max(player.hitTime, player.altHeat * Unit.hitDuration);
}
}
int getDrones(Player player){
int sum = 0;
for(BaseUnit unit : unitGroups[player.getTeam().ordinal()].all()){
if(unit instanceof AlphaDrone && ((AlphaDrone) unit).leader == player) sum ++;
}
return sum;
}
};
@@ -1,5 +1,6 @@
package io.anuke.mindustry.content;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.ObjectSet;
import io.anuke.mindustry.entities.units.UnitType;
@@ -8,7 +9,7 @@ import io.anuke.mindustry.game.Content;
import io.anuke.mindustry.type.ContentList;
public class UnitTypes implements ContentList{
public static UnitType drone, dagger, interceptor, monsoon, titan, fabricator;
public static UnitType drone, alphaDrone, dagger, interceptor, monsoon, titan, fabricator;
@Override
public void load(){
@@ -17,12 +18,29 @@ public class UnitTypes implements ContentList{
drag = 0.01f;
speed = 0.2f;
maxVelocity = 0.8f;
ammoCapacity = 0;
range = 50f;
healSpeed = 0.05f;
health = 60;
}};
alphaDrone = new UnitType("alpha-drone", AlphaDrone.class, AlphaDrone::new){
{
isFlying = true;
drag = 0.005f;
speed = 0.5f;
maxVelocity = 1.6f;
range = 40f;
health = 15;
weapon = Weapons.droneBlaster;
trailColor = Color.valueOf("ffd37f");
}
@Override
public boolean isHidden() {
return true;
}
};
dagger = new UnitType("dagger", Dagger.class, Dagger::new){{
maxVelocity = 1.1f;
speed = 0.2f;
@@ -57,7 +75,6 @@ public class UnitTypes implements ContentList{
drag = 0.01f;
isFlying = true;
weapon = Weapons.bomber;
ammoCapacity = 50;
}};
fabricator = new UnitType("fabricator", Fabricator.class, Fabricator::new){{
@@ -65,7 +82,6 @@ public class UnitTypes implements ContentList{
drag = 0.01f;
speed = 0.2f;
maxVelocity = 0.9f;
ammoCapacity = 0;
range = 70f;
itemCapacity = 70;
health = 220;
@@ -8,7 +8,7 @@ import io.anuke.mindustry.type.ContentList;
import io.anuke.mindustry.type.Weapon;
public class Weapons implements ContentList{
public static Weapon blaster, healBlaster, chainBlaster, shockgun, sapper, swarmer, bomber, flakgun, flamethrower, missiles;
public static Weapon blaster, droneBlaster, healBlaster, chainBlaster, shockgun, sapper, swarmer, bomber, flakgun, flamethrower, missiles;
@Override
public void load(){
@@ -21,6 +21,15 @@ public class Weapons implements ContentList{
ammo = AmmoTypes.bulletMech;
}};
droneBlaster = new Weapon("blaster"){{
length = 2f;
reload = 40f;
width = 1f;
roundrobin = true;
ejectEffect = ShootFx.shellEjectSmall;
ammo = AmmoTypes.bulletCopper;
}};
healBlaster = new Weapon("heal-blaster"){{
length = 1.5f;
reload = 30f;