Drone repair cleanup / Percentage-based repair

This commit is contained in:
Anuken
2018-11-25 16:34:31 -05:00
parent 44897fb371
commit a7f7a09418
8 changed files with 29 additions and 120 deletions

View File

@@ -37,6 +37,7 @@ public class UnitTypes implements ContentList{
};
spirit = new UnitType("spirit", Spirit.class, Spirit::new){{
weapon = Weapons.healBlasterDrone;
isFlying = true;
drag = 0.01f;
speed = 0.2f;

View File

@@ -7,7 +7,7 @@ import io.anuke.mindustry.type.ContentType;
import io.anuke.mindustry.type.Weapon;
public class Weapons implements ContentList{
public static Weapon blaster, blasterSmall, glaiveBlaster, droneBlaster, healBlaster, chainBlaster, shockgun,
public static Weapon blaster, blasterSmall, glaiveBlaster, droneBlaster, healBlaster, healBlasterDrone, chainBlaster, shockgun,
sapper, swarmer, bomber, bomberTrident, flakgun, flamethrower, missiles, artillery, laserBurster;
@Override
@@ -169,6 +169,16 @@ public class Weapons implements ContentList{
ejectEffect = Fx.none;
ammo = AmmoTypes.lancerLaser;
}};
healBlasterDrone = new Weapon("heal-blaster"){{
length = 1.5f;
reload = 40f;
width = 0.5f;
roundrobin = true;
ejectEffect = Fx.none;
recoil = 2f;
ammo = AmmoTypes.healBlaster;
}};
}
@Override

View File

@@ -43,7 +43,7 @@ public class TurretBullets extends BulletList implements ContentList{
};
healBullet = new BulletType(5.2f, 13){
float healAmount = 21f;
float healPercent = 3f;
{
hiteffect = BulletFx.hitLaser;
@@ -51,6 +51,11 @@ public class TurretBullets extends BulletList implements ContentList{
collidesTeam = true;
}
@Override
public boolean collides(Bullet b, Tile tile){
return tile.getTeam() != b.getTeam() || tile.entity.healthf() < 1f;
}
@Override
public void draw(Bullet b){
Draw.color(Palette.heal);
@@ -67,8 +72,8 @@ public class TurretBullets extends BulletList implements ContentList{
tile = tile.target();
if(tile.getTeam() == b.getTeam() && !(tile.block() instanceof BuildBlock)){
Effects.effect(BlockFx.healBlock, tile.drawx(), tile.drawy(), tile.block().size);
tile.entity.healBy(healAmount);
Effects.effect(BlockFx.healBlockFull, Palette.heal, tile.drawx(), tile.drawy(), tile.block().size);
tile.entity.healBy(healPercent / 100f * tile.entity.maxHealth());
}
}
};