use of com.watabou.pixeldungeon.items.Gold in project pixel-dungeon by watabou.
the class StandardPainter method paintGraveyard.
private static void paintGraveyard(Level level, Room room) {
fill(level, room.left + 1, room.top + 1, room.width() - 1, room.height() - 1, Terrain.GRASS);
int w = room.width() - 1;
int h = room.height() - 1;
int nGraves = Math.max(w, h) / 2;
int index = Random.Int(nGraves);
int shift = Random.Int(2);
for (int i = 0; i < nGraves; i++) {
int pos = w > h ? room.left + 1 + shift + i * 2 + (room.top + 2 + Random.Int(h - 2)) * Level.WIDTH : (room.left + 2 + Random.Int(w - 2)) + (room.top + 1 + shift + i * 2) * Level.WIDTH;
level.drop(i == index ? Generator.random() : new Gold(), pos).type = Heap.Type.TOMB;
}
}
use of com.watabou.pixeldungeon.items.Gold in project pixel-dungeon by watabou.
the class TreasuryPainter method paint.
public static void paint(Level level, Room room) {
fill(level, room, Terrain.WALL);
fill(level, room, 1, Terrain.EMPTY);
set(level, room.center(), Terrain.STATUE);
Heap.Type heapType = Random.Int(2) == 0 ? Heap.Type.CHEST : Heap.Type.HEAP;
int n = Random.IntRange(2, 3);
for (int i = 0; i < n; i++) {
int pos;
do {
pos = room.random();
} while (level.map[pos] != Terrain.EMPTY || level.heaps.get(pos) != null);
level.drop(new Gold().random(), pos).type = (i == 0 && heapType == Heap.Type.CHEST ? Heap.Type.MIMIC : heapType);
}
if (heapType == Heap.Type.HEAP) {
for (int i = 0; i < 6; i++) {
int pos;
do {
pos = room.random();
} while (level.map[pos] != Terrain.EMPTY);
level.drop(new Gold(Random.IntRange(1, 3)), pos);
}
}
room.entrance().set(Room.Door.Type.LOCKED);
level.addItemToSpawn(new IronKey());
}
use of com.watabou.pixeldungeon.items.Gold in project pixel-dungeon by watabou.
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));
boolean backpack = (container == Dungeon.hero.belongings.backpack);
if (!backpack) {
count = nCols;
col = 0;
row = 1;
}
// Items in the bag
for (Item item : container.items) {
placeItem(item);
}
// Free space
while (count - (backpack ? 4 : nCols) < container.size) {
placeItem(null);
}
// Gold in the backpack
if (container == Dungeon.hero.belongings.backpack) {
row = nRows - 1;
col = nCols - 1;
placeItem(new Gold(Dungeon.gold));
}
}
use of com.watabou.pixeldungeon.items.Gold in project pixel-dungeon by watabou.
the class WndTradeItem method sellOne.
private void sellOne(Item item) {
if (item.quantity() <= 1) {
sell(item);
} else {
Hero hero = Dungeon.hero;
item = item.detach(hero.belongings.backpack);
int price = item.price();
new Gold(price).doPickUp(hero);
GLog.i(TXT_SOLD, item.name(), price);
}
}
Aggregations