@Override public void onOperateComplete() { if (curAction instanceof HeroAction.Unlock) { if (theKey != null) { theKey.detach(belongings.backpack); theKey = null; } int doorCell = ((HeroAction.Unlock) curAction).dst; int door = Dungeon.level.map[doorCell]; Level.set(doorCell, door == Terrain.LOCKED_DOOR ? Terrain.DOOR : Terrain.UNLOCKED_EXIT); GameScene.updateMap(doorCell); } else if (curAction instanceof HeroAction.OpenChest) { if (theKey != null) { theKey.detach(belongings.backpack); theKey = null; } Heap heap = Dungeon.level.heaps.get(((HeroAction.OpenChest) curAction).dst); if (heap.type == Type.SKELETON) { Sample.INSTANCE.play(Assets.SND_BONES); } heap.open(this); } curAction = null; super.onOperateComplete(); }
private void actPickUp(HeroAction.PickUp action) { int dst = action.dst; if (pos == dst) { Heap heap = Dungeon.level.heaps.get(pos); if (heap != null) { Item item = heap.pickUp(); if (item.doPickUp(this)) { if (item instanceof Dewdrop) { } else { if ((item instanceof ScrollOfUpgrade && ((ScrollOfUpgrade) item).isKnown()) || (item instanceof PotionOfStrength && ((PotionOfStrength) item).isKnown())) { GLog.p(TXT_YOU_NOW_HAVE, item.name()); } else { GLog.i(TXT_YOU_NOW_HAVE, item.name()); } } if (!heap.isEmpty()) { GLog.i(TXT_SOMETHING_ELSE); } curAction = null; } else { Dungeon.level.drop(item, pos).sprite.drop(); ready(); } } else { ready(); } } else if (getCloser(dst)) { } else { ready(); } }