public boolean contains( Item item ) { for (Item i : items) { if (i == item) { return true; } else if (i instanceof Bag && ((Bag)i).contains( item )) { return true; } } return false; }
@Override public Iterator<Item> iterator() { return new ItemIterator(); }
@Override public Item next() { if (nested != null && nested.hasNext()) { return nested.next(); } else { nested = null; Item item = items.get( index++ ); if (item instanceof Bag) { nested = ((Bag)item).iterator(); } return item; } }
case 0: default: Dungeon.LimitedDrops.VELVET_POUCH.drop(); return new VelvetPouch(); case 1: Dungeon.LimitedDrops.SCROLL_HOLDER.drop(); return new ScrollHolder(); case 2: Dungeon.LimitedDrops.POTION_BANDOLIER.drop(); return new PotionBandolier(); case 3: Dungeon.LimitedDrops.MAGICAL_HOLSTER.drop(); return new MagicalHolster();
public void storeInBundle( Bundle bundle ) { backpack.storeInBundle( bundle ); bundle.put( WEAPON, weapon ); bundle.put( ARMOR, armor ); bundle.put( MISC1, misc1); bundle.put( MISC2, misc2); }
@Override public void onDetach( ) { this.owner = null; for (Item item : items) Dungeon.quickslot.clearItem(item); updateQuickslot(); }
@Override public void onDetach( ) { super.onDetach(); for (Item item : items) { if (item instanceof Wand) { ((Wand)item).stopCharging(); } else if (item instanceof MissileWeapon){ ((MissileWeapon) item).holster = false; } } }
@Override public boolean collect( Bag container ) { if (super.collect( container )) { if (owner != null) { for (Item item : items) { if (item instanceof Wand) { ((Wand) item).charge(owner, HOLSTER_SCALE_FACTOR); } else if (item instanceof MissileWeapon){ ((MissileWeapon) item).holster = true; } } } return true; } else { return false; } }
case 0: default: Dungeon.LimitedDrops.VELVET_POUCH.drop(); return new VelvetPouch(); case 1: Dungeon.LimitedDrops.SCROLL_HOLDER.drop(); return new ScrollHolder(); case 2: Dungeon.LimitedDrops.POTION_BANDOLIER.drop(); return new PotionBandolier(); case 3: Dungeon.LimitedDrops.MAGICAL_HOLSTER.drop(); return new MagicalHolster();
public boolean contains( Item item ) { for (Item i : items) { if (i == item) { return true; } else if (i instanceof Bag && ((Bag)i).contains( item )) { return true; } } return false; }
@Override public Iterator<Item> iterator() { return new ItemIterator(); }
public void storeInBundle( Bundle bundle ) { backpack.storeInBundle( bundle ); bundle.put( WEAPON, weapon ); bundle.put( ARMOR, armor ); bundle.put( MISC1, misc1); bundle.put( MISC2, misc2); }
@Override public void onDetach( ) { this.owner = null; for (Item item : items) Dungeon.quickslot.clearItem(item); updateQuickslot(); }
@Override public void onDetach( ) { super.onDetach(); for (Item item : items) { if (item instanceof Wand) { ((Wand)item).stopCharging(); } else if (item instanceof MissileWeapon){ ((MissileWeapon) item).holster = false; } } }
@Override public boolean collect( Bag container ) { if (super.collect( container )) { if (owner != null) { for (Item item : items) { if (item instanceof Wand) { ((Wand) item).charge(owner, HOLSTER_SCALE_FACTOR); } else if (item instanceof MissileWeapon){ ((MissileWeapon) item).holster = true; } } } return true; } else { return false; } }
@Override public Item next() { if (nested != null && nested.hasNext()) { return nested.next(); } else { nested = null; Item item = items.get( index++ ); if (item instanceof Bag) { nested = ((Bag)item).iterator(); } return item; } }
public static WndBag lastBag( Listener listener, Mode mode, String title ) { if (mode == lastMode && lastBag != null && Dungeon.hero.belongings.backpack.contains( lastBag )) { return new WndBag( lastBag, listener, mode, title ); } else { return new WndBag( Dungeon.hero.belongings.backpack, listener, mode, title ); } }
public static WndBag lastBag( Listener listener, Mode mode, String title ) { if (mode == lastMode && lastBag != null && Dungeon.hero.belongings.backpack.contains( lastBag )) { return new WndBag( lastBag, listener, mode, title ); } else { return new WndBag( Dungeon.hero.belongings.backpack, listener, mode, title ); } }
public final Item detachAll( Bag container ) { Dungeon.quickslot.clearItem( this ); updateQuickslot(); for (Item item : container.items) { if (item == this) { container.items.remove(this); item.onDetach(); return this; } else if (item instanceof Bag) { Bag bag = (Bag)item; if (bag.contains( this )) { return detachAll( bag ); } } } return this; }
public final Item detachAll( Bag container ) { Dungeon.quickslot.clearItem( this ); updateQuickslot(); for (Item item : container.items) { if (item == this) { container.items.remove(this); item.onDetach(); return this; } else if (item instanceof Bag) { Bag bag = (Bag)item; if (bag.contains( this )) { return detachAll( bag ); } } } return this; }