v0.3.2: tweaked fleeing to cancel at a certain distance, tweaked thieves to destroy their stolen item after escaping, tweaked bags to be kept (empty) on ressurect

This commit is contained in:
Evan Debenham 2015-10-30 17:27:44 -04:00
parent d829e63f19
commit 303a6ddc5b
4 changed files with 20 additions and 5 deletions

View File

@ -187,6 +187,10 @@ public class Belongings implements Iterable<Item> {
}
} 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 );

View File

@ -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;

View File

@ -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();
}

View File

@ -41,6 +41,8 @@ public class Bag extends Item implements Iterable<Item> {
image = 11;
defaultAction = AC_OPEN;
unique = true;
}
public Char owner;