v0.6.1: fixed healing buff not remembering its state

This commit is contained in:
Evan Debenham 2017-06-18 21:03:55 -04:00
parent ca65af576e
commit a68dc6dbc2

View File

@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.watabou.utils.Bundle;
import com.watabou.utils.GameMath;
public class Healing extends Buff {
@ -47,7 +48,7 @@ public class Healing extends Buff {
healingLeft -= healingThisTick;
if (healingLeft == 0){
if (healingLeft <= 0){
detach();
}
@ -72,4 +73,23 @@ public class Healing extends Buff {
else if (target.invisible == 0) target.sprite.remove( CharSprite.State.HEALING );
}
private static final String LEFT = "left";
private static final String PERCENT = "percent";
private static final String FLAT = "flat";
@Override
public void storeInBundle(Bundle bundle) {
super.storeInBundle(bundle);
bundle.put(LEFT, healingLeft);
bundle.put(PERCENT, percentHealPerTick);
bundle.put(FLAT, flatHealPerTick);
}
@Override
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
healingLeft = bundle.getInt(LEFT);
percentHealPerTick = bundle.getFloat(PERCENT);
flatHealPerTick = bundle.getInt(FLAT);
}
}