From 13ecf57edf9fefa26ac58fcef7699b8d8fdf9fa5 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 6 May 2020 20:20:25 -0400 Subject: [PATCH] v0.8.1: Improved buff fading VFX & applied it to a few new ones Also buffed alternate sources of bless: - holy dart bless duration up to 30 turns from 20. - Holy furor bless duration up to 120 turns from 100. --- .../actors/buffs/Adrenaline.java | 6 +++--- .../actors/buffs/AdrenalineSurge.java | 2 +- .../actors/buffs/ArcaneArmor.java | 2 +- .../actors/buffs/ArtifactRecharge.java | 14 ++++++++++---- .../actors/buffs/Barkskin.java | 2 +- .../shatteredpixeldungeon/actors/buffs/Bless.java | 6 +++--- .../actors/buffs/BlobImmunity.java | 6 +++--- .../shatteredpixeldungeon/actors/buffs/Buff.java | 14 +++++++++++++- .../actors/buffs/Burning.java | 6 ++++++ .../shatteredpixeldungeon/actors/buffs/Drowsy.java | 2 +- .../actors/buffs/EarthImbue.java | 6 +++--- .../actors/buffs/FireImbue.java | 6 +++--- .../actors/buffs/FlavourBuff.java | 3 +-- .../actors/buffs/FrostImbue.java | 6 +++--- .../shatteredpixeldungeon/actors/buffs/Haste.java | 7 +++---- .../actors/buffs/Invisibility.java | 6 +++--- .../actors/buffs/Levitation.java | 6 +++--- .../shatteredpixeldungeon/actors/buffs/Light.java | 4 ++-- .../actors/buffs/MagicalSight.java | 6 +++--- .../actors/buffs/MindVision.java | 6 +++--- .../actors/buffs/Recharging.java | 10 ++++++---- .../actors/buffs/Shadows.java | 6 +++--- .../actors/buffs/Stamina.java | 9 +++++---- .../actors/buffs/ToxicImbue.java | 6 +++--- .../shatteredpixeldungeon/actors/hero/Hero.java | 2 +- .../items/armor/RogueArmor.java | 2 +- .../elixirs/ElixirOfAquaticRejuvenation.java | 14 +++++++++----- .../items/potions/exotic/PotionOfHolyFuror.java | 2 +- .../items/potions/exotic/PotionOfStamina.java | 2 +- .../items/scrolls/ScrollOfRecharging.java | 6 ++---- .../items/wands/CursedWand.java | 2 +- .../items/weapon/missiles/darts/HolyDart.java | 2 +- .../shatteredpixeldungeon/plants/Blindweed.java | 2 +- .../shatteredpixeldungeon/plants/Dreamfoil.java | 2 +- .../shatteredpixeldungeon/plants/Earthroot.java | 6 +++--- .../shatteredpixeldungeon/plants/Firebloom.java | 2 +- .../shatteredpixeldungeon/plants/Icecap.java | 2 +- .../shatteredpixeldungeon/plants/Sorrowmoss.java | 2 +- .../shatteredpixeldungeon/plants/Starflower.java | 2 +- .../shatteredpixeldungeon/plants/Stormvine.java | 2 +- .../shatteredpixeldungeon/plants/Sungrass.java | 6 +++--- .../shatteredpixeldungeon/plants/Swiftthistle.java | 6 +++--- .../shatteredpixeldungeon/ui/BuffIndicator.java | 11 +++++++++-- 43 files changed, 128 insertions(+), 94 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Adrenaline.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Adrenaline.java index f8f70f596..aa0981f90 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Adrenaline.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Adrenaline.java @@ -39,10 +39,10 @@ public class Adrenaline extends FlavourBuff { public int icon() { return BuffIndicator.AMOK; } - + @Override - public void tintIcon(Image icon) { - greyIcon(icon, 5f, cooldown()); + public float iconFadePercent() { + return Math.max(0, (DURATION - visualcooldown()) / DURATION); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/AdrenalineSurge.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/AdrenalineSurge.java index 9042f9a9a..04be32e08 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/AdrenalineSurge.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/AdrenalineSurge.java @@ -67,7 +67,7 @@ public class AdrenalineSurge extends Buff { @Override public String desc() { - return Messages.get(this, "desc", boost, dispTurns(cooldown()+1)); + return Messages.get(this, "desc", boost, dispTurns(visualcooldown())); } private static final String BOOST = "boost"; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ArcaneArmor.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ArcaneArmor.java index 29a3d9a79..30bb8c7b2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ArcaneArmor.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ArcaneArmor.java @@ -84,7 +84,7 @@ public class ArcaneArmor extends Buff { @Override public String desc() { - return Messages.get(this, "desc", level, dispTurns(cooldown()+1)); + return Messages.get(this, "desc", level, dispTurns(visualcooldown())); } private static final String LEVEL = "level"; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ArtifactRecharge.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ArtifactRecharge.java index 897957b28..328b4d50b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ArtifactRecharge.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ArtifactRecharge.java @@ -29,13 +29,14 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; import com.watabou.noosa.Image; import com.watabou.utils.Bundle; -//TODO this may be very powerful, consider balancing public class ArtifactRecharge extends Buff { - + + public static final float DURATION = 30f; + { type = buffType.POSITIVE; } - + private int left; @Override @@ -79,7 +80,12 @@ public class ArtifactRecharge extends Buff { public void tintIcon(Image icon) { icon.hardlight(0, 1f, 0); } - + + @Override + public float iconFadePercent() { + return Math.max(0, (DURATION - left) / DURATION); + } + @Override public String toString() { return Messages.get(this, "name"); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Barkskin.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Barkskin.java index 4e4d2d55c..aef289d11 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Barkskin.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Barkskin.java @@ -77,7 +77,7 @@ public class Barkskin extends Buff { @Override public String desc() { - return Messages.get(this, "desc", level, dispTurns(cooldown()+1)); + return Messages.get(this, "desc", level, dispTurns(visualcooldown())); } private static final String LEVEL = "level"; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Bless.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Bless.java index 668d47802..20c95d52c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Bless.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Bless.java @@ -38,10 +38,10 @@ public class Bless extends FlavourBuff { public int icon() { return BuffIndicator.BLESS; } - + @Override - public void tintIcon(Image icon) { - greyIcon(icon, 5f, cooldown()); + public float iconFadePercent() { + return Math.max(0, (DURATION - visualcooldown()) / DURATION); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/BlobImmunity.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/BlobImmunity.java index 6e46db760..2ce11b484 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/BlobImmunity.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/BlobImmunity.java @@ -52,10 +52,10 @@ public class BlobImmunity extends FlavourBuff { public int icon() { return BuffIndicator.IMMUNITY; } - + @Override - public void tintIcon(Image icon) { - greyIcon(icon, 5f, cooldown()); + public float iconFadePercent() { + return Math.max(0, (DURATION - visualcooldown()) / DURATION); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Buff.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Buff.java index 7f5b3cc2b..57761cba9 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Buff.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Buff.java @@ -89,11 +89,18 @@ public class Buff extends Actor { public int icon() { return BuffIndicator.NONE; } - + + //some buffs may want to tint the base texture color of their icon public void tintIcon( Image icon ){ //do nothing by default } + //percent (0-1) to fade out out the buff icon, usually if buff is expiring + public float iconFadePercent(){ + return 0; + } + + //visual effect usually attached to the sprite of the character the buff is attacked to public void fx(boolean on) { //do nothing by default } @@ -111,6 +118,11 @@ public class Buff extends Actor { return new DecimalFormat("#.##").format(input); } + //buffs act after the hero, so it is often useful to use cooldown+1 when display buff time remaining + public float visualcooldown(){ + return cooldown()+1f; + } + //creates a fresh instance of the buff and attaches that, this allows duplication. public static T append( Char target, Class buffClass ) { T buff = Reflection.newInstance(buffClass); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java index 4c945e2f5..9f1102bef 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java @@ -147,6 +147,7 @@ public class Burning extends Buff implements Hero.Doom { spend( TICK ); left -= TICK; + BuffIndicator.refreshHero(); if (left <= 0 || (Dungeon.level.water[target.pos] && !target.flying)) { @@ -170,6 +171,11 @@ public class Burning extends Buff implements Hero.Doom { return BuffIndicator.FIRE; } + @Override + public float iconFadePercent() { + return Math.max(0, (DURATION - left) / DURATION); + } + @Override public void fx(boolean on) { if (on) target.sprite.add(CharSprite.State.BURNING); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Drowsy.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Drowsy.java index 0fd42282c..5f414c194 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Drowsy.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Drowsy.java @@ -62,6 +62,6 @@ public class Drowsy extends Buff { @Override public String desc() { - return Messages.get(this, "desc", dispTurns(cooldown()+1)); + return Messages.get(this, "desc", dispTurns(visualcooldown())); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/EarthImbue.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/EarthImbue.java index 6ad66eec0..3372bf33c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/EarthImbue.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/EarthImbue.java @@ -47,10 +47,10 @@ public class EarthImbue extends FlavourBuff { public int icon() { return BuffIndicator.ROOTS; } - + @Override - public void tintIcon(Image icon) { - greyIcon(icon, 5f, cooldown()); + public float iconFadePercent() { + return Math.max(0, (DURATION - visualcooldown()) / DURATION); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/FireImbue.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/FireImbue.java index 152c6605d..2aee17942 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/FireImbue.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/FireImbue.java @@ -91,10 +91,10 @@ public class FireImbue extends Buff { public int icon() { return BuffIndicator.FIRE; } - + @Override - public void tintIcon(Image icon) { - FlavourBuff.greyIcon(icon, 5f, left); + public float iconFadePercent() { + return Math.max(0, (DURATION - left+1) / DURATION); } @Override 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 e03be0ea2..f38ff16a4 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 @@ -42,7 +42,6 @@ public class FlavourBuff extends Buff { //flavour buffs can all just rely on cooldown() protected String dispTurns() { - //add one turn as buffs act last, we want them to end at 1 visually, even if they end at 0 internally. - return dispTurns(cooldown()+1f); + return dispTurns(visualcooldown()); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/FrostImbue.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/FrostImbue.java index a6ab59937..895711f14 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/FrostImbue.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/FrostImbue.java @@ -45,10 +45,10 @@ public class FrostImbue extends FlavourBuff { public int icon() { return BuffIndicator.FROST; } - + @Override - public void tintIcon(Image icon) { - greyIcon(icon, 5f, cooldown()); + public float iconFadePercent() { + return Math.max(0, (DURATION - visualcooldown()) / DURATION); } @Override 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 8145d795f..0dacf2626 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 @@ -37,11 +37,10 @@ public class Haste extends FlavourBuff { public int icon() { return BuffIndicator.MOMENTUM; } - + @Override - public void tintIcon(Image icon) { - icon.tint(1, 1, 0, 0.5f); - if (cooldown() < 5f) greyIcon(icon, 5f, cooldown()); + public float iconFadePercent() { + return Math.max(0, (DURATION - visualcooldown()) / DURATION); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Invisibility.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Invisibility.java index df2dc6e78..b6e76be21 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Invisibility.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Invisibility.java @@ -66,10 +66,10 @@ public class Invisibility extends FlavourBuff { public int icon() { return BuffIndicator.INVISIBLE; } - + @Override - public void tintIcon(Image icon) { - greyIcon(icon, 5f, cooldown()); + public float iconFadePercent() { + return Math.max(0, (DURATION - visualcooldown()) / DURATION); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Levitation.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Levitation.java index d0e271038..7f6d70b0e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Levitation.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Levitation.java @@ -58,10 +58,10 @@ public class Levitation extends FlavourBuff { public int icon() { return BuffIndicator.LEVITATION; } - + @Override - public void tintIcon(Image icon) { - greyIcon(icon, 5f, cooldown()); + public float iconFadePercent() { + return Math.max(0, (DURATION - visualcooldown()) / DURATION); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Light.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Light.java index 6ae163667..69c328df0 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Light.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Light.java @@ -67,8 +67,8 @@ public class Light extends FlavourBuff { } @Override - public void tintIcon(Image icon) { - greyIcon(icon, 20f, cooldown()); + public float iconFadePercent() { + return Math.max(0, (DURATION - visualcooldown()) / DURATION); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MagicalSight.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MagicalSight.java index 9571477e5..b94058791 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MagicalSight.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MagicalSight.java @@ -42,10 +42,10 @@ public class MagicalSight extends FlavourBuff { public int icon() { return BuffIndicator.MIND_VISION; } - + @Override - public void tintIcon(Image icon) { - greyIcon(icon, 5f, cooldown()); + public float iconFadePercent() { + return Math.max(0, (DURATION - visualcooldown()) / DURATION); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MindVision.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MindVision.java index 73fa9a4cd..39c1b5f2b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MindVision.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MindVision.java @@ -42,10 +42,10 @@ public class MindVision extends FlavourBuff { public int icon() { return BuffIndicator.MIND_VISION; } - + @Override - public void tintIcon(Image icon) { - greyIcon(icon, 5f, cooldown()); + public float iconFadePercent() { + return Math.max(0, (DURATION - visualcooldown()) / DURATION); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Recharging.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Recharging.java index c5f1cf41c..b558b30d6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Recharging.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Recharging.java @@ -26,7 +26,9 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; import com.watabou.noosa.Image; public class Recharging extends FlavourBuff { - + + public static final float DURATION = 30f; + { type = buffType.POSITIVE; } @@ -35,10 +37,10 @@ public class Recharging extends FlavourBuff { public int icon() { return BuffIndicator.RECHARGING; } - + @Override - public void tintIcon(Image icon) { - FlavourBuff.greyIcon(icon, 5f, cooldown()); + public float iconFadePercent() { + return Math.max(0, (DURATION - visualcooldown()) / DURATION); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Shadows.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Shadows.java index bb513c727..8176598a9 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Shadows.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Shadows.java @@ -98,10 +98,10 @@ public class Shadows extends Invisibility { public int icon() { return BuffIndicator.SHADOWS; } - + @Override - public void tintIcon(Image icon) { - icon.resetColor(); + public float iconFadePercent() { + return 0; } @Override 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 13978c8f4..eb525f832 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 @@ -26,6 +26,8 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; import com.watabou.noosa.Image; public class Stamina extends FlavourBuff { + + public static final float DURATION = 100f; { type = buffType.POSITIVE; @@ -35,11 +37,10 @@ public class Stamina extends FlavourBuff { public int icon() { return BuffIndicator.MOMENTUM; } - + @Override - public void tintIcon(Image icon) { - icon.tint(1, 1, 0, 0.5f); - if (cooldown() < 5f) greyIcon(icon, 5f, cooldown()); + public float iconFadePercent() { + return Math.max(0, (DURATION - visualcooldown()) / DURATION); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ToxicImbue.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ToxicImbue.java index 186505e33..3a6fd29bb 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ToxicImbue.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ToxicImbue.java @@ -78,10 +78,10 @@ public class ToxicImbue extends Buff { public int icon() { return BuffIndicator.IMMUNITY; } - + @Override - public void tintIcon(Image icon) { - FlavourBuff.greyIcon(icon, 5f, left); + public float iconFadePercent() { + return Math.max(0, (DURATION - left) / DURATION); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index 6ad2b2c5c..2c8d83768 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -1341,7 +1341,7 @@ public class Hero extends Char { defenseSkill++; } else { - Buff.prolong(this, Bless.class, 30f); + Buff.prolong(this, Bless.class, Bless.DURATION); this.exp = 0; GLog.newLine(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/RogueArmor.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/RogueArmor.java index bc756b0c5..87371c3cb 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/RogueArmor.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/RogueArmor.java @@ -78,7 +78,7 @@ public class RogueArmor extends ClassArmor { mob.sprite.emitter().burst( Speck.factory( Speck.LIGHT ), 4 ); } } - Buff.affect(curUser, Invisibility.class, 10f); + Buff.affect(curUser, Invisibility.class, Invisibility.DURATION/2f); CellEmitter.get( curUser.pos ).burst( Speck.factory( Speck.WOOL ), 10 ); ScrollOfTeleportation.appear( curUser, target ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfAquaticRejuvenation.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfAquaticRejuvenation.java index f668dd918..5a60cfe21 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfAquaticRejuvenation.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfAquaticRejuvenation.java @@ -81,15 +81,13 @@ public class ElixirOfAquaticRejuvenation extends Elixir { target.HP += healAmt; left -= healAmt; target.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 ); + BuffIndicator.refreshHero(); } if (left <= 0){ detach(); } else { spend(TICK); - if (left <= target.HT/4f){ - BuffIndicator.refreshHero(); - } } return true; } @@ -98,10 +96,16 @@ public class ElixirOfAquaticRejuvenation extends Elixir { public int icon() { return BuffIndicator.HEALING; } - + @Override public void tintIcon(Image icon) { - FlavourBuff.greyIcon(icon, target.HT/4f, left); + icon.hardlight(0, 1, 1); + } + + @Override + public float iconFadePercent() { + float max = Math.round(target.HT * 1.5f); + return Math.max(0, (max - left) / max); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfHolyFuror.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfHolyFuror.java index 2045c4170..fde37a23d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfHolyFuror.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfHolyFuror.java @@ -34,7 +34,7 @@ public class PotionOfHolyFuror extends ExoticPotion { @Override public void apply( Hero hero ) { setKnown(); - Buff.prolong(hero, Bless.class, 100f); + Buff.prolong(hero, Bless.class, Bless.DURATION*4f); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfStamina.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfStamina.java index 300a3bf32..8e80d08e4 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfStamina.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfStamina.java @@ -35,7 +35,7 @@ public class PotionOfStamina extends ExoticPotion { public void apply(Hero hero) { setKnown(); - Buff.affect(hero, Stamina.class, 100f); + Buff.affect(hero, Stamina.class, Stamina.DURATION); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRecharging.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRecharging.java index 3a1bf11c8..16aab2116 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRecharging.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRecharging.java @@ -35,8 +35,6 @@ import com.watabou.noosa.audio.Sample; public class ScrollOfRecharging extends Scroll { - public static final float BUFF_DURATION = 30f; - { initials = 6; } @@ -44,7 +42,7 @@ public class ScrollOfRecharging extends Scroll { @Override public void doRead() { - Buff.affect(curUser, Recharging.class, BUFF_DURATION); + Buff.affect(curUser, Recharging.class, Recharging.DURATION); charge(curUser); Sample.INSTANCE.play( Assets.SND_READ ); @@ -60,7 +58,7 @@ public class ScrollOfRecharging extends Scroll { @Override public void empoweredRead() { doRead(); - Buff.append(curUser, Recharging.class, BUFF_DURATION/3f); + Buff.append(curUser, Recharging.class, Recharging.DURATION/3f); } public static void charge( Char user ) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java index 8046dabe6..f412441fb 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java @@ -264,7 +264,7 @@ public class CursedWand { //shock and recharge case 3: new ShockingTrap().set( user.pos ).activate(); - Buff.prolong(user, Recharging.class, 20f); + Buff.prolong(user, Recharging.class, Recharging.DURATION); ScrollOfRecharging.charge(user); SpellSprite.show(user, SpellSprite.CHARGE); afterZap.call(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/HolyDart.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/HolyDart.java index 1448ff9d3..b5bd56733 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/HolyDart.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/HolyDart.java @@ -35,7 +35,7 @@ public class HolyDart extends TippedDart { @Override public int proc(Char attacker, Char defender, int damage) { - Buff.affect(defender, Bless.class, 20f); + Buff.affect(defender, Bless.class, Bless.DURATION); if (attacker.alignment == defender.alignment){ return 0; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Blindweed.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Blindweed.java index 8a755fa84..213a02ed2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Blindweed.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Blindweed.java @@ -46,7 +46,7 @@ public class Blindweed extends Plant { if (ch != null) { if (ch instanceof Hero && ((Hero) ch).subClass == HeroSubClass.WARDEN){ - Buff.affect(ch, Invisibility.class, 10f); + Buff.affect(ch, Invisibility.class, Invisibility.DURATION/2f); } else { int len = Random.Int(5, 10); Buff.prolong(ch, Blindness.class, len); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Dreamfoil.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Dreamfoil.java index 30833e2f0..5cee0069c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Dreamfoil.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Dreamfoil.java @@ -50,7 +50,7 @@ public class Dreamfoil extends Plant { PotionOfHealing.cure(ch); if (((Hero) ch).subClass == HeroSubClass.WARDEN){ - Buff.affect(ch, BlobImmunity.class, 10f); + Buff.affect(ch, BlobImmunity.class, BlobImmunity.DURATION/2f); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Earthroot.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Earthroot.java index 81aa6db85..bd40a5f58 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Earthroot.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Earthroot.java @@ -124,10 +124,10 @@ public class Earthroot extends Plant { public int icon() { return BuffIndicator.ARMOR; } - + @Override - public void tintIcon(Image icon) { - FlavourBuff.greyIcon(icon, target.HT/4f, level); + public float iconFadePercent() { + return Math.max(0, (target.HT - level) / target.HT); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Firebloom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Firebloom.java index 5a230808c..95afd4515 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Firebloom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Firebloom.java @@ -44,7 +44,7 @@ public class Firebloom extends Plant { public void activate( Char ch ) { if (ch instanceof Hero && ((Hero) ch).subClass == HeroSubClass.WARDEN){ - Buff.affect(ch, FireImbue.class).set(15f); + Buff.affect(ch, FireImbue.class).set( FireImbue.DURATION*0.3f ); } GameScene.add( Blob.seed( pos, 2, Fire.class ) ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Icecap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Icecap.java index 383a5ac07..0146fc5af 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Icecap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Icecap.java @@ -43,7 +43,7 @@ public class Icecap extends Plant { public void activate( Char ch ) { if (ch instanceof Hero && ((Hero) ch).subClass == HeroSubClass.WARDEN){ - Buff.affect(ch, FrostImbue.class, 15f); + Buff.affect(ch, FrostImbue.class, FrostImbue.DURATION*0.3f); } PathFinder.buildDistanceMap( pos, BArray.not( Dungeon.level.losBlocking, null ), 1 ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Sorrowmoss.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Sorrowmoss.java index d14b30899..5648f0567 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Sorrowmoss.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Sorrowmoss.java @@ -41,7 +41,7 @@ public class Sorrowmoss extends Plant { @Override public void activate( Char ch ) { if (ch instanceof Hero && ((Hero) ch).subClass == HeroSubClass.WARDEN){ - Buff.affect(ch, ToxicImbue.class).set(15f); + Buff.affect(ch, ToxicImbue.class).set(ToxicImbue.DURATION*0.3f); } if (ch != null) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Starflower.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Starflower.java index 7731bc484..2ef3aef84 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Starflower.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Starflower.java @@ -43,7 +43,7 @@ public class Starflower extends Plant { if (ch != null) { Buff.prolong(ch, Bless.class, Bless.DURATION); if (ch instanceof Hero && ((Hero) ch).subClass == HeroSubClass.WARDEN){ - Buff.prolong(ch, Recharging.class, Bless.DURATION); + Buff.prolong(ch, Recharging.class, Recharging.DURATION); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Stormvine.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Stormvine.java index f6fb9331f..e328da00b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Stormvine.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Stormvine.java @@ -40,7 +40,7 @@ public class Stormvine extends Plant { if (ch != null) { if (ch instanceof Hero && ((Hero) ch).subClass == HeroSubClass.WARDEN){ - Buff.affect(ch, Levitation.class, 10f); + Buff.affect(ch, Levitation.class, Levitation.DURATION/2f); } else { Buff.affect(ch, Vertigo.class, Vertigo.DURATION); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Sungrass.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Sungrass.java index 6377b05db..1681294fa 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Sungrass.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Sungrass.java @@ -123,10 +123,10 @@ public class Sungrass extends Plant { public int icon() { return BuffIndicator.HERB_HEALING; } - + @Override - public void tintIcon(Image icon) { - FlavourBuff.greyIcon(icon, target.HT/4f, level); + public float iconFadePercent() { + return Math.max(0, (target.HT - level) / target.HT); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Swiftthistle.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Swiftthistle.java index ff6dbb989..9ce6e7fbf 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Swiftthistle.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Swiftthistle.java @@ -78,10 +78,10 @@ public class Swiftthistle extends Plant { public int icon() { return BuffIndicator.SLOW; } - + @Override - public void tintIcon(Image icon) { - FlavourBuff.greyIcon(icon, 5f, left); + public float iconFadePercent() { + return Math.max(0, (6f - left) / 6f); } public void reset(){ 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 694781561..b2b9537e6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java @@ -197,6 +197,7 @@ public class BuffIndicator extends Component { private Buff buff; public Image icon; + public Image grey; public BuffIcon( Buff buff ){ super(); @@ -205,18 +206,24 @@ public class BuffIndicator extends Component { icon = new Image( texture ); icon.frame( film.get( buff.icon() ) ); add( icon ); + + grey = new Image( TextureCache.createSolid(0xCC808080)); + add( grey ); } public void updateIcon(){ icon.frame( film.get( buff.icon() ) ); buff.tintIcon(icon); + //logic here rounds down to the nearest pixel + float zoom = (camera() != null) ? camera().zoom : 1; + grey.scale.set( icon.width(), (float)Math.floor(zoom*icon.height()*buff.iconFadePercent())/zoom); } @Override protected void layout() { super.layout(); - icon.x = this.x+1; - icon.y = this.y+2; + grey.x = icon.x = this.x+1; + grey.y = icon.y = this.y+2; } @Override