diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/MagicMissile.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/MagicMissile.java index 1219358da..e8ff89c08 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/MagicMissile.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/MagicMissile.java @@ -165,7 +165,7 @@ public class MagicMissile extends Emitter { public static void boltFromChar(Group group, int type, Visual sprite, int to, Callback callback){ MagicMissile missile = ((MagicMissile)group.recycle( MagicMissile.class )); if (Actor.findChar(to) != null){ - missile.reset(type, sprite, Actor.findChar(to).sprite, callback); + missile.reset(type, sprite.center(), Actor.findChar(to).sprite.destinationCenter(), callback); } else { missile.reset(type, sprite, to, callback); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java index 12781be59..6eef9f337 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java @@ -91,7 +91,7 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip protected Callback animCallback; - protected Tweener motion; + protected PosTweener motion; protected Emitter burning; protected Emitter chilled; @@ -200,6 +200,15 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip } + //returns where the center of this sprite will be after it completes any motion in progress + public PointF destinationCenter(){ + if (motion != null){ + return new PointF(motion.end.x + width()/2f, motion.end.y + height()/2f); + } else { + return center(); + } + } + public void interruptMotion() { if (motion != null) { motion.stop(false); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ShamanSprite.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ShamanSprite.java index f78bd2be4..a0f34d31b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ShamanSprite.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ShamanSprite.java @@ -22,6 +22,8 @@ package com.shatteredpixel.shatteredpixeldungeon.sprites; import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Shaman; import com.shatteredpixel.shatteredpixeldungeon.effects.Lightning; import com.watabou.noosa.TextureFilm; @@ -54,7 +56,13 @@ public class ShamanSprite extends MobSprite { public void zap( int pos ) { - parent.add( new Lightning( ch.pos, pos, (Shaman)ch ) ); + Char enemy = Actor.findChar(pos); + + if (enemy != null) { + parent.add(new Lightning(center(), enemy.sprite.destinationCenter(), (Shaman) ch)); + } else { + parent.add(new Lightning(center(), pos, (Shaman) ch)); + } turnTo( ch.pos, pos ); play( zap );