v0.6.2: fixed a rare crash with cursed wands

This commit is contained in:
Evan Debenham
2017-10-12 16:13:37 -04:00
parent ef058bbb71
commit 2c9156e591
@@ -153,7 +153,10 @@ public class CursedWand {
cursedFX(user, bolt, new Callback() { cursedFX(user, bolt, new Callback() {
public void call() { public void call() {
Char ch = Actor.findChar( bolt.collisionPos ); Char ch = Actor.findChar( bolt.collisionPos );
if (ch != null && !ch.properties().contains(Char.Property.IMMOVABLE)) { if (ch == user){
ScrollOfTeleportation.teleportHero(user);
wand.wandUsed();
} else if (ch != null && !ch.properties().contains(Char.Property.IMMOVABLE)) {
int count = 10; int count = 10;
int pos; int pos;
do { do {
@@ -166,7 +169,7 @@ public class CursedWand {
GLog.w( Messages.get(ScrollOfTeleportation.class, "no_tele") ); GLog.w( Messages.get(ScrollOfTeleportation.class, "no_tele") );
} else { } else {
ch.pos = pos; ch.pos = pos;
if (((Mob) ch).state == ((Mob) ch).HUNTING) ((Mob) ch).state = ((Mob) ch).WANDERING; if (((Mob) ch).state == ((Mob) ch).HUNTING)((Mob) ch).state = ((Mob) ch).WANDERING;
ch.sprite.place(ch.pos); ch.sprite.place(ch.pos);
ch.sprite.visible = Dungeon.level.heroFOV[pos]; ch.sprite.visible = Dungeon.level.heroFOV[pos];
} }