v0.9.1: barrier now decays more slowly at low shielding levels

This commit is contained in:
Evan Debenham 2020-11-02 19:55:32 -05:00
parent eda94b1074
commit 98f5d1cffa
2 changed files with 25 additions and 3 deletions

View File

@ -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

View File

@ -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);
}
}