From fdc5df529c889e7a5cf4288522b6f0e7597c26f8 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 31 Jul 2022 13:29:13 -0400 Subject: [PATCH] v1.4.0: adjusted buff bar layout and added max width --- .../shatteredpixel/shatteredpixeldungeon/actors/Char.java | 7 ++++--- .../shatteredpixeldungeon/ui/BossHealthBar.java | 2 +- .../shatteredpixeldungeon/ui/BuffIndicator.java | 4 +++- .../shatteredpixeldungeon/ui/StatusPane.java | 4 ++-- .../shatteredpixeldungeon/windows/WndInfoMob.java | 6 ++++-- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java index 0508d0f73..be451832b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java @@ -113,6 +113,7 @@ import com.watabou.utils.Random; import java.util.Arrays; import java.util.HashSet; +import java.util.LinkedHashSet; public abstract class Char extends Actor { @@ -143,7 +144,7 @@ public abstract class Char extends Actor { public boolean[] fieldOfView = null; - private HashSet buffs = new HashSet<>(); + private LinkedHashSet buffs = new LinkedHashSet<>(); @Override protected boolean act() { @@ -715,8 +716,8 @@ public abstract class Char extends Actor { super.spend( time / timeScale ); } - public synchronized HashSet buffs() { - return new HashSet<>(buffs); + public synchronized LinkedHashSet buffs() { + return new LinkedHashSet<>(buffs); } @SuppressWarnings("unchecked") diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BossHealthBar.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BossHealthBar.java index 077e74341..7b9cfbead 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BossHealthBar.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BossHealthBar.java @@ -143,7 +143,7 @@ public class BossHealthBar extends Component { bossInfo.setRect(x, y, bar.width, bar.height); if (buffs != null) { - buffs.setRect(hp.x, hp.y + 5, 110, 7); + buffs.setRect(hp.x, hp.y + 5, 47, 8); } skull.x = bar.x+5; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java index 766f2d598..b1860954d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java @@ -203,9 +203,11 @@ public class BuffIndicator extends Component { for (BuffButton icon : buffButtons.values()){ icon.updateIcon(); //button areas are slightly oversized, especially on small buttons - icon.setRect(x + pos * (size + (large ? 1 : 2)), y, size + (large ? 1 : 2), size + (large ? 0 : 5)); + icon.setRect(x + pos * (size + 1), y, size + 1, size + (large ? 0 : 5)); PixelScene.align(icon); pos++; + + icon.visible = icon.left() <= right(); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java index a23e0cd2c..db7fb0ba2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java @@ -207,7 +207,7 @@ public class StatusPane extends Component { heroInfoOnBar.setRect(heroInfo.right(), y + 19, 130, 20); - buffs.setPos( x + 31, y ); + buffs.setRect(x + 31, y, 128, 16); busy.x = x + bg.width + 1; busy.y = y + bg.height - 9; @@ -226,7 +226,7 @@ public class StatusPane extends Component { heroInfoOnBar.setRect(heroInfo.right(), y, 50, 9); - buffs.setPos( x + 31, y + 9 ); + buffs.setRect( x + 31, y + 9, 50, 8 ); busy.x = x + 1; busy.y = y + 33; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoMob.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoMob.java index 9a062c27c..b9531a055 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoMob.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoMob.java @@ -78,9 +78,11 @@ public class WndInfoMob extends WndTitledMessage { health.setRect(image.width() + GAP, name.bottom() + GAP, w, health.height()); - buffs.setPos( + buffs.setRect( name.right() + GAP-1, - name.bottom() - BuffIndicator.SIZE_SMALL-2 + name.bottom() - BuffIndicator.SIZE_SMALL-2, + w, + 8 ); height = health.bottom();