use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
the class Belongings method resurrect.
public void resurrect(int depth) {
for (Item item : backpack.items.toArray(new Item[backpack.items.size()])) {
if (item instanceof Key) {
if (((Key) item).depth == depth) {
item.detachAll(backpack);
}
} else if (item instanceof Amulet) {
} else if (!item.isEquipped(owner)) {
item.detachAll(backpack);
}
}
if (weapon != null) {
weapon.cursed = false;
weapon.activate(owner);
}
if (armor != null) {
armor.cursed = false;
}
if (ring1 != null) {
ring1.cursed = false;
ring1.activate(owner);
}
if (ring2 != null) {
ring2.cursed = false;
ring2.activate(owner);
}
}
use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
the class Belongings method charge.
public int charge(boolean full) {
int count = 0;
for (Item item : this) {
if (item instanceof Wand) {
Wand wand = (Wand) item;
if (wand.curCharges() < wand.maxCharges()) {
wand.curCharges(full ? wand.maxCharges() : wand.curCharges() + 1);
count++;
wand.updateQuickslot();
}
}
}
return count;
}
use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
the class Belongings method observe.
public void observe() {
if (weapon != null) {
weapon.identify();
Badges.validateItemLevelAcquired(weapon);
}
if (armor != null) {
armor.identify();
Badges.validateItemLevelAcquired(armor);
}
if (ring1 != null) {
ring1.identify();
Badges.validateItemLevelAcquired(ring1);
}
if (ring2 != null) {
ring2.identify();
Badges.validateItemLevelAcquired(ring2);
}
for (Item item : backpack) {
item.cursedKnown = true;
}
}
use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
the class Hero method actPickUp.
private boolean actPickUp(HeroAction.PickUp action) {
int dst = action.dst;
if (getPos() == dst) {
Heap heap = Dungeon.level.getHeap(getPos());
if (heap != null) {
Item item = heap.pickUp();
item = item.pick(this, getPos());
if (item != null) {
if (item.doPickUp(this)) {
itemPickedUp(item);
if (!heap.isEmpty()) {
GLog.i(TXT_SOMETHING_ELSE);
}
curAction = null;
} else {
Heap newHeap = Dungeon.level.drop(item, getPos());
newHeap.sprite.drop();
newHeap.pickUpFailed();
ready();
}
} else {
ready();
}
} else {
ready();
}
return false;
} else if (getCloser(dst)) {
return true;
} else {
ready();
return false;
}
}
use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
the class Hero method damage.
@Override
public void damage(int dmg, Object src) {
restoreHealth = false;
super.damage(dmg, src);
checkIfFurious();
interrupt();
if (belongings.armor instanceof SpiderArmor) {
// Armor proc
if (Random.Int(100) < 50) {
GameScene.add(Blob.seed(getPos(), Random.Int(5, 7), Web.class));
}
}
for (Item item : belongings) {
if (item instanceof IChaosItem && item.isEquipped(this)) {
if (!(src instanceof Hunger)) {
((IChaosItem) item).ownerTakesDamage(dmg);
}
}
}
}
Aggregations