Great cleanup

This commit is contained in:
Skat
2020-11-07 11:37:46 +03:00
parent 29b8db0a85
commit ed36390f3c
45 changed files with 134 additions and 189 deletions

View File

@@ -165,7 +165,7 @@ public abstract class BulletType extends Content{
if(makeFire && tile.team != b.team){
Fires.create(tile.tile);
}
if(healPercent > 0f && tile.team == b.team && !(tile.block instanceof ConstructBlock)){
Fx.healBlockFull.at(tile.x, tile.y, tile.block.size, Pal.heal);
tile.heal(healPercent / 100f * tile.maxHealth());
@@ -213,9 +213,9 @@ public abstract class BulletType extends Content{
if(status != StatusEffects.none){
Damage.status(b.team, x, y, splashDamageRadius, status, statusDuration, collidesAir, collidesGround);
}
if(healPercent > 0f){
indexer.eachBlock(b.team, x, y, splashDamageRadius, other -> other.damaged(), other -> {
indexer.eachBlock(b.team, x, y, splashDamageRadius, Building::damaged, other -> {
Fx.healBlockFull.at(other.x, other.y, other.block.size, Pal.heal);
other.heal(healPercent / 100f * other.maxHealth());
});
@@ -253,8 +253,8 @@ public abstract class BulletType extends Content{
public void init(Bullet b){
if(killShooter && b.owner() instanceof Healthc){
((Healthc)b.owner()).kill();
if(killShooter && b.owner() instanceof Healthc h){
h.kill();
}
if(instantDisappear){

View File

@@ -62,17 +62,15 @@ public class SapBulletType extends BulletType{
if(target != null){
float result = Math.min(target.health(), damage);
if(b.owner instanceof Healthc){
((Healthc)b.owner).heal(result * sapStrength);
if(b.owner instanceof Healthc h){
h.heal(result * sapStrength);
}
}
if(target instanceof Hitboxc hit){
hit.collision(b, hit.x(), hit.y());
b.collision(hit, hit.x(), hit.y());
}else if(target instanceof Building tile){
if(tile.collide(b)){
tile.collision(b);
hit(b, tile.x, tile.y);