v0.6.1: fixed healing buff not remembering its state
This commit is contained in:
parent
ca65af576e
commit
a68dc6dbc2
|
@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||||
|
import com.watabou.utils.Bundle;
|
||||||
import com.watabou.utils.GameMath;
|
import com.watabou.utils.GameMath;
|
||||||
|
|
||||||
public class Healing extends Buff {
|
public class Healing extends Buff {
|
||||||
|
@ -47,7 +48,7 @@ public class Healing extends Buff {
|
||||||
|
|
||||||
healingLeft -= healingThisTick;
|
healingLeft -= healingThisTick;
|
||||||
|
|
||||||
if (healingLeft == 0){
|
if (healingLeft <= 0){
|
||||||
detach();
|
detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,4 +73,23 @@ public class Healing extends Buff {
|
||||||
else if (target.invisible == 0) target.sprite.remove( CharSprite.State.HEALING );
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user