diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/mage/WildMagic.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/mage/WildMagic.java index 7a31b49a6..c91155733 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/mage/WildMagic.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/mage/WildMagic.java @@ -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 wands, Hero hero, int target){ + private void zapWand( ArrayList 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); + } } }); }