use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.
the class WndTradeItem method buy.
private void buy(Heap heap) {
Hero hero = Dungeon.hero;
Item item = heap.pickUp();
int price = price(item);
Dungeon.gold -= price;
if (!item.doPickUp(hero)) {
Dungeon.level.drop(item, heap.pos).sprite.drop();
}
}
use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Belongings method resurrect.
public void resurrect(int depth) {
for (Item item : backpack.items.toArray(new Item[0])) {
if (item instanceof Key) {
if (((Key) item).depth == depth) {
item.detachAll(backpack);
}
} else if (item.unique) {
item.detachAll(backpack);
// you keep the bag itself, not its contents.
if (item instanceof Bag) {
((Bag) item).clear();
}
item.collect();
} else if (!item.isEquipped(owner)) {
item.detachAll(backpack);
}
}
if (weapon != null) {
weapon.cursed = false;
weapon.activate(owner);
}
if (armor != null) {
armor.cursed = false;
armor.activate(owner);
}
if (misc1 != null) {
misc1.cursed = false;
misc1.activate(owner);
}
if (misc2 != null) {
misc2.cursed = false;
misc2.activate(owner);
}
}
use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Belongings method observe.
public void observe() {
if (weapon != null) {
weapon.identify();
Badges.validateItemLevelAquired(weapon);
}
if (armor != null) {
armor.identify();
Badges.validateItemLevelAquired(armor);
}
if (misc1 != null) {
misc1.identify();
Badges.validateItemLevelAquired(misc1);
}
if (misc2 != null) {
misc2.identify();
Badges.validateItemLevelAquired(misc2);
}
for (Item item : backpack) {
item.cursedKnown = true;
}
}
use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Hero method die.
@Override
public void die(Object cause) {
curAction = null;
Ankh ankh = null;
// look for ankhs in player inventory, prioritize ones which are blessed.
for (Item item : belongings) {
if (item instanceof Ankh) {
if (ankh == null || ((Ankh) item).isBlessed()) {
ankh = (Ankh) item;
}
}
}
if (ankh != null && ankh.isBlessed()) {
this.HP = HT / 4;
// ensures that you'll get to act first in almost any case, to prevent reviving and then instantly dieing again.
Buff.detach(this, Paralysis.class);
spend(-cooldown());
new Flare(8, 32).color(0xFFFF66, true).show(sprite, 2f);
CellEmitter.get(this.pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
ankh.detach(belongings.backpack);
Sample.INSTANCE.play(Assets.SND_TELEPORT);
GLog.w(Messages.get(this, "revive"));
Statistics.ankhsUsed++;
return;
}
Actor.fixTime();
super.die(cause);
if (ankh == null) {
reallyDie(cause);
} else {
Dungeon.deleteGame(GamesInProgress.curSlot, false);
GameScene.show(new WndResurrect(ankh, cause));
}
}
use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Electricity method evolve.
@Override
protected void evolve() {
water = Dungeon.level.water;
int cell;
// spread first..
for (int i = area.left - 1; i <= area.right; i++) {
for (int j = area.top - 1; j <= area.bottom; j++) {
cell = i + j * Dungeon.level.width();
if (cur[cell] > 0) {
spreadFromCell(cell, cur[cell]);
}
}
}
// ..then decrement/shock
for (int i = area.left - 1; i <= area.right; i++) {
for (int j = area.top - 1; j <= area.bottom; j++) {
cell = i + j * Dungeon.level.width();
if (cur[cell] > 0) {
Char ch = Actor.findChar(cell);
if (ch != null && !ch.isImmune(this.getClass())) {
Buff.prolong(ch, Paralysis.class, 1f);
if (cur[cell] % 2 == 1) {
ch.damage(Math.round(Random.Float(2 + Dungeon.depth / 5f)), this);
}
}
Heap h = Dungeon.level.heaps.get(cell);
if (h != null) {
Item toShock = h.peek();
if (toShock instanceof Wand) {
((Wand) toShock).gainCharge(0.333f);
} else if (toShock instanceof MagesStaff) {
((MagesStaff) toShock).gainCharge(0.333f);
}
}
off[cell] = cur[cell] - 1;
volume += off[cell];
} else {
off[cell] = 0;
}
}
}
}
Aggregations