v1.2.2: fixed wild magic processing very quickly with some wands

This commit is contained in:
Evan Debenham 2022-04-04 17:02:37 -04:00
parent 9c8b6d44f5
commit d51fed0f4d

View File

@ -37,6 +37,8 @@ import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.ui.HeroIcon;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.Game;
import com.watabou.noosa.tweeners.Delayer;
import com.watabou.utils.Callback;
import com.watabou.utils.Random;
@ -124,29 +126,48 @@ public class WildMagic extends ArmorAbility {
public static class WildMagicTracker extends FlavourBuff{};
private void zapWand( ArrayList<Wand> wands, Hero hero, int target){
private void zapWand( ArrayList<Wand> wands, Hero hero, int cell){
Wand cur = wands.remove(0);
Ballistica aim = new Ballistica(hero.pos, target, cur.collisionProperties(target));
Ballistica aim = new Ballistica(hero.pos, cell, cur.collisionProperties(cell));
hero.sprite.zap(target);
hero.sprite.zap(cell);
float startTime = Game.timeTotal;
if (!cur.cursed) {
cur.fx(aim, new Callback() {
@Override
public void call() {
cur.onZap(aim);
afterZap(cur, wands, hero, target);
if (Game.timeTotal - startTime < 0.33f){
hero.sprite.parent.add(new Delayer(0.33f - (Game.timeTotal - startTime)) {
@Override
protected void onComplete() {
afterZap(cur, wands, hero, cell);
}
});
} else {
afterZap(cur, wands, hero, cell);
}
}
});
} else {
CursedWand.cursedZap(cur,
hero,
new Ballistica(hero.pos, target, Ballistica.MAGIC_BOLT),
new Ballistica(hero.pos, cell, Ballistica.MAGIC_BOLT),
new Callback() {
@Override
public void call() {
afterZap(cur, wands, hero, target);
if (Game.timeTotal - startTime < 0.33f){
hero.sprite.parent.add(new Delayer(0.33f - (Game.timeTotal - startTime)) {
@Override
protected void onComplete() {
afterZap(cur, wands, hero, cell);
}
});
} else {
afterZap(cur, wands, hero, cell);
}
}
});
}