use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.
the class DisarmingTrap method activate.
@Override
public void activate() {
Heap heap = Dungeon.level.heaps.get(pos);
if (heap != null) {
int cell = Dungeon.level.randomRespawnCell();
if (cell != -1) {
Item item = heap.pickUp();
Dungeon.level.drop(item, cell).seen = true;
for (int i : PathFinder.NEIGHBOURS9) Dungeon.level.visited[cell + i] = true;
GameScene.updateFog();
Sample.INSTANCE.play(Assets.SND_TELEPORT);
CellEmitter.get(pos).burst(Speck.factory(Speck.LIGHT), 4);
}
}
if (Dungeon.hero.pos == pos) {
Hero hero = Dungeon.hero;
KindOfWeapon weapon = hero.belongings.weapon;
if (weapon != null && !(weapon instanceof Knuckles) && !weapon.cursed) {
int cell = Dungeon.level.randomRespawnCell();
if (cell != -1) {
hero.belongings.weapon = null;
Dungeon.quickslot.clearItem(weapon);
weapon.updateQuickslot();
Dungeon.level.drop(weapon, cell).seen = true;
for (int i : PathFinder.NEIGHBOURS9) Dungeon.level.visited[cell + i] = true;
GameScene.updateFog();
GLog.w(Messages.get(this, "disarm"));
Sample.INSTANCE.play(Assets.SND_TELEPORT);
CellEmitter.get(pos).burst(Speck.factory(Speck.LIGHT), 4);
}
}
}
}
use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.
the class DistortionTrap method activate.
@Override
public void activate() {
InterlevelScene.returnDepth = Dungeon.depth;
Belongings belongings = Dungeon.hero.belongings;
for (Notes.Record rec : Notes.getRecords()) {
if (rec.depth() == Dungeon.depth) {
Notes.remove(rec);
}
}
for (Item i : belongings) {
if (i instanceof LloydsBeacon && ((LloydsBeacon) i).returnDepth == Dungeon.depth)
((LloydsBeacon) i).returnDepth = -1;
}
InterlevelScene.mode = InterlevelScene.Mode.RESET;
Game.switchScene(InterlevelScene.class);
}
use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.
the class ScrollOfRemoveCurse method uncurse.
public static boolean uncurse(Hero hero, Item... items) {
boolean procced = false;
for (Item item : items) {
if (item != null && item.cursed) {
item.cursed = false;
procced = true;
}
if (item instanceof Weapon) {
Weapon w = (Weapon) item;
if (w.hasCurseEnchant()) {
w.enchant(null);
w.cursed = false;
procced = true;
}
}
if (item instanceof Armor) {
Armor a = (Armor) item;
if (a.hasCurseGlyph()) {
a.inscribe(null);
a.cursed = false;
procced = true;
}
}
if (item instanceof Bag) {
for (Item bagItem : ((Bag) item).items) {
if (bagItem != null && bagItem.cursed) {
bagItem.cursed = false;
procced = true;
}
}
}
}
if (procced) {
hero.sprite.emitter().start(ShadowParticle.UP, 0.05f, 10);
// for ring of might
hero.updateHT(false);
}
return procced;
}
use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Bag method onDetach.
@Override
public void onDetach() {
this.owner = null;
for (Item item : items) Dungeon.quickslot.clearItem(item);
updateQuickslot();
}
use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.
the class PitfallTrap method activate.
@Override
public void activate() {
Heap heap = Dungeon.level.heaps.get(pos);
if (heap != null) {
for (Item item : heap.items) {
Dungeon.dropToChasm(item);
}
heap.sprite.kill();
GameScene.discard(heap);
Dungeon.level.heaps.remove(pos);
}
Char ch = Actor.findChar(pos);
if (ch == Dungeon.hero) {
Chasm.heroFall(pos);
} else if (ch != null) {
Chasm.mobFall((Mob) ch);
}
}
Aggregations