v0.3.4: moved recharging into its own class

This commit is contained in:
Evan Debenham
2015-12-28 04:08:25 -05:00
committed by Evan Debenham
parent 2c0cd939f0
commit b079aad640
9 changed files with 69 additions and 43 deletions
@@ -21,8 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.items.scrolls;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Recharging;
import com.watabou.noosa.audio.Sample;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
@@ -71,36 +70,4 @@ public class ScrollOfRecharging extends Scroll {
public int price() {
return isKnown() ? 40 * quantity : super.price();
}
public static class Recharging extends FlavourBuff {
@Override
public int icon() {
return BuffIndicator.RECHARGING;
}
@Override
public String toString() {
return "Recharging";
}
//want to process partial turns for this buff, and not count it when it's expiring.
//firstly, if this buff has half a turn left, should give out half the benefit.
//secondly, recall that buffs execute in random order, so this can cause a problem where we can't simply check
//if this buff is still attached, must instead directly check its remaining time, and act accordingly.
//otherwise this causes inconsistent behaviour where this may detach before, or after, a wand charger acts.
public float remainder() {
return Math.min(1f, this.cooldown());
}
@Override
public String desc() {
return "Energy is coursing through you, improving the rate that your wands and staffs charge.\n" +
"\n" +
"Each turn this buff will increase current charge by one quarter, in addition to regular recharge. \n" +
"\n" +
"The recharging will last for " + dispTurns() + ".";
}
}
}