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; }
@Override public int price() { return isKnown() ? 30 * quantity : super.price(); } }
@Override public void doRead() { Sample.INSTANCE.play( Assets.SND_READ ); Invisibility.dispel(); teleportPreferringUnseen( curUser ); setKnown(); readAnimation(); }
@Override public int proc(Armor armor, Char attacker, Char defender, int damage ) { if (defender == Dungeon.hero && Random.Int(20) == 0){ ScrollOfTeleportation.teleportHero(Dungeon.hero); return 0; } return damage; }
public static void teleportPreferringUnseen( Hero hero ){ teleportHero( hero ); return; teleportHero( hero ); } else { int pos = Random.element(candidates); GLog.i( Messages.get(ScrollOfTeleportation.class, "tele") ); appear( hero, pos ); Dungeon.level.press( pos, hero ); Dungeon.observe();
"_-_ All other transfusion functionality has been removed")); changes.addButton( new ChangeButton(new ItemSprite(ItemSpriteSheet.SCROLL_KAUNAN, null), new ScrollOfTeleportation().trueName(), "The scroll of teleportation has been buffed. It now prioritizes sending the user to rooms they have not seen yet, and can teleport to secret rooms."));
@Override protected void activate(int cell) { ScrollOfTeleportation.teleportToLocation(curUser, cell); } }
@Override public int proc(Armor armor, Char attacker, Char defender, int damage ) { if (defender == Dungeon.hero && Random.Int(20) == 0){ ScrollOfTeleportation.teleportHero(Dungeon.hero); return 0; } return damage; }
public static void teleportPreferringUnseen( Hero hero ){ teleportHero( hero ); return; teleportHero( hero ); } else { int pos = Random.element(candidates); GLog.i( Messages.get(ScrollOfTeleportation.class, "tele") ); appear( hero, pos ); Dungeon.level.press( pos, hero ); Dungeon.observe();
"_-_ All other transfusion functionality has been removed")); changes.addButton( new ChangeButton(new ItemSprite(ItemSpriteSheet.SCROLL_KAUNAN, null), new ScrollOfTeleportation().trueName(), "The scroll of teleportation has been buffed. It now prioritizes sending the user to rooms they have not seen yet, and can teleport to secret rooms."));
@Override protected void activate(int cell) { ScrollOfTeleportation.teleportToLocation(curUser, cell); } }
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 void call() { Char ch = Actor.findChar( bolt.collisionPos ); if (ch == user){ ScrollOfTeleportation.teleportHero(user); wand.wandUsed(); } else if (ch != null && !ch.properties().contains(Char.Property.IMMOVABLE)) { 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 (((Mob) ch).state == ((Mob) ch).HUNTING)((Mob) ch).state = ((Mob) ch).WANDERING; ch.sprite.place(ch.pos); ch.sprite.visible = Dungeon.level.heroFOV[pos]; } } wand.wandUsed(); } });
@Override public void doRead() { Sample.INSTANCE.play( Assets.SND_READ ); Invisibility.dispel(); teleportPreferringUnseen( curUser ); setKnown(); readAnimation(); }
@Override public void onSelect(Integer target) { if (target != null) { //time isn't spent ((HeroSprite)curUser.sprite).read(); teleportToLocation(curUser, target); } }
@Override public int price() { return isKnown() ? 30 * quantity : super.price(); } }
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 void call() { Char ch = Actor.findChar( bolt.collisionPos ); if (ch == user){ ScrollOfTeleportation.teleportHero(user); wand.wandUsed(); } else if (ch != null && !ch.properties().contains(Char.Property.IMMOVABLE)) { 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 (((Mob) ch).state == ((Mob) ch).HUNTING)((Mob) ch).state = ((Mob) ch).WANDERING; ch.sprite.place(ch.pos); ch.sprite.visible = Dungeon.level.heroFOV[pos]; } } wand.wandUsed(); } });
@Override public void onSelect(Integer target) { if (target != null) { //time isn't spent ((HeroSprite)curUser.sprite).read(); teleportToLocation(curUser, target); } }
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; }