Multiblock damage calculation bugfix

This commit is contained in:
Anuken
2020-12-18 14:56:14 -05:00
parent 6783069f95
commit 8d43590657
2 changed files with 8 additions and 9 deletions

View File

@@ -389,11 +389,10 @@ public class Damage{
if(scaledDamage <= 0 || tile == null) continue; if(scaledDamage <= 0 || tile == null) continue;
//apply damage to entity if needed //apply damage to entity if needed
if(tile.build != null && tile.team() != team){ if(tile.build != null && tile.build.team != team){
int health = (int)tile.build.health(); if(tile.build.health > 0){
if(tile.build.health() > 0){
tile.build.damage(scaledDamage); tile.build.damage(scaledDamage);
scaledDamage -= health; scaledDamage -= (int)(tile.build.health / (tile.block().size * tile.block().size));
if(scaledDamage <= 0) continue; if(scaledDamage <= 0) continue;
} }

View File

@@ -318,8 +318,8 @@ public class CustomRulesDialog extends BaseDialog{
dialog.addCloseButton(); dialog.addCloseButton();
dialog.buttons.button("@add", Icon.add, () -> { dialog.buttons.button("@add", Icon.add, () -> {
BaseDialog addd = new BaseDialog("@add"); BaseDialog add = new BaseDialog("@add");
addd.cont.pane(t -> { add.cont.pane(t -> {
t.background(Tex.button); t.background(Tex.button);
int i = 0; int i = 0;
for(Weather weather : content.<Weather>getBy(ContentType.weather)){ for(Weather weather : content.<Weather>getBy(ContentType.weather)){
@@ -328,13 +328,13 @@ public class CustomRulesDialog extends BaseDialog{
rules.weather.add(new WeatherEntry(weather)); rules.weather.add(new WeatherEntry(weather));
rebuild[0].run(); rebuild[0].run();
addd.hide(); add.hide();
}).size(140f, 50f); }).size(140f, 50f);
if(++i % 2 == 0) t.row(); if(++i % 2 == 0) t.row();
} }
}); });
addd.addCloseButton(); add.addCloseButton();
addd.show(); add.show();
}).width(170f); }).width(170f);
//reset cooldown to random number //reset cooldown to random number