use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon by watabou.
the class ShopPainter method range.
private static Item[] range() {
ArrayList<Item> items = new ArrayList<Item>();
switch(Dungeon.depth) {
case 6:
items.add((Random.Int(2) == 0 ? new Quarterstaff() : new Spear()).identify());
items.add(new LeatherArmor().identify());
items.add(new SeedPouch());
items.add(new Weightstone());
break;
case 11:
items.add((Random.Int(2) == 0 ? new Sword() : new Mace()).identify());
items.add(new MailArmor().identify());
items.add(new ScrollHolder());
items.add(new Weightstone());
break;
case 16:
items.add((Random.Int(2) == 0 ? new Longsword() : new BattleAxe()).identify());
items.add(new ScaleArmor().identify());
items.add(new WandHolster());
items.add(new Weightstone());
break;
case 21:
switch(Random.Int(3)) {
case 0:
items.add(new Glaive().identify());
break;
case 1:
items.add(new WarHammer().identify());
break;
case 2:
items.add(new PlateArmor().identify());
break;
}
items.add(new Torch());
items.add(new Torch());
break;
}
items.add(new PotionOfHealing());
for (int i = 0; i < 3; i++) {
items.add(Generator.random(Generator.Category.POTION));
}
items.add(new ScrollOfIdentify());
items.add(new ScrollOfRemoveCurse());
items.add(new ScrollOfMagicMapping());
items.add(Generator.random(Generator.Category.SCROLL));
items.add(new OverpricedRation());
items.add(new OverpricedRation());
items.add(new Ankh());
Item[] range = items.toArray(new Item[0]);
Random.shuffle(range);
return range;
}
use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon by watabou.
the class ShopPainter method paint.
public static void paint(Level level, Room room) {
fill(level, room, Terrain.WALL);
fill(level, room, 1, Terrain.EMPTY_SP);
pasWidth = room.width() - 2;
pasHeight = room.height() - 2;
int per = pasWidth * 2 + pasHeight * 2;
Item[] range = range();
int pos = xy2p(room, room.entrance()) + (per - range.length) / 2;
for (int i = 0; i < range.length; i++) {
Point xy = p2xy(room, (pos + per) % per);
int cell = xy.x + xy.y * Level.WIDTH;
if (level.heaps.get(cell) != null) {
do {
cell = room.random();
} while (level.heaps.get(cell) != null);
}
level.drop(range[i], cell).type = Heap.Type.FOR_SALE;
pos++;
}
placeShopkeeper(level, room);
for (Room.Door door : room.connected.values()) {
door.set(Room.Door.Type.REGULAR);
}
}
use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon by watabou.
the class PrisonBossLevel method createItems.
@Override
protected void createItems() {
int keyPos = anteroom.random();
while (!passable[keyPos]) {
keyPos = anteroom.random();
}
drop(new IronKey(), keyPos).type = Heap.Type.CHEST;
Item item = Bones.get();
if (item != null) {
int pos;
do {
pos = roomEntrance.random();
} while (pos == entrance || map[pos] == Terrain.SIGN);
drop(item, pos).type = Heap.Type.SKELETON;
}
}
use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon by watabou.
the class RegularLevel method createItems.
@Override
protected void createItems() {
int nItems = 3;
while (Random.Float() < 0.4f) {
nItems++;
}
for (int i = 0; i < nItems; i++) {
Heap.Type type = null;
switch(Random.Int(20)) {
case 0:
type = Heap.Type.SKELETON;
break;
case 1:
case 2:
case 3:
case 4:
type = Heap.Type.CHEST;
break;
case 5:
type = Dungeon.depth > 1 ? Heap.Type.MIMIC : Heap.Type.CHEST;
break;
default:
type = Heap.Type.HEAP;
}
drop(Generator.random(), randomDropCell()).type = type;
}
for (Item item : itemsToSpawn) {
int cell = randomDropCell();
if (item instanceof ScrollOfUpgrade) {
while (map[cell] == Terrain.FIRE_TRAP || map[cell] == Terrain.SECRET_FIRE_TRAP) {
cell = randomDropCell();
}
}
drop(item, cell).type = Heap.Type.HEAP;
}
Item item = Bones.get();
if (item != null) {
drop(item, randomDropCell()).type = Heap.Type.SKELETON;
}
}
use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon by watabou.
the class TrapsPainter method prize.
private static Item prize(Level level) {
Item prize = level.itemToSpanAsPrize();
if (prize != null) {
return prize;
}
prize = Generator.random(Random.oneOf(Generator.Category.WEAPON, Generator.Category.ARMOR));
for (int i = 0; i < 3; i++) {
Item another = Generator.random(Random.oneOf(Generator.Category.WEAPON, Generator.Category.ARMOR));
if (another.level() > prize.level()) {
prize = another;
}
}
return prize;
}
Aggregations