v0.9.3: fixed wand of regrowth and fireblast using more than 3 charges in some cases

This commit is contained in:
Evan Debenham 2021-05-06 14:33:53 -04:00
parent 6530f0401a
commit b2ee5f5ac1
2 changed files with 6 additions and 4 deletions

View File

@ -43,6 +43,7 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Callback;
import com.watabou.utils.GameMath;
import com.watabou.utils.PathFinder;
import java.util.ArrayList;
@ -171,8 +172,8 @@ public class WandOfFireblast extends DamageWand {
@Override
protected int chargesPerCast() {
//consumes 30% of current charges, rounded up, with a minimum of one.
return Math.max(1, (int)Math.ceil(curCharges*0.3f));
//consumes 30% of current charges, rounded up, with a min of 1 and a max of 3.
return (int) GameMath.gate(1, (int)Math.ceil(curCharges*0.3f), 3);
}
@Override

View File

@ -49,6 +49,7 @@ import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle;
import com.watabou.utils.Callback;
import com.watabou.utils.ColorMath;
import com.watabou.utils.GameMath;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
@ -262,8 +263,8 @@ public class WandOfRegrowth extends Wand {
@Override
protected int chargesPerCast() {
//consumes 30% of current charges, rounded up, with a minimum of one.
return Math.max(1, (int)Math.ceil(curCharges*0.3f));
//consumes 30% of current charges, rounded up, with a min of 1 and a max of 3.
return (int)GameMath.gate(1, (int)Math.ceil(curCharges*0.3f), 3);
}
@Override