Search in sources :

Example 6 with Gold

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;
    }
}
Also used : Gold(com.watabou.pixeldungeon.items.Gold) Point(com.watabou.utils.Point)

Example 7 with Gold

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());
}
Also used : Gold(com.watabou.pixeldungeon.items.Gold) IronKey(com.watabou.pixeldungeon.items.keys.IronKey) Heap(com.watabou.pixeldungeon.items.Heap)

Example 8 with Gold

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));
    }
}
Also used : Item(com.watabou.pixeldungeon.items.Item) Gold(com.watabou.pixeldungeon.items.Gold) Belongings(com.watabou.pixeldungeon.actors.hero.Belongings)

Example 9 with 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);
    }
}
Also used : Gold(com.watabou.pixeldungeon.items.Gold) Hero(com.watabou.pixeldungeon.actors.hero.Hero)

Aggregations

Gold (com.watabou.pixeldungeon.items.Gold)9 Hero (com.watabou.pixeldungeon.actors.hero.Hero)2 Heap (com.watabou.pixeldungeon.items.Heap)2 Item (com.watabou.pixeldungeon.items.Item)2 Belongings (com.watabou.pixeldungeon.actors.hero.Belongings)1 EquipableItem (com.watabou.pixeldungeon.items.EquipableItem)1 Armor (com.watabou.pixeldungeon.items.armor.Armor)1 ScrollHolder (com.watabou.pixeldungeon.items.bags.ScrollHolder)1 SeedPouch (com.watabou.pixeldungeon.items.bags.SeedPouch)1 Food (com.watabou.pixeldungeon.items.food.Food)1 IronKey (com.watabou.pixeldungeon.items.keys.IronKey)1 PotionOfHealing (com.watabou.pixeldungeon.items.potions.PotionOfHealing)1 Scroll (com.watabou.pixeldungeon.items.scrolls.Scroll)1 ScrollOfUpgrade (com.watabou.pixeldungeon.items.scrolls.ScrollOfUpgrade)1 MissileWeapon (com.watabou.pixeldungeon.items.weapon.missiles.MissileWeapon)1 Plant (com.watabou.pixeldungeon.plants.Plant)1 Bundle (com.watabou.utils.Bundle)1 Point (com.watabou.utils.Point)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1