use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
the class Bag method collect.
@Override
public boolean collect(Bag container) {
if (super.collect(container)) {
owner = container.owner;
for (Item item : container.items.toArray(new Item[container.items.size()])) {
if (grab(item)) {
item.detachAll(container);
item.collect(this);
}
}
Badges.validateAllBagsBought(this);
return true;
} else {
return false;
}
}
use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
the class Thief method steal.
protected boolean steal(Hero hero) {
Item item = hero.belongings.randomUnequipped();
if (item != null) {
GLog.w(TXT_STOLE, this.getName(), item.name());
item.detachAll(hero.belongings.backpack);
this.item = item;
return true;
} else {
return false;
}
}
use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
the class Ghost method interact.
@Override
public boolean interact(final Hero hero) {
getSprite().turnTo(getPos(), hero.getPos());
if (hero.heroClass.equals(HeroClass.NECROMANCER)) {
if (!introduced) {
window = new WndSadGhostNecro();
GameScene.show(window);
introduced = true;
return true;
} else {
if (window != null) {
persuade = window.getPersuade();
}
}
}
Sample.INSTANCE.play(Assets.SND_GHOST);
if (persuade || Quest.given) {
Item item = Quest.alternative ? hero.belongings.getItem(RatSkull.class) : hero.belongings.getItem(DriedRose.class);
if (persuade) {
item = Quest.alternative ? new RatSkull() : new DriedRose();
}
if (persuade || item != null) {
GameScene.show(new WndSadGhost(this, item));
} else {
GameScene.show(new WndQuest(this, Quest.alternative ? TXT_RAT2 : TXT_ROSE2));
int newPos = -1;
for (int i = 0; i < 10; i++) {
newPos = Dungeon.level.randomRespawnCell();
if (newPos != -1) {
break;
}
}
if (newPos != -1) {
Actor.freeCell(getPos());
CellEmitter.get(getPos()).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
setPos(newPos);
getSprite().place(getPos());
getSprite().setVisible(Dungeon.visible[getPos()]);
}
}
} else {
GameScene.show(new WndQuest(this, Quest.alternative ? TXT_RAT1 : TXT_ROSE1));
Quest.given = true;
Journal.add(Journal.Feature.GHOST.desc());
}
return true;
}
use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
the class HuntressArmor method doSpecial.
@Override
public void doSpecial() {
Item proto = new Shuriken();
for (Mob mob : Dungeon.level.getCopyOfMobsArray()) {
if (Dungeon.level.fieldOfView[mob.getPos()]) {
Callback callback = new Callback() {
@Override
public void call() {
getCurUser().attack(targets.get(this));
targets.remove(this);
if (targets.isEmpty()) {
getCurUser().spendAndNext(getCurUser().attackDelay());
}
}
};
((MissileSprite) getCurUser().getSprite().getParent().recycle(MissileSprite.class)).reset(getCurUser().getPos(), mob.getPos(), proto, callback);
targets.put(callback, mob);
}
}
if (targets.size() == 0) {
GLog.w(TXT_NO_ENEMIES);
return;
}
getCurUser().getSprite().zap(getCurUser().getPos());
getCurUser().busy();
}
use of com.watabou.pixeldungeon.items.Item in project pixel-dungeon-remix by NYRDS.
the class Belongings method discharge.
public int discharge() {
int count = 0;
for (Item item : this) {
if (item instanceof Wand) {
Wand wand = (Wand) item;
if (wand.curCharges() > 0) {
wand.curCharges(wand.curCharges() - 1);
count++;
wand.updateQuickslot();
}
}
}
return count;
}
Aggregations