@Override public void die(Object cause) { curAction = null; DewVial.autoDrink(this); if (isAlive()) { new Flare(8, 32).color(0xFFFF66, true).show(sprite, 2f); return; } Actor.fixTime(); super.die(cause); Ankh ankh = (Ankh) belongings.getItem(Ankh.class); if (ankh == null) { reallyDie(cause); } else { Dungeon.deleteGame(Dungeon.hero.heroClass, false); GameScene.show(new WndResurrect(ankh, cause)); } }
public static void reallyDie(Object cause) { int length = Level.LENGTH; int[] map = Dungeon.level.map; boolean[] visited = Dungeon.level.visited; boolean[] discoverable = Level.discoverable; for (int i = 0; i < length; i++) { int terr = map[i]; if (discoverable[i]) { visited[i] = true; if ((Terrain.flags[terr] & Terrain.SECRET) != 0) { Level.set(i, Terrain.discover(terr)); GameScene.updateMap(i); } } } Bones.leave(); Dungeon.observe(); Dungeon.hero.belongings.identify(); int pos = Dungeon.hero.pos; ArrayList<Integer> passable = new ArrayList<Integer>(); for (Integer ofs : Level.NEIGHBOURS8) { int cell = pos + ofs; if ((Level.passable[cell] || Level.avoid[cell]) && Dungeon.level.heaps.get(cell) == null) { passable.add(cell); } } Collections.shuffle(passable); ArrayList<Item> items = new ArrayList<Item>(Dungeon.hero.belongings.backpack.items); for (Integer cell : passable) { if (items.isEmpty()) { break; } Item item = Random.element(items); Dungeon.level.drop(item, cell).sprite.drop(pos); items.remove(item); } GameScene.gameOver(); if (cause instanceof Hero.Doom) { ((Hero.Doom) cause).onDeath(); } Dungeon.deleteGame(Dungeon.hero.heroClass, true); }
private boolean actAscend(HeroAction.Ascend action) { int stairs = action.dst; if (pos == stairs && pos == Dungeon.level.entrance) { if (Dungeon.depth == 1) { if (belongings.getItem(Amulet.class) == null) { GameScene.show(new WndMessage(TXT_LEAVE)); ready(); } else { Dungeon.win(ResultDescriptions.WIN); Dungeon.deleteGame(Dungeon.hero.heroClass, true); Game.switchScene(SurfaceScene.class); } } else { curAction = null; Hunger hunger = buff(Hunger.class); if (hunger != null && !hunger.isStarving()) { hunger.satisfy(-Hunger.STARVING / 10); } InterlevelScene.mode = InterlevelScene.Mode.ASCEND; Game.switchScene(InterlevelScene.class); } return false; } else if (getCloser(stairs)) { return true; } else { ready(); return false; } }