@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 void handle(int cell) { if (cell == -1) { return; } Char ch; Heap heap; if (Dungeon.level.map[cell] == Terrain.ALCHEMY && cell != pos) { curAction = new HeroAction.Cook(cell); } else if (Level.fieldOfView[cell] && (ch = Actor.findChar(cell)) instanceof Mob) { if (ch instanceof Mob.NPC) { curAction = new HeroAction.Interact((Mob.NPC) ch); } else { curAction = new HeroAction.Attack(ch); } } else if ((heap = Dungeon.level.heaps.get(cell)) != null) { switch (heap.type) { case HEAP: curAction = new HeroAction.PickUp(cell); break; case FOR_SALE: curAction = heap.size() == 1 && heap.peek().price() > 0 ? new HeroAction.Buy(cell) : new HeroAction.PickUp(cell); break; default: curAction = new HeroAction.OpenChest(cell); } } else if (Dungeon.level.map[cell] == Terrain.LOCKED_DOOR || Dungeon.level.map[cell] == Terrain.LOCKED_EXIT) { curAction = new HeroAction.Unlock(cell); } else if (cell == Dungeon.level.exit) { curAction = new HeroAction.Descend(cell); } else if (cell == Dungeon.level.entrance) { curAction = new HeroAction.Ascend(cell); } else { curAction = new HeroAction.Move(cell); lastAction = null; } act(); }
private boolean getCloser(final int target) { if (rooted) { return false; } int step = -1; if (Level.adjacent(pos, target)) { if (Actor.findChar(target) == null) { if (Level.pit[target] && !flying && !Chasm.jumpConfirmed) { Chasm.heroJump(this); interrupt(); return false; } if (Level.passable[target] || Level.avoid[target]) { step = target; } } } else { int len = Level.LENGTH; boolean[] p = Level.passable; boolean[] v = Dungeon.level.visited; boolean[] m = Dungeon.level.mapped; boolean[] passable = new boolean[len]; for (int i = 0; i < len; i++) { passable[i] = p[i] && (v[i] || m[i]); } step = Dungeon.findPath(this, pos, target, passable, Level.fieldOfView); } if (step != -1) { sprite.move(pos, step); move(step); spend(1 / speed()); return true; } else { return false; } }
@Override protected void evolve() { super.evolve(); int levelDamage = 5 + Dungeon.depth * 5; Char ch; for (int i = 0; i < LENGTH; i++) { if (cur[i] > 0 && (ch = Actor.findChar(i)) != null) { int damage = (ch.HT + levelDamage) / 40; if (damage < 1) { damage = 1; } ch.damage(damage, this); } } Blob blob = Dungeon.level.blobs.get(ParalyticGas.class); if (blob != null) { int par[] = blob.cur; for (int i = 0; i < LENGTH; i++) { int t = cur[i]; int p = par[i]; if (p >= t) { volume -= t; cur[i] = 0; } else { blob.volume -= p; par[i] = 0; } } } }