diff --git a/core/src/main/assets/messages/actors/actors.properties b/core/src/main/assets/messages/actors/actors.properties index e166634ec..9c5039567 100644 --- a/core/src/main/assets/messages/actors/actors.properties +++ b/core/src/main/assets/messages/actors/actors.properties @@ -63,7 +63,7 @@ actors.buffs.barkskin.name=Barkskin actors.buffs.barkskin.desc=Your skin is hardened, it feels rough and solid like bark.\n\nThe hardened skin increases your effective armor, allowing you to better defend against physical attack.\n\nYour armor is currently increased by: %d.\nTurns until barkskin weakens: %s. actors.buffs.barrier.name=Barrier -actors.buffs.barrier.desc=A durable bubble of force which blocks all damage.\n\nThe barrier will take damage for whatever it is protecting so long as there is shielding left. The shielding will also decay at a rate of 1 per turn.\n\nShielding remaining: %d. +actors.buffs.barrier.desc=A durable bubble of force which blocks all damage.\n\nThe barrier will take damage for whatever it is protecting so long as there is shielding left. The shielding will also slowly decay over time.\n\nShielding remaining: %d. actors.buffs.berserk.angered=Angered actors.buffs.berserk.berserk=Berserking diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Barrier.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Barrier.java index 9ecd8185b..2ea33d72e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Barrier.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Barrier.java @@ -25,17 +25,25 @@ import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; import com.watabou.noosa.Image; +import com.watabou.utils.Bundle; public class Barrier extends ShieldBuff { { type = buffType.POSITIVE; } + + float partialLostShield; @Override public boolean act() { - - absorbDamage(1); + + partialLostShield += Math.min(1f, shielding()/20f); + + if (partialLostShield >= 1f) { + absorbDamage(1); + partialLostShield = 0; + } if (shielding() <= 0){ detach(); @@ -71,4 +79,18 @@ public class Barrier extends ShieldBuff { public String desc() { return Messages.get(this, "desc", shielding()); } + + private static final String PARTIAL_LOST_SHIELD = "partial_lost_shield"; + + @Override + public void storeInBundle(Bundle bundle) { + super.storeInBundle(bundle); + bundle.put(PARTIAL_LOST_SHIELD, partialLostShield); + } + + @Override + public void restoreFromBundle(Bundle bundle) { + super.restoreFromBundle(bundle); + partialLostShield = bundle.getFloat(PARTIAL_LOST_SHIELD); + } }