use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
the class Level method itemToSpanAsPrize.
public Item itemToSpanAsPrize() {
if (Random.Int(itemsToSpawn.size() + 1) > 0) {
Item item = Random.element(itemsToSpawn);
itemsToSpawn.remove(item);
return item;
} else {
return null;
}
}
use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
the class PrisonBossLevel method createItems.
@Override
protected void createItems() {
int keyPos = anteroom.random(this);
while (!passable[keyPos]) {
keyPos = anteroom.random(this);
}
drop(new IronKey(), keyPos).type = Heap.Type.CHEST;
Item item = Bones.get();
if (item != null) {
int pos;
do {
pos = roomEntrance.random(this);
} while (pos == entrance);
drop(item, pos).type = Heap.Type.SKELETON;
}
}
use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
the class RegularLevel method createItems.
@Override
protected void createItems() {
int nItems = 3;
while (Random.Float() < 0.3f) {
nItems++;
}
for (int i = 0; i < nItems; i++) {
drop(Generator.random(), randomDropCell()).type = Random.chances(Heap.regularHeaps);
}
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-remix by NYRDS.
the class SewerBossLevel method createItems.
@Override
protected void createItems() {
Item item = Bones.get();
if (item != null) {
int pos;
do {
pos = roomEntrance.random(this);
} while (pos == entrance);
drop(item, pos).type = Heap.Type.SKELETON;
}
}
use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
the class RatKingPainter method addChest.
private static void addChest(Level level, int pos, int door) {
if (pos == door - 1 || pos == door + 1 || pos == door - level.getWidth() || pos == door + level.getWidth()) {
return;
}
Item prize;
switch(Random.Int(10)) {
case 0:
prize = Generator.random(Generator.Category.WEAPON);
if (prize instanceof MissileWeapon) {
prize.quantity(1);
} else {
prize.degrade(Random.Int(3));
}
break;
case 1:
prize = Generator.random(Generator.Category.ARMOR).degrade(Random.Int(3));
break;
default:
prize = new Gold(Random.IntRange(1, 5));
break;
}
level.drop(prize, pos).type = Heap.Type.CHEST;
}
Aggregations