public void press( int cell, Char ch){ press( cell, ch, ch == Dungeon.hero); }
public void press( int cell, Char ch){ press( cell, ch, ch == Dungeon.hero); }
private void triggerPresses(){ for (int cell : presses) Dungeon.level.press(cell, null, true); presses = new ArrayList<>(); }
private void triggerPresses(){ for (int cell : presses) Dungeon.level.press(cell, null, true); presses = new ArrayList<>(); }
@Override public void detach() { target.flying = false; Dungeon.level.press( target.pos, target ); super.detach(); }
@Override public void detach() { target.flying = false; Dungeon.level.press( target.pos, target ); super.detach(); }
@Override protected void onThrow( int cell ) { if (Dungeon.level.map[cell] == Terrain.WELL || Dungeon.level.pit[cell]) { super.onThrow( cell ); } else { Dungeon.level.press( cell, null, true ); shatter( cell ); } }
@Override protected void onThrow( int cell ) { if (Dungeon.level.map[cell] == Terrain.WELL || Dungeon.level.pit[cell]) { super.onThrow( cell ); } else { Dungeon.level.press( cell, null, true ); shatter( cell ); } }
@Override protected void onZap( Ballistica bolt ) { Char ch = Actor.findChar( bolt.collisionPos ); if (ch != null) { processSoulMark(ch, chargesPerCast()); ch.damage(damageRoll(), this); ch.sprite.burst(0xFFFFFFFF, level() / 2 + 2); } else { Dungeon.level.press(bolt.collisionPos, null, true); } }
public void call() { if (initialpos != ch.pos) { //something cased movement before pushing resolved, cancel to be safe. ch.sprite.place(ch.pos); return; } ch.pos = newPos; if (ch.pos == trajectory.collisionPos) { ch.damage(Random.NormalIntRange((finalDist + 1) / 2, finalDist), this); Paralysis.prolong(ch, Paralysis.class, Random.NormalIntRange((finalDist + 1) / 2, finalDist)); } Dungeon.level.press(ch.pos, ch, true); if (ch == Dungeon.hero){ //FIXME currently no logic here if the throw effect kills the hero Dungeon.observe(); } } }), -1);
@Override protected void onZap( Ballistica bolt ) { Char ch = Actor.findChar( bolt.collisionPos ); if (ch != null) { processSoulMark(ch, chargesPerCast()); ch.damage(damageRoll(), this); ch.sprite.burst(0xFFFFFFFF, level() / 2 + 2); } else { Dungeon.level.press(bolt.collisionPos, null, true); } }
public static void teleportToLocation(Hero hero, int pos){ PathFinder.buildDistanceMap(pos, BArray.or(Dungeon.level.passable, Dungeon.level.avoid, null)); if (PathFinder.distance[hero.pos] == Integer.MAX_VALUE || (!Dungeon.level.passable[pos] && !Dungeon.level.avoid[pos]) || Actor.findChar(pos) != null){ GLog.w( Messages.get(ScrollOfTeleportation.class, "cant_reach") ); return; } appear( hero, pos ); Dungeon.level.press( pos, hero ); Dungeon.observe(); GameScene.updateFog(); }
public static void teleportToLocation(Hero hero, int pos){ PathFinder.buildDistanceMap(pos, BArray.or(Dungeon.level.passable, Dungeon.level.avoid, null)); if (PathFinder.distance[hero.pos] == Integer.MAX_VALUE || (!Dungeon.level.passable[pos] && !Dungeon.level.avoid[pos]) || Actor.findChar(pos) != null){ GLog.w( Messages.get(ScrollOfTeleportation.class, "cant_reach") ); return; } appear( hero, pos ); Dungeon.level.press( pos, hero ); Dungeon.observe(); GameScene.updateFog(); }
public static void teleportHero( Hero hero ) { 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 { GLog.i( Messages.get(ScrollOfTeleportation.class, "tele") ); appear( hero, pos ); Dungeon.level.press( pos, hero ); Dungeon.observe(); GameScene.updateFog(); } }
@Override public void press( int cell, Char ch ) { super.press(cell, ch); if (ch == Dungeon.hero){ //hero enters tengu's chamber if (state == State.START && (new EmptyRoom().set(2, 25, 8, 32)).inside(cellToPoint(cell))){ progress(); } //hero finishes the maze else if (state == State.MAZE && (new EmptyRoom().set(4, 0, 7, 4)).inside(cellToPoint(cell))){ progress(); } } }
@Override public void press( int cell, Char ch ) { super.press(cell, ch); if (ch == Dungeon.hero){ //hero enters tengu's chamber if (state == State.START && (new EmptyRoom().set(2, 25, 8, 32)).inside(cellToPoint(cell))){ progress(); } //hero finishes the maze else if (state == State.MAZE && (new EmptyRoom().set(4, 0, 7, 4)).inside(cellToPoint(cell))){ progress(); } } }
@Override protected void onZap(Ballistica bolt) { Blob corrosiveGas = Blob.seed(bolt.collisionPos, 50 + 10 * level(), CorrosiveGas.class); CellEmitter.center(bolt.collisionPos).burst( CorrosionParticle.SPLASH, 10 ); ((CorrosiveGas)corrosiveGas).setStrength(level()+1); GameScene.add(corrosiveGas); for (int i : PathFinder.NEIGHBOURS9) { Char ch = Actor.findChar(bolt.collisionPos + i); if (ch != null) { processSoulMark(ch, chargesPerCast()); } } if (Actor.findChar(bolt.collisionPos) == null){ Dungeon.level.press(bolt.collisionPos, null, true); } }
@Override protected void activate(int cell) { for (int i : PathFinder.NEIGHBOURS9){ if (!Dungeon.level.solid[cell + i] && !Dungeon.level.pit[cell + i] && Actor.findChar(cell + i) == null) { Sheep sheep = new Sheep(); sheep.lifespan = Random.IntRange(5, 8); sheep.pos = cell + i; GameScene.add(sheep); Dungeon.level.press(sheep.pos, sheep); CellEmitter.get(sheep.pos).burst(Speck.factory(Speck.WOOL), 4); } } CellEmitter.get(cell).burst(Speck.factory(Speck.WOOL), 4); Sample.INSTANCE.play(Assets.SND_PUFF); }
@Override protected void onZap(Ballistica bolt) { Blob corrosiveGas = Blob.seed(bolt.collisionPos, 50 + 10 * level(), CorrosiveGas.class); CellEmitter.center(bolt.collisionPos).burst( CorrosionParticle.SPLASH, 10 ); ((CorrosiveGas)corrosiveGas).setStrength(level()+1); GameScene.add(corrosiveGas); for (int i : PathFinder.NEIGHBOURS9) { Char ch = Actor.findChar(bolt.collisionPos + i); if (ch != null) { processSoulMark(ch, chargesPerCast()); } } if (Actor.findChar(bolt.collisionPos) == null){ Dungeon.level.press(bolt.collisionPos, null, true); } }
@Override protected void activate(int cell) { for (int i : PathFinder.NEIGHBOURS9){ if (!Dungeon.level.solid[cell + i] && !Dungeon.level.pit[cell + i] && Actor.findChar(cell + i) == null) { Sheep sheep = new Sheep(); sheep.lifespan = Random.IntRange(5, 8); sheep.pos = cell + i; GameScene.add(sheep); Dungeon.level.press(sheep.pos, sheep); CellEmitter.get(sheep.pos).burst(Speck.factory(Speck.WOOL), 4); } } CellEmitter.get(cell).burst(Speck.factory(Speck.WOOL), 4); Sample.INSTANCE.play(Assets.SND_PUFF); }