v0.6.1: improved quickslot interactions with thieves and monks
This commit is contained in:
parent
0588036643
commit
caf6f5ca50
|
@ -85,9 +85,9 @@ public class QuickSlot {
|
|||
return getSlot(item) != -1;
|
||||
}
|
||||
|
||||
public void replaceSimilar(Item item){
|
||||
public void replacePlaceholder(Item item){
|
||||
for (int i = 0; i < SIZE; i++)
|
||||
if (getItem(i) != null && item.isSimilar(getItem(i)))
|
||||
if (isPlaceholder(i) && item.isSimilar(getItem(i)))
|
||||
setSlot( i , item );
|
||||
}
|
||||
|
||||
|
|
|
@ -139,6 +139,17 @@ public class Belongings implements Iterable<Item> {
|
|||
return null;
|
||||
}
|
||||
|
||||
public Item getSimilar( Item similar ){
|
||||
|
||||
for (Item item : this) {
|
||||
if (item.isSimilar(similar)) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void identify() {
|
||||
for (Item item : this) {
|
||||
item.identify();
|
||||
|
|
|
@ -97,7 +97,7 @@ public class Monk extends Mob {
|
|||
|
||||
if (--hitsToDisarm == 0) {
|
||||
hero.belongings.weapon = null;
|
||||
Dungeon.quickslot.clearItem(weapon);
|
||||
Dungeon.quickslot.convertToPlaceholder(weapon);
|
||||
weapon.updateQuickslot();
|
||||
Dungeon.level.drop(weapon, hero.pos).sprite.drop();
|
||||
GLog.w(Messages.get(this, "disarm", weapon.name()));
|
||||
|
|
|
@ -147,7 +147,9 @@ public class Thief extends Mob {
|
|||
if (item != null && !item.unique && item.level() < 1 ) {
|
||||
|
||||
GLog.w( Messages.get(Thief.class, "stole", item.name()) );
|
||||
Dungeon.quickslot.clearItem( item );
|
||||
if (!item.stackable || hero.belongings.getSimilar(item) == null) {
|
||||
Dungeon.quickslot.convertToPlaceholder(item);
|
||||
}
|
||||
item.updateQuickslot();
|
||||
|
||||
if (item instanceof Honeypot){
|
||||
|
|
|
@ -190,7 +190,7 @@ public class Item implements Bundlable {
|
|||
}
|
||||
|
||||
items.add( this );
|
||||
if (stackable || this instanceof Boomerang) Dungeon.quickslot.replaceSimilar(this);
|
||||
Dungeon.quickslot.replacePlaceholder(this);
|
||||
updateQuickslot();
|
||||
Collections.sort( items, itemComparator );
|
||||
return true;
|
||||
|
|
|
@ -114,7 +114,7 @@ public class Boomerang extends MissileWeapon {
|
|||
if (throwEquiped) {
|
||||
owner.belongings.weapon = this;
|
||||
owner.spend( -TIME_TO_EQUIP );
|
||||
Dungeon.quickslot.replaceSimilar(this);
|
||||
Dungeon.quickslot.replacePlaceholder(this);
|
||||
updateQuickslot();
|
||||
} else
|
||||
if (!collect( curUser.belongings.backpack )) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user