use of com.shatteredpixel.shatteredpixeldungeon.items.Heap 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.Heap in project shattered-pixel-dungeon-gdx by 00-Evan.
the class ScrollOfRage method doRead.
@Override
public void doRead() {
for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {
mob.beckon(curUser.pos);
if (Dungeon.level.heroFOV[mob.pos]) {
Buff.prolong(mob, Amok.class, 5f);
}
}
for (Heap heap : Dungeon.level.heaps.values()) {
if (heap.type == Heap.Type.MIMIC) {
Mimic m = Mimic.spawnAt(heap.pos, heap.items);
if (m != null) {
m.beckon(curUser.pos);
heap.destroy();
}
}
}
GLog.w(Messages.get(this, "roar"));
setKnown();
curUser.sprite.centerEmitter().start(Speck.factory(Speck.SCREAM), 0.3f, 3);
Sample.INSTANCE.play(Assets.SND_CHALLENGE);
Invisibility.dispel();
readAnimation();
}
use of com.shatteredpixel.shatteredpixeldungeon.items.Heap in project shattered-pixel-dungeon-gdx by 00-Evan.
the class CellSelector method onClick.
@Override
protected void onClick(NoosaInputProcessor.Touch touch) {
if (dragging) {
dragging = false;
} else {
PointF p = Camera.main.screenToCamera((int) touch.current.x, (int) touch.current.y);
for (Char mob : Dungeon.level.mobs.toArray(new Mob[0])) {
if (mob.sprite != null && mob.sprite.overlapsPoint(p.x, p.y)) {
select(mob.pos);
return;
}
}
for (Heap heap : Dungeon.level.heaps.values()) {
if (heap.sprite != null && heap.sprite.overlapsPoint(p.x, p.y)) {
select(heap.pos);
return;
}
}
select(((DungeonTilemap) target).screenToTile((int) touch.current.x, (int) touch.current.y, true));
}
}
use of com.shatteredpixel.shatteredpixeldungeon.items.Heap 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);
}
}
use of com.shatteredpixel.shatteredpixeldungeon.items.Heap in project shattered-pixel-dungeon-gdx by 00-Evan.
the class TeleportationTrap method activate.
@Override
public void activate() {
CellEmitter.get(pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
Sample.INSTANCE.play(Assets.SND_TELEPORT);
Char ch = Actor.findChar(pos);
if (ch instanceof Hero) {
ScrollOfTeleportation.teleportHero((Hero) ch);
} else if (ch != null) {
int count = 10;
int pos;
do {
pos = Dungeon.level.randomRespawnCell();
if (count-- <= 0) {
break;
}
} while (pos == -1);
if (pos == -1 || Dungeon.bossLevel()) {
GLog.w(Messages.get(ScrollOfTeleportation.class, "no_tele"));
} else {
ch.pos = pos;
if (ch instanceof Mob && ((Mob) ch).state == ((Mob) ch).HUNTING) {
((Mob) ch).state = ((Mob) ch).WANDERING;
}
ch.sprite.place(ch.pos);
ch.sprite.visible = Dungeon.level.heroFOV[pos];
}
}
Heap heap = Dungeon.level.heaps.get(pos);
if (heap != null) {
int cell = Dungeon.level.randomRespawnCell();
Item item = heap.pickUp();
if (cell != -1) {
Dungeon.level.drop(item, cell);
}
}
}
Aggregations