use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
the class PredesignedLevel method createItems.
@Override
protected void createItems() {
try {
if (mLevelDesc.has("items")) {
JSONArray itemsDesc = mLevelDesc.getJSONArray("items");
for (int i = 0; i < itemsDesc.length(); ++i) {
JSONObject itemDesc = itemsDesc.optJSONObject(i);
int x = itemDesc.getInt("x");
int y = itemDesc.getInt("y");
if (cellValid(x, y)) {
Item item = ItemFactory.createItemFromDesc(itemDesc);
drop(item, cell(x, y));
}
}
}
} catch (JSONException e) {
throw new TrackedRuntimeException("bad items description", e);
} catch (Exception e) {
throw new TrackedRuntimeException(e);
}
}
use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
the class TownShopLevel method makeShop.
private void makeShop() {
ArrayList<Item> items = new ArrayList<>();
items.add(new LeatherArmor().identify());
items.add(new Dagger().identify());
items.add(new Knuckles().identify());
items.add(new Sword().identify());
items.add(new Quarterstaff().identify());
items.add(new TomeOfKnowledge().identify());
for (int i = 0; i < 3; i++) {
items.add(new OverpricedRation());
items.add(new Dart(5).identify());
items.add(new CommonArrow(25));
items.add(new Torch().identify());
}
items.add(new Keyring());
items.add(new ScrollHolder());
items.add(new PotionBelt());
items.add(new SeedPouch());
items.add(new Quiver());
items.add(new WandHolster());
Item[] range = items.toArray(new Item[items.size()]);
for (Item item : range) {
itemForSell(item);
}
}
use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
the class CagedKobold method interact.
@Override
public boolean interact(final Hero hero) {
getSprite().turnTo(getPos(), hero.getPos());
if (Quest.completed) {
return true;
}
if (Quest.given) {
Item item = hero.belongings.getItem(IceKey.class);
if (item != null) {
item.removeItemFrom(Dungeon.hero);
Item reward = new CandleOfMindVision();
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));
CellEmitter.get(getPos()).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
getSprite().killAndErase();
destroy();
} else {
int index = Random.Int(0, TXT_PHRASES.length);
say(TXT_PHRASES[index]);
}
} else {
GameScene.show(new WndQuest(this, TXT_QUEST_START));
Quest.given = true;
Quest.process();
Journal.add(Journal.Feature.CAGEDKOBOLD.desc());
}
return true;
}
use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
the class UpgradablePotion method upgrade.
@Override
public Item upgrade() {
if (getCurUser() != null && quantity() > 1) {
Item potion = detach(getCurUser().belongings.backpack);
getCurUser().collect(potion.upgrade());
return this;
}
return super.upgrade();
}
use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
the class UpgradablePotion method degrade.
@Override
public Item degrade() {
if (getCurUser() != null && quantity() > 1) {
Item potion = detach(getCurUser().belongings.backpack);
getCurUser().collect(potion.degrade());
return this;
}
return super.degrade();
}
Aggregations