private void blink( int target ) { Ballistica route = new Ballistica( pos, target, Ballistica.PROJECTILE); int cell = route.collisionPos; //can't occupy the same cell as another char, so move back one. if (Actor.findChar( cell ) != null && cell != this.pos) cell = route.path.get(route.dist-1); if (Dungeon.level.avoid[ cell ]){ ArrayList<Integer> candidates = new ArrayList<>(); for (int n : PathFinder.NEIGHBOURS8) { cell = route.collisionPos + n; if (Dungeon.level.passable[cell] && Actor.findChar( cell ) == null) { candidates.add( cell ); } } if (candidates.size() > 0) cell = Random.element(candidates); else { delay = BLINK_DELAY; return; } } ScrollOfTeleportation.appear( this, cell ); delay = BLINK_DELAY; }
public static int spawnImages( Hero hero, int nImages ){ ArrayList<Integer> respawnPoints = new ArrayList<Integer>(); for (int i = 0; i < PathFinder.NEIGHBOURS8.length; i++) { int p = hero.pos + PathFinder.NEIGHBOURS8[i]; if (Actor.findChar( p ) == null && Dungeon.level.passable[p]) { respawnPoints.add( p ); } } int spawned = 0; while (nImages > 0 && respawnPoints.size() > 0) { int index = Random.index( respawnPoints ); MirrorImage mob = new MirrorImage(); mob.duplicate( hero ); GameScene.add( mob ); ScrollOfTeleportation.appear( mob, respawnPoints.get( index ) ); respawnPoints.remove( index ); nImages--; spawned++; } return spawned; }
private void blink( int target ) { Ballistica route = new Ballistica( pos, target, Ballistica.PROJECTILE); int cell = route.collisionPos; //can't occupy the same cell as another char, so move back one. if (Actor.findChar( cell ) != null && cell != this.pos) cell = route.path.get(route.dist-1); if (Dungeon.level.avoid[ cell ]){ ArrayList<Integer> candidates = new ArrayList<>(); for (int n : PathFinder.NEIGHBOURS8) { cell = route.collisionPos + n; if (Dungeon.level.passable[cell] && Actor.findChar( cell ) == null) { candidates.add( cell ); } } if (candidates.size() > 0) cell = Random.element(candidates); else { delay = BLINK_DELAY; return; } } ScrollOfTeleportation.appear( this, cell ); delay = BLINK_DELAY; }
public static int spawnImages( Hero hero, int nImages ){ ArrayList<Integer> respawnPoints = new ArrayList<Integer>(); for (int i = 0; i < PathFinder.NEIGHBOURS8.length; i++) { int p = hero.pos + PathFinder.NEIGHBOURS8[i]; if (Actor.findChar( p ) == null && Dungeon.level.passable[p]) { respawnPoints.add( p ); } } int spawned = 0; while (nImages > 0 && respawnPoints.size() > 0) { int index = Random.index( respawnPoints ); MirrorImage mob = new MirrorImage(); mob.duplicate( hero ); GameScene.add( mob ); ScrollOfTeleportation.appear( mob, respawnPoints.get( index ) ); respawnPoints.remove( index ); nImages--; spawned++; } return spawned; }
ScrollOfTeleportation.appear( defender, pos ); Dungeon.level.press( pos, defender );
ScrollOfTeleportation.appear( defender, pos ); Dungeon.level.press( pos, defender );
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(); } }
int pos = Random.element(candidates); GLog.i( Messages.get(ScrollOfTeleportation.class, "tele") ); appear( hero, pos ); Dungeon.level.press( pos, hero ); Dungeon.observe();
int pos = Random.element(candidates); GLog.i( Messages.get(ScrollOfTeleportation.class, "tele") ); appear( hero, pos ); Dungeon.level.press( pos, hero ); Dungeon.observe();
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(); } }
ScrollOfTeleportation.appear( curUser, target ); CellEmitter.get( target ).burst( Speck.factory( Speck.WOOL ), 10 ); Sample.INSTANCE.play( Assets.SND_PUFF );
ScrollOfTeleportation.appear( curUser, target ); CellEmitter.get( target ).burst( Speck.factory( Speck.WOOL ), 10 ); Sample.INSTANCE.play( Assets.SND_PUFF );
pris.state = pris.HUNTING; GameScene.add(pris, 1); ScrollOfTeleportation.appear(pris, bestPos);
pris.state = pris.HUNTING; GameScene.add(pris, 1); ScrollOfTeleportation.appear(pris, bestPos);
GameScene.add( undead ); ScrollOfTeleportation.appear( undead, j ); new Flare( 3, 32 ).color( 0x000000, false ).show( undead.sprite, 2f ) ;
ScrollOfTeleportation.appear( hero, returnPos ); for(Mob m : Dungeon.level.mobs){ if (m.pos == hero.pos){
GameScene.add( undead ); ScrollOfTeleportation.appear( undead, j ); new Flare( 3, 32 ).color( 0x000000, false ).show( undead.sprite, 2f ) ;
ScrollOfTeleportation.appear( hero, returnPos ); for(Mob m : Dungeon.level.mobs){ if (m.pos == hero.pos){