use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.
the class VaultRoom method prize.
private Item prize(Level level) {
Generator.Category cat = prizeClasses.remove(0);
Item prize = null;
do {
prize = Generator.random(cat);
} while (prize == null || Challenges.isItemBlocked(prize));
return prize;
}
use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.
the class HuntressArmor method doSpecial.
@Override
public void doSpecial() {
Item proto = new Shuriken();
for (Mob mob : Dungeon.level.mobs) {
if (Dungeon.level.heroFOV[mob.pos]) {
Callback callback = new Callback() {
@Override
public void call() {
curUser.attack(targets.get(this));
targets.remove(this);
if (targets.isEmpty()) {
curUser.spendAndNext(curUser.attackDelay());
}
}
};
((MissileSprite) curUser.sprite.parent.recycle(MissileSprite.class)).reset(curUser.pos, mob.pos, proto, callback);
targets.put(callback, mob);
}
}
if (targets.size() == 0) {
GLog.w(Messages.get(this, "no_enemies"));
return;
}
curUser.HP -= (curUser.HP / 3);
curUser.sprite.zap(curUser.pos);
curUser.busy();
}
use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.
the class ScrollOfIdentify method empoweredRead.
@Override
public void empoweredRead() {
ArrayList<Item> unIDed = new ArrayList<>();
for (Item i : curUser.belongings) {
if (!i.isIdentified()) {
unIDed.add(i);
}
}
if (unIDed.size() > 1) {
Random.element(unIDed).identify();
Sample.INSTANCE.play(Assets.SND_TELEPORT);
}
doRead();
}
use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Bag method collect.
@Override
public boolean collect(Bag container) {
for (Item item : container.items.toArray(new Item[0])) {
if (grab(item)) {
int slot = Dungeon.quickslot.getSlot(item);
item.detachAll(container);
if (!item.collect(this)) {
item.collect(container);
}
if (slot != -1) {
Dungeon.quickslot.setSlot(slot, item);
}
}
}
if (super.collect(container)) {
owner = container.owner;
Badges.validateAllBagsBought(this);
return true;
} else {
return false;
}
}
use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.
the class QuickSlotButton method createChildren.
@Override
protected void createChildren() {
super.createChildren();
slot = new ItemSlot() {
@Override
protected void onClick() {
if (!Dungeon.hero.isAlive())
return;
if (NoosaInputProcessor.modifier) {
onLongClick();
return;
}
if (targeting) {
int cell = autoAim(lastTarget, select(slotNum));
if (cell != -1) {
GameScene.handleCell(cell);
} else {
// couldn't auto-aim, just target the position and hope for the best.
GameScene.handleCell(lastTarget.pos);
}
} else {
Item item = select(slotNum);
if (item.usesTargeting)
useTargeting();
item.execute(Dungeon.hero);
}
}
@Override
protected boolean onLongClick() {
return QuickSlotButton.this.onLongClick();
}
@Override
protected void onTouchDown() {
icon.lightness(0.7f);
}
@Override
protected void onTouchUp() {
icon.resetColor();
}
};
slot.showParams(true, false, true);
add(slot);
crossB = Icons.TARGET.get();
crossB.visible = false;
add(crossB);
crossM = new Image();
crossM.copy(crossB);
}
Aggregations