From 8d435906577366511d8518ccbda5830bc2519df8 Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 18 Dec 2020 14:56:14 -0500 Subject: [PATCH] Multiblock damage calculation bugfix --- core/src/mindustry/entities/Damage.java | 7 +++---- core/src/mindustry/ui/dialogs/CustomRulesDialog.java | 10 +++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/core/src/mindustry/entities/Damage.java b/core/src/mindustry/entities/Damage.java index 8e0eba7b58..6151e76fea 100644 --- a/core/src/mindustry/entities/Damage.java +++ b/core/src/mindustry/entities/Damage.java @@ -389,11 +389,10 @@ public class Damage{ if(scaledDamage <= 0 || tile == null) continue; //apply damage to entity if needed - if(tile.build != null && tile.team() != team){ - int health = (int)tile.build.health(); - if(tile.build.health() > 0){ + if(tile.build != null && tile.build.team != team){ + if(tile.build.health > 0){ tile.build.damage(scaledDamage); - scaledDamage -= health; + scaledDamage -= (int)(tile.build.health / (tile.block().size * tile.block().size)); if(scaledDamage <= 0) continue; } diff --git a/core/src/mindustry/ui/dialogs/CustomRulesDialog.java b/core/src/mindustry/ui/dialogs/CustomRulesDialog.java index 234068bfd5..cfcdd85452 100644 --- a/core/src/mindustry/ui/dialogs/CustomRulesDialog.java +++ b/core/src/mindustry/ui/dialogs/CustomRulesDialog.java @@ -318,8 +318,8 @@ public class CustomRulesDialog extends BaseDialog{ dialog.addCloseButton(); dialog.buttons.button("@add", Icon.add, () -> { - BaseDialog addd = new BaseDialog("@add"); - addd.cont.pane(t -> { + BaseDialog add = new BaseDialog("@add"); + add.cont.pane(t -> { t.background(Tex.button); int i = 0; for(Weather weather : content.getBy(ContentType.weather)){ @@ -328,13 +328,13 @@ public class CustomRulesDialog extends BaseDialog{ rules.weather.add(new WeatherEntry(weather)); rebuild[0].run(); - addd.hide(); + add.hide(); }).size(140f, 50f); if(++i % 2 == 0) t.row(); } }); - addd.addCloseButton(); - addd.show(); + add.addCloseButton(); + add.show(); }).width(170f); //reset cooldown to random number