use of com.watabou.pixeldungeon.items.armor.Armor in project pixel-dungeon by watabou.
the class Level method drop.
public Heap drop(Item item, int cell) {
if (Dungeon.isChallenged(Challenges.NO_FOOD) && item instanceof Food) {
item = new Gold(item.price());
} else if (Dungeon.isChallenged(Challenges.NO_ARMOR) && item instanceof Armor) {
item = new Gold(item.price());
} else if (Dungeon.isChallenged(Challenges.NO_HEALING) && item instanceof PotionOfHealing) {
item = new Gold(item.price());
} else if (Dungeon.isChallenged(Challenges.NO_HERBALISM) && item instanceof SeedPouch) {
item = new Gold(item.price());
} else if (Dungeon.isChallenged(Challenges.NO_SCROLLS) && (item instanceof Scroll || item instanceof ScrollHolder)) {
if (item instanceof ScrollOfUpgrade) {
// These scrolls still can be found
} else {
item = new Gold(item.price());
}
}
if ((map[cell] == Terrain.ALCHEMY) && !(item instanceof Plant.Seed)) {
int n;
do {
n = cell + NEIGHBOURS8[Random.Int(8)];
} while (map[n] != Terrain.EMPTY_SP);
cell = n;
}
Heap heap = heaps.get(cell);
if (heap == null) {
heap = new Heap();
heap.pos = cell;
if (map[cell] == Terrain.CHASM || (Dungeon.level != null && pit[cell])) {
Dungeon.dropToChasm(item);
GameScene.discard(heap);
} else {
heaps.put(cell, heap);
GameScene.add(heap);
}
} else if (heap.type == Heap.Type.LOCKED_CHEST || heap.type == Heap.Type.CRYSTAL_CHEST) {
int n;
do {
n = cell + Level.NEIGHBOURS8[Random.Int(8)];
} while (!Level.passable[n] && !Level.avoid[n]);
return drop(item, n);
}
heap.drop(item);
if (Dungeon.level != null) {
press(cell, null);
}
return heap;
}
use of com.watabou.pixeldungeon.items.armor.Armor in project pixel-dungeon by watabou.
the class Item method use.
public void use() {
if (level > 0 && !isBroken()) {
int threshold = (int) (maxDurability() * DURABILITY_WARNING_LEVEL);
if (durability-- >= threshold && threshold > durability && levelKnown) {
GLog.w(TXT_GONNA_BREAK, name());
}
if (isBroken()) {
getBroken();
if (levelKnown) {
GLog.n(TXT_BROKEN, name());
Dungeon.hero.interrupt();
CharSprite sprite = Dungeon.hero.sprite;
PointF point = sprite.center().offset(0, -16);
if (this instanceof Weapon) {
sprite.parent.add(Degradation.weapon(point));
} else if (this instanceof Armor) {
sprite.parent.add(Degradation.armor(point));
} else if (this instanceof Ring) {
sprite.parent.add(Degradation.ring(point));
} else if (this instanceof Wand) {
sprite.parent.add(Degradation.wand(point));
}
Sample.INSTANCE.play(Assets.SND_DEGRADE);
}
}
}
}
Aggregations