diff --git a/core/src/main/assets/interfaces/buffs.png b/core/src/main/assets/interfaces/buffs.png index e984af86c..df34f6eb3 100644 Binary files a/core/src/main/assets/interfaces/buffs.png and b/core/src/main/assets/interfaces/buffs.png differ diff --git a/core/src/main/assets/interfaces/large_buffs.png b/core/src/main/assets/interfaces/large_buffs.png index 58e082d6b..d52d6374a 100644 Binary files a/core/src/main/assets/interfaces/large_buffs.png and b/core/src/main/assets/interfaces/large_buffs.png differ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Berserk.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Berserk.java index d959ccff2..d9a613e2e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Berserk.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Berserk.java @@ -136,6 +136,7 @@ public class Berserk extends Buff { public void damage(int damage){ if (state == State.RECOVERING) return; power = Math.min(1.1f, power + (damage/(float)target.HT)/3f ); + BuffIndicator.refreshHero(); //show new power immediately } public void recover(float percent){ @@ -157,19 +158,30 @@ public class Berserk extends Buff { public void tintIcon(Image icon) { switch (state){ case NORMAL: default: - if (power < 0.5f) icon.hardlight(1f, 1f, 1f - 2*(power)); - else if (power < 1f) icon.hardlight(1f, 1.5f - power, 0f); - else icon.hardlight(1f, 0f, 0f); + if (power < 1f) icon.hardlight(1f, 0.5f, 0f); + else icon.hardlight(1f, 0f, 0f); break; case BERSERK: icon.hardlight(1f, 0f, 0f); break; case RECOVERING: - icon.hardlight(1f - (levelRecovery*0.5f), 1f - (levelRecovery*0.3f), 1f); + icon.hardlight(0, 0, 1f); break; } } + @Override + public float iconFadePercent() { + switch (state){ + case NORMAL: default: + return Math.max(0f, 1f - power); + case BERSERK: + return 0f; + case RECOVERING: + return 1f - levelRecovery/2f; + } + } + @Override public String toString() { switch (state){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java index bdc528c85..b31f015cb 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java @@ -60,13 +60,19 @@ public class Combo extends Buff implements ActionIndicator.Action { @Override public void tintIcon(Image icon) { - if (comboTime >= 3f){ - icon.resetColor(); - } else { - icon.tint(0xb3b3b3, 0.5f + 0.5f*(3f + 1 - comboTime)/3f); - } + if (count >= 10) icon.hardlight(1f, 0f, 0f); + else if (count >= 8)icon.hardlight(1f, 0.8f, 0f); + else if (count >= 6)icon.hardlight(1f, 1f, 0f); + else if (count >= 4)icon.hardlight(0.8f, 1f, 0f); + else if (count >= 2)icon.hardlight(0f, 1f, 0f); + else icon.resetColor(); } - + + @Override + public float iconFadePercent() { + return (4 - comboTime)/4f; + } + @Override public String toString() { return Messages.get(this, "name"); @@ -87,6 +93,8 @@ public class Combo extends Buff implements ActionIndicator.Action { } + BuffIndicator.refreshHero(); //refresh the buff visually on-hit + } public void miss( Char enemy ){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/FlavourBuff.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/FlavourBuff.java index f38ff16a4..f3d4eb07e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/FlavourBuff.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/FlavourBuff.java @@ -31,14 +31,6 @@ public class FlavourBuff extends Buff { detach(); return true; } - - public static void greyIcon(Image icon, float startGrey, float remaining){ - if (remaining >= startGrey){ - icon.resetColor(); - } else { - icon.tint(0xb3b3b3, 0.6f + 0.3f*(startGrey - remaining)/startGrey); - } - } //flavour buffs can all just rely on cooldown() protected String dispTurns() { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Haste.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Haste.java index 0dacf2626..be83e6546 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Haste.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Haste.java @@ -38,6 +38,11 @@ public class Haste extends FlavourBuff { return BuffIndicator.MOMENTUM; } + @Override + public void tintIcon(Image icon) { + icon.hardlight(1f, 0.8f, 0f); + } + @Override public float iconFadePercent() { return Math.max(0, (DURATION - visualcooldown()) / DURATION); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Momentum.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Momentum.java index 23f3db83f..7aca1124e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Momentum.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Momentum.java @@ -72,13 +72,14 @@ public class Momentum extends Buff { @Override public void tintIcon(Image icon) { - if (stacks <= 5) { - icon.hardlight(0.2f * (stacks - 1), 1f, 0f); - } else { - icon.hardlight(1f, 1f - 0.2f*(stacks - 6), 0f); - } + icon.invert(); } - + + @Override + public float iconFadePercent() { + return (10-stacks)/10f; + } + @Override public String toString() { return Messages.get(this, "name"); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java index 8cb758768..c18bce206 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java @@ -157,7 +157,20 @@ public class Preparation extends Buff implements ActionIndicator.Action { break; } } - + + @Override + public float iconFadePercent() { + if (AttackLevel.getLvl(turnsInvis) == AttackLevel.LVL_5){ + return 0; + } else { + float turnsForCur = AttackLevel.getLvl(turnsInvis).turnsReq; + float turnsForNext = AttackLevel.values()[AttackLevel.getLvl(turnsInvis).ordinal()+1].turnsReq; + turnsForNext -= turnsForCur; + float turnsToNext = turnsInvis - turnsForCur; + return Math.min(1, (turnsForNext - turnsToNext)/(turnsForNext)); + } + } + @Override public String toString() { return Messages.get(this, "name"); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Stamina.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Stamina.java index eb525f832..88899e1f0 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Stamina.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Stamina.java @@ -38,6 +38,11 @@ public class Stamina extends FlavourBuff { return BuffIndicator.MOMENTUM; } + @Override + public void tintIcon(Image icon) { + icon.hardlight(0.5f, 1f, 0.5f); + } + @Override public float iconFadePercent() { return Math.max(0, (DURATION - visualcooldown()) / DURATION); 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 dcea68367..2b99366fb 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java @@ -215,9 +215,14 @@ public class BuffIndicator extends Component { public void updateIcon(){ icon.frame( film.get( buff.icon() ) ); buff.tintIcon(icon); - //logic here rounds down to the nearest pixel + //round up to the nearest pixel if <50% faded, otherwise round down + float fadeHeight = buff.iconFadePercent() * icon.height(); float zoom = (camera() != null) ? camera().zoom : 1; - grey.scale.set( icon.width(), (float)Math.floor(zoom*icon.height()*buff.iconFadePercent())/zoom); + if (fadeHeight < icon.height()/2f){ + grey.scale.set( icon.width(), (float)Math.ceil(zoom*fadeHeight)/zoom); + } else { + grey.scale.set( icon.width(), (float)Math.floor(zoom*fadeHeight)/zoom); + } } @Override