v2.1.0: fixed consistency errors between hold fast and patient strike

This commit is contained in:
Evan Debenham
2023-05-18 11:43:38 -04:00
parent 965289eba6
commit 11b140e5f3
4 changed files with 37 additions and 5 deletions

View File

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

View File

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

View File

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

View File

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