Cleanup of merged PR

This commit is contained in:
Anuken
2020-10-30 19:03:05 -04:00
parent e02458122b
commit 4ec8e24bd8
6 changed files with 35 additions and 34 deletions

View File

@@ -42,6 +42,21 @@ public class Bullets implements ContentList{
@Override
public void load(){
//lightning bullets need to be initialized first.
damageLightning = new BulletType(0.0001f, 0f){{
lifetime = Fx.lightning.lifetime;
hitEffect = Fx.hitLancer;
despawnEffect = Fx.none;
status = StatusEffects.shocked;
statusDuration = 10f;
hittable = false;
}};
//this is just a copy of the damage lightning bullet that doesn't damage air units
damageLightningGround = new BulletType(0.0001f, 0f){};
JsonIO.copy(damageLightning, damageLightningGround);
damageLightningGround.collidesAir = false;
artilleryDense = new ArtilleryBulletType(3f, 20, "shell"){{
hitEffect = Fx.flakExplosion;
knockback = 0.8f;
@@ -357,20 +372,6 @@ public class Bullets implements ContentList{
pierceBuilding = true;
}};
damageLightning = new BulletType(0.0001f, 0f){{
lifetime = Fx.lightning.lifetime;
hitEffect = Fx.hitLancer;
despawnEffect = Fx.none;
status = StatusEffects.shocked;
statusDuration = 10f;
hittable = false;
}};
//this is just a copy of the damage lightning bullet that doesn't damage air units
damageLightningGround = new BulletType(0.0001f, 0f){};
JsonIO.copy(damageLightning, damageLightningGround);
damageLightningGround.collidesAir = false;
healBullet = new LaserBoltBulletType(5.2f, 13){{
healPercent = 3f;
collidesTeam = true;

View File

@@ -120,7 +120,7 @@ public class TechTree implements ContentList{
});
});
node(Items.thorium, with(Items.titanium, 8000, Items.lead, 15000, Items.copper, 20000), () -> {
node(Items.thorium, with(Items.titanium, 8000, Items.lead, 12000, Items.copper, 20000), () -> {
node(laserDrill, () -> {
node(blastDrill, () -> {
@@ -136,7 +136,7 @@ public class TechTree implements ContentList{
});
});
node(Items.pyratite, with(Items.coal, 6000, Items.lead, 10000, Items.sand, 4000), () -> {
node(Items.pyratite, with(Items.coal, 6000, Items.lead, 8000, Items.sand, 4000), () -> {
node(pyratiteMixer, () -> {
node(Items.blastCompound, with(Items.pyratite, 3000, Items.sporePod, 3000), () -> {
node(blastMixer, () -> {
@@ -159,7 +159,7 @@ public class TechTree implements ContentList{
});
});
node(Items.plastanium, with(Items.titanium, 10000, Items.silicon, 10000), () -> {
node(Items.plastanium, with(Items.titanium, 8000, Items.silicon, 8000), () -> {
node(plastaniumCompressor, () -> {
node(Items.phaseFabric, with(Items.thorium, 12000, Items.sand, 8000, Items.silicon, 5000), () -> {
node(phaseWeaver, () -> {

View File

@@ -332,14 +332,14 @@ public class UnitTypes implements ContentList{
lightningLengthRand = 7;
shootEffect = Fx.shootHeal;
lightningHitter = new BulletType(0.0001f, 0f){{
lightningType = new BulletType(0.0001f, 0f){{
lifetime = Fx.lightning.lifetime;
hitEffect = Fx.hitLancer;
despawnEffect = Fx.none;
status = StatusEffects.shocked;
statusDuration = 10f;
hittable = false;
healPercent = 5f;
healPercent = 2f;
collidesTeam = true;
}};
}};
@@ -518,7 +518,7 @@ public class UnitTypes implements ContentList{
shootEffect = Fx.greenLaserCharge;
healPercent = 20f;
healPercent = 25f;
collidesTeam = true;
sideAngle = 15f;

View File

@@ -115,13 +115,15 @@ public class Damage{
tr.trns(angle, length);
Intc2 collider = (cx, cy) -> {
Building tile = world.build(cx, cy);
if(tile != null && !collidedBlocks.contains(tile.pos()) && tile.team != team && tile.collide(hitter)){
boolean collide = tile != null && collidedBlocks.add(tile.pos());
if(collide && tile.team != team && tile.collide(hitter)){
tile.collision(hitter);
collidedBlocks.add(tile.pos());
hitter.type.hit(hitter, tile.x, tile.y);
}
//can heal?
if(tile != null && !collidedBlocks.contains(tile.pos()) && hitter.type.collides(hitter, tile)){
//try to heal the tile
if(collide && hitter.type.collides(hitter, tile)){
hitter.type.hitTile(hitter, tile, 0f);
}
};

View File

@@ -37,18 +37,12 @@ public class Lightning{
random.setSeed(seed);
hit.clear();
BulletType bulletType;
if(hitter != null && hitter.type.lightningHitter != null){
bulletType = hitter.type.lightningHitter;
}else{
bulletType = hitter != null && !hitter.type.collidesAir ? Bullets.damageLightningGround : Bullets.damageLightning;
}
BulletType hitCreate = hitter.type.lightningType;
Seq<Vec2> lines = new Seq<>();
bhit = false;
for(int i = 0; i < length / 2; i++){
bulletType.create(null, team, x, y, 0f, damage, 1f, 1f, hitter);
hitCreate.create(null, team, x, y, 0f, damage, 1f, 1f, hitter);
lines.add(new Vec2(x + Mathf.range(3f), y + Mathf.range(3f)));
if(lines.size > 1){

View File

@@ -116,8 +116,8 @@ public abstract class BulletType extends Content{
public float lightningDamage = -1;
public float lightningCone = 360f;
public float lightningAngle = 0f;
/** The lighting "hitter"; Use when trying to implement special lightning. */
public BulletType lightningHitter;
/** The bullet created at lightning points. */
public BulletType lightningType;
public float weaveScale = 1f;
public float weaveMag = -1f;
@@ -257,6 +257,10 @@ public abstract class BulletType extends Content{
//pierceBuilding is not enabled by default, because a bullet may want to *not* pierce buildings
}
if(lightningType == null){
lightningType = !collidesAir ? Bullets.damageLightningGround : Bullets.damageLightning;
}
if(killShooter && b.owner() instanceof Healthc){
((Healthc)b.owner()).kill();
}