use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
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;
}
use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
the class CavesBossLevel method createItems.
@Override
protected void createItems() {
Item item = Bones.get();
if (item != null) {
int pos;
do {
pos = Random.IntRange(_RoomLeft(), _RoomRight()) + Random.IntRange(_RoomTop() + 1, _RoomBottom()) * getWidth();
} 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 WandOfTelekinesis method transport.
private void transport(Heap heap) {
Item item = heap.pickUp();
item = item.pick(getCurUser(), heap.pos);
if (item != null) {
if (item.doPickUp(getCurUser())) {
getCurUser().itemPickedUp(item);
} else {
Dungeon.level.drop(item, getCurUser().getPos()).sprite.drop();
}
}
}
use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
the class SpiderLevel 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(), randomRespawnCell()).type = Heap.Type.SKELETON;
}
for (Item item : itemsToSpawn) {
int cell = randomRespawnCell();
if (item instanceof ScrollOfUpgrade) {
while (map[cell] == Terrain.FIRE_TRAP || map[cell] == Terrain.SECRET_FIRE_TRAP) {
cell = randomRespawnCell();
}
}
drop(item, cell).type = Heap.Type.HEAP;
}
Item item = Bones.get();
if (item != null) {
drop(item, randomRespawnCell()).type = Heap.Type.SKELETON;
}
}
use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
the class PlagueDoctorNPC method interact.
@Override
public boolean interact(final Hero hero) {
getSprite().turnTo(getPos(), hero.getPos());
if (Quest.completed) {
GameScene.show(new WndQuest(this, TXT_QUEST_COMPLETED));
return true;
}
if (Quest.given) {
Item item = hero.belongings.getItem(RatHide.class);
if (item != null && item.quantity() >= 5) {
item.removeItemFrom(Dungeon.hero);
Item reward = new RatArmor();
reward.identify();
if (reward.doPickUp(Dungeon.hero)) {
GLog.i(Hero.TXT_YOU_NOW_HAVE, reward.name());
} else {
Dungeon.level.drop(reward, hero.getPos()).sprite.drop();
}
Quest.complete();
GameScene.show(new WndQuest(this, TXT_QUEST_END));
} else {
GameScene.show(new WndQuest(this, (Utils.format(TXT_QUEST, 5))));
}
} else {
String txtQuestStart = Utils.format(TXT_QUEST_START_M, 5);
if (Dungeon.hero.getGender() == Utils.FEMININE) {
txtQuestStart = Utils.format(TXT_QUEST_START_F, 5);
}
GameScene.show(new WndQuest(this, txtQuestStart));
Quest.process(hero.getPos());
Quest.given = true;
Journal.add(Journal.Feature.PLAGUEDOCTOR.desc());
}
return true;
}
Aggregations