diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/HoldFast.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/HoldFast.java index 4c59e4316..ac8307cd8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/HoldFast.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/HoldFast.java @@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; import com.watabou.noosa.Image; +import com.watabou.utils.Bundle; import com.watabou.utils.Random; public class HoldFast extends Buff { @@ -71,5 +72,17 @@ public class HoldFast extends Buff { return Messages.get(this, "desc", 2*Dungeon.hero.pointsInTalent(Talent.HOLD_FAST)); } + private static final String POS = "pos"; + @Override + public void storeInBundle(Bundle bundle) { + super.storeInBundle(bundle); + bundle.put(POS, pos); + } + + @Override + public void restoreFromBundle(Bundle bundle) { + super.restoreFromBundle(bundle); + pos = bundle.getInt(POS); + } } 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 2ef9efd21..68197df85 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 @@ -1257,7 +1257,7 @@ public class Hero extends Char { Buff.affect(this, HoldFast.class).pos = pos; } if (hasTalent(Talent.PATIENT_STRIKE)){ - Buff.prolong(this, Talent.PatientStrikeTracker.class, cooldown()); + Buff.affect(Dungeon.hero, Talent.PatientStrikeTracker.class).pos = Dungeon.hero.pos; } if (!fullRest) { if (sprite != null) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Talent.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Talent.java index 1b488f520..7a46c75d4 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Talent.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Talent.java @@ -231,12 +231,31 @@ public enum Talent { public float iconFadePercent() { return Math.max(0, visualcooldown() / 20); } }; public static class SpiritBladesTracker extends FlavourBuff{}; - public static class PatientStrikeTracker extends FlavourBuff { + public static class PatientStrikeTracker extends Buff { + public int pos; { type = Buff.buffType.POSITIVE; } public int icon() { return BuffIndicator.TIME; } public void tintIcon(Image icon) { icon.hardlight(0.5f, 0f, 1f); } - public String iconTextDisplay() { return ""; } - public float iconFadePercent() { return 0; } + @Override + public boolean act() { + if (pos != target.pos) { + detach(); + } else { + spend(TICK); + } + return true; + } + private static final String POS = "pos"; + @Override + public void storeInBundle(Bundle bundle) { + super.storeInBundle(bundle); + bundle.put(POS, pos); + } + @Override + public void restoreFromBundle(Bundle bundle) { + super.restoreFromBundle(bundle); + pos = bundle.getInt(POS); + } }; public static class AggressiveBarrierCooldown extends FlavourBuff{ public int icon() { return BuffIndicator.TIME; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java index 944846147..7fa13ac47 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java @@ -260,7 +260,7 @@ public class Toolbar extends Component { Buff.affect(Dungeon.hero, HoldFast.class).pos = Dungeon.hero.pos; } if (Dungeon.hero.hasTalent(Talent.PATIENT_STRIKE)){ - Buff.prolong(Dungeon.hero, Talent.PatientStrikeTracker.class, Dungeon.hero.cooldown()); + Buff.affect(Dungeon.hero, Talent.PatientStrikeTracker.class).pos = Dungeon.hero.pos; } Dungeon.hero.next(); } else {