use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
the class WandMaker method interact.
@Override
public boolean interact(final Hero hero) {
getSprite().turnTo(getPos(), hero.getPos());
if (Quest.given) {
Item item = Quest.alternative ? hero.belongings.getItem(CorpseDust.class) : hero.belongings.getItem(Rotberry.Seed.class);
if (item != null) {
GameScene.show(new WndWandmaker(this, item));
} else {
tell(Quest.alternative ? TXT_DUST2 : TXT_BERRY2, hero.className());
}
} else {
tell(Quest.alternative ? TXT_DUST1 : TXT_BERRY1);
Quest.given = true;
Quest.placeItem();
Journal.add(Journal.Feature.WANDMAKER.desc());
}
return true;
}
use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
the class WndTradeItem method buy.
private void buy(Heap heap) {
Hero hero = Dungeon.hero;
Item item = heap.pickUp();
int price = price(item);
Dungeon.gold(Dungeon.gold() - price);
GLog.i(TXT_BOUGHT, item.name(), price);
if (!item.doPickUp(hero)) {
Dungeon.level.drop(item, heap.pos).sprite.drop();
}
Item newItem;
do {
newItem = Generator.random();
} while (newItem instanceof Gold);
placeItemInShop(newItem);
}
use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
the class WndBag method placeItems.
protected void placeItems(Bag container) {
// Equipped items
Belongings stuff = Dungeon.hero.belongings;
placeItem(stuff.weapon != null ? stuff.weapon : new Placeholder(ItemSpriteSheet.WEAPON));
placeItem(stuff.armor != null ? stuff.armor : new Placeholder(ItemSpriteSheet.ARMOR));
placeItem(stuff.ring1 != null ? stuff.ring1 : new Placeholder(ItemSpriteSheet.RING));
placeItem(stuff.ring2 != null ? stuff.ring2 : new Placeholder(ItemSpriteSheet.RING));
// Unequipped items
for (Item item : container.items) {
placeItem(item);
}
// Empty slots
while (count - 4 < container.size) {
placeItem(null);
}
// Gold
if (container == Dungeon.hero.belongings.backpack) {
row = nRows - 1;
col = nCols - 1;
placeItem(new Gold(Dungeon.gold()));
}
}
use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
the class LootIndicator method update.
@Override
public void update() {
if (Dungeon.hero.isReady()) {
Heap heap = Dungeon.level.getHeap(Dungeon.hero.getPos());
if (heap != null) {
Item item = heap.type == Heap.Type.CHEST || heap.type == Heap.Type.MIMIC ? ItemSlot.CHEST : heap.type == Heap.Type.LOCKED_CHEST ? ItemSlot.LOCKED_CHEST : heap.type == Heap.Type.TOMB ? ItemSlot.TOMB : heap.type == Heap.Type.SKELETON ? ItemSlot.SKELETON : heap.peek();
if (item != lastItem || item.quantity() != lastQuantity) {
lastItem = item;
lastQuantity = item.quantity();
slot.item(item);
flash();
}
setVisible(true);
} else {
lastItem = null;
setVisible(false);
}
}
slot.enable(getVisible() && Dungeon.hero.isReady());
super.update();
}
use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
the class QuickSlot method createChildren.
@Override
protected void createChildren() {
super.createChildren();
slot = new ItemSlot() {
@Override
protected void onClick() {
if (targeting) {
GameScene.handleCell(lastTarget.getPos());
} else {
Item item = select();
if (item == lastItem) {
useTargeting();
} else {
lastItem = item;
}
if (item != null) {
item.execute(Dungeon.hero);
}
}
}
@Override
protected boolean onLongClick() {
return QuickSlot.this.onLongClick();
}
@Override
protected void onTouchDown() {
icon.lightness(0.7f);
}
@Override
protected void onTouchUp() {
icon.resetColor();
}
};
add(slot);
crossB = Icons.TARGET.get();
crossB.setVisible(false);
add(crossB);
crossM = new Image();
crossM.copy(crossB);
}
Aggregations