From a839392b0febbbb89baeaaff0abeaa7aa475a34c Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 22 Apr 2016 03:57:55 -0400 Subject: [PATCH] v0.3.5: clarity improvements to shielding --- .../shatteredpixeldungeon/ui/StatusPane.java | 24 ++++++++++++------- .../windows/WndHero.java | 11 +++++---- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java index 88e57711a..36b62cf4c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java @@ -51,7 +51,8 @@ public class StatusPane extends Component { private int lastTier = 0; - private Image shield; + private Image rawShielding; + private Image shieldedHP; private Image hp; private Image exp; @@ -103,8 +104,12 @@ public class StatusPane extends Component { compass = new Compass( Dungeon.level.exit ); add( compass ); - shield = new Image( Assets.SHLD_BAR ); - add(shield); + rawShielding = new Image( Assets.SHLD_BAR ); + rawShielding.alpha(0.5f); + add(rawShielding); + + shieldedHP = new Image( Assets.SHLD_BAR ); + add(shieldedHP); hp = new Image( Assets.HP_BAR ); add( hp ); @@ -151,8 +156,8 @@ public class StatusPane extends Component { compass.y = avatar.y + avatar.height / 2f - compass.origin.y; PixelScene.align(compass); - hp.x = shield.x = 30; - hp.y = shield.y = 3; + hp.x = shieldedHP.x = rawShielding.x = 30; + hp.y = shieldedHP.y = rawShielding.y = 3; bossHP.setPos( 6 + (width - bossHP.width())/2, 20); @@ -174,12 +179,12 @@ public class StatusPane extends Component { float health = Dungeon.hero.HP; float shield = Dungeon.hero.SHLD; - float max = Math.max(health+shield, Dungeon.hero.HT); + float max = Dungeon.hero.HT; if (!Dungeon.hero.isAlive()) { avatar.tint( 0x000000, 0.6f ); blood.on = false; - } else if ((health/Dungeon.hero.HT) < 0.25f) { + } else if ((health/max) < 0.25f) { avatar.tint( 0xcc0000, 0.4f ); blood.on = true; } else { @@ -187,8 +192,9 @@ public class StatusPane extends Component { blood.on = false; } - hp.scale.x = health/max; - this.shield.scale.x = (health+shield)/max; + hp.scale.x = Math.max( 0, (health-shield)/max); + shieldedHP.scale.x = health/max; + rawShielding.scale.x = shield/max; exp.scale.x = (width / exp.width) * Dungeon.hero.exp / Dungeon.hero.maxExp(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndHero.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndHero.java index 9179e1adf..70bbdb822 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndHero.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndHero.java @@ -44,7 +44,7 @@ import java.util.Locale; public class WndHero extends WndTabbed { - private static final int WIDTH = 100; + private static final int WIDTH = 115; private StatsTab stats; private BuffsTab buffs; @@ -112,7 +112,7 @@ public class WndHero extends WndTabbed { GameScene.show( new WndCatalogus() ); } }; - btnCatalogs.setRect( 0, title.height(), btnCatalogs.reqWidth() + 2, btnCatalogs.reqHeight() + 2 ); + btnCatalogs.setRect( 0, title.height()+1, 57, btnCatalogs.reqHeight() + 2 ); add( btnCatalogs ); RedButton btnJournal = new RedButton( Messages.get(this, "journal") ) { @@ -124,13 +124,14 @@ public class WndHero extends WndTabbed { }; btnJournal.setRect( btnCatalogs.right() + 1, btnCatalogs.top(), - btnJournal.reqWidth() + 2, btnJournal.reqHeight() + 2 ); + 57, btnJournal.reqHeight() + 2 ); add( btnJournal ); pos = btnCatalogs.bottom() + GAP; statSlot( Messages.get(this, "str"), hero.STR() ); - statSlot( Messages.get(this, "health"), (hero.HP + hero.SHLD) + "/" + hero.HT ); + if (hero.SHLD > 0) statSlot( Messages.get(this, "health"), hero.HP + "+" + hero.SHLD + "/" + hero.HT ); + else statSlot( Messages.get(this, "health"), (hero.HP) + "/" + hero.HT ); statSlot( Messages.get(this, "exp"), hero.exp + "/" + hero.maxExp() ); pos += GAP; @@ -148,7 +149,7 @@ public class WndHero extends WndTabbed { add( txt ); txt = PixelScene.renderText( value, 8 ); - txt.x = WIDTH * 0.65f; + txt.x = WIDTH * 0.6f; txt.y = pos; PixelScene.align(txt); add( txt );