예제 #1
0
  public static void resetLevel() {

    Actor.clear();

    Arrays.fill(visible, false);

    level.reset();
    switchLevel(level, level.entrance);
  }
예제 #2
0
  public static Level loadLevel(HeroClass cl) throws IOException {

    Dungeon.level = null;
    Actor.clear();

    InputStream input = Game.instance.openFileInput(Utils.format(depthFile(cl), depth));
    Bundle bundle = Bundle.read(input);
    input.close();

    return (Level) bundle.get("level");
  }
예제 #3
0
  public static void init() {

    challenges = PixelDungeon.challenges();

    Actor.clear();

    PathFinder.setMapSize(Level.WIDTH, Level.HEIGHT);

    Scroll.initLabels();
    Potion.initColors();
    Wand.initWoods();
    Ring.initGems();

    Statistics.reset();
    Journal.reset();

    depth = 0;
    gold = 0;

    potionOfStrength = 0;
    scrollsOfUpgrade = 0;
    arcaneStyli = 0;
    dewVial = true;
    transmutation = Random.IntRange(6, 14);

    chapters = new HashSet<Integer>();

    Ghost.Quest.reset();
    WandMaker.Quest.reset();
    Blacksmith.Quest.reset();
    Imp.Quest.reset();

    Room.shuffleTypes();

    hero = new Hero();
    hero.live();

    Badges.reset();

    StartScene.curClass.initHero(hero);
  }
예제 #4
0
  public static Level newLevel() {

    Dungeon.level = null;
    Actor.clear();

    depth++;
    if (depth > Statistics.deepestFloor) {
      Statistics.deepestFloor = depth;

      if (Statistics.qualifiedForNoKilling) {
        Statistics.completedWithNoKilling = true;
      } else {
        Statistics.completedWithNoKilling = false;
      }
    }

    Arrays.fill(visible, false);

    Level level;
    switch (depth) {
      case 1:
      case 2:
      case 3:
      case 4:
        level = new SewerLevel();
        break;
      case 5:
        level = new SewerBossLevel();
        break;
      case 6:
      case 7:
      case 8:
      case 9:
        level = new PrisonLevel();
        break;
      case 10:
        level = new PrisonBossLevel();
        break;
      case 11:
      case 12:
      case 13:
      case 14:
        level = new CavesLevel();
        break;
      case 15:
        level = new CavesBossLevel();
        break;
      case 16:
      case 17:
      case 18:
      case 19:
        level = new CityLevel();
        break;
      case 20:
        level = new CityBossLevel();
        break;
      case 21:
        level = new LastShopLevel();
        break;
      case 22:
      case 23:
      case 24:
        level = new HallsLevel();
        break;
      case 25:
        level = new HallsBossLevel();
        break;
      case 26:
        level = new LastLevel();
        break;
      default:
        level = new DeadEndLevel();
        Statistics.deepestFloor--;
    }

    level.create();

    Statistics.qualifiedForNoKilling = !bossLevel();

    return level;
  }