diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Belongings.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Belongings.java index 84d124c1f..56bec68d3 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Belongings.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Belongings.java @@ -187,6 +187,10 @@ public class Belongings implements Iterable { } } else if (item.unique) { item.detachAll(backpack); + //you keep the bag itself, not its contents. + if (item instanceof Bag){ + ((Bag)item).clear(); + } item.collect(); } else if (!item.isEquipped( owner )) { item.detachAll( backpack ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java index 25bd5b26c..6f0ecf53e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java @@ -643,6 +643,9 @@ public abstract class Mob extends Char { enemySeen = enemyInFOV; if (enemyInFOV) { target = enemy.pos; + //loses target when 0-dist rolls a 6 or greater. + } else if (1 + Random.Int(Level.distance(pos, target)) >= 6){ + target = -1; } int oldPos = pos; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Thief.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Thief.java index ed91dd61a..53f4923d1 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Thief.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Thief.java @@ -134,7 +134,8 @@ public class Thief extends Mob { protected boolean steal( Hero hero ) { Item item = hero.belongings.randomUnequipped(); - if (item != null) { + + if (item != null && !item.unique ) { GLog.w( TXT_STOLE, this.name, item.name() ); Dungeon.quickslot.clearItem( item ); @@ -144,10 +145,9 @@ public class Thief extends Mob { this.item = ((Honeypot)item).shatter(this, this.pos); item.detach( hero.belongings.backpack ); } else { - this.item = item; + this.item = item.detach( hero.belongings.backpack ); if ( item instanceof Honeypot.ShatteredPot) ((Honeypot.ShatteredPot)item).setHolder(this); - item.detachAll( hero.belongings.backpack ); } return true; @@ -174,8 +174,14 @@ public class Thief extends Mob { @Override protected void nowhereToRun() { if (buff( Terror.class ) == null) { - sprite.showStatus( CharSprite.NEGATIVE, TXT_RAGE ); - state = HUNTING; + if (enemySeen) { + sprite.showStatus(CharSprite.NEGATIVE, TXT_RAGE); + state = HUNTING; + } else { + GLog.n("The thief gets away with your " + item.name() + "!"); + item = null; + state = WANDERING; + } } else { super.nowhereToRun(); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/bags/Bag.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/bags/Bag.java index afe0c8346..cb7be41e2 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/bags/Bag.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/bags/Bag.java @@ -41,6 +41,8 @@ public class Bag extends Item implements Iterable { image = 11; defaultAction = AC_OPEN; + + unique = true; } public Char owner;