Exemplo n.º 1
0
  @Override
  protected void evolve() {

    int from = WIDTH + 1;
    int to = Level.LENGTH - WIDTH - 1;

    int[] map = Dungeon.level.map;
    boolean regrowth = false;

    boolean visible = false;

    for (int pos = from; pos < to; pos++) {
      if (cur[pos] > 0) {

        off[pos] = cur[pos];
        volume += off[pos];

        if (map[pos] == Terrain.EMBERS) {
          map[pos] = Terrain.GRASS;
          regrowth = true;
        }

        visible = visible || Dungeon.visible[pos];

      } else {
        off[pos] = 0;
      }
    }

    Hero hero = Dungeon.hero;
    if (hero.isAlive() && hero.visibleEnemies() == 0 && cur[hero.pos] > 0) {
      Buff.affect(hero, Shadows.class).prolong();
    }

    if (regrowth) {
      GameScene.updateMap();
    }

    if (visible) {
      Journal.add(Journal.Feature.GARDEN);
    }
  }
Exemplo n.º 2
0
    public StatsTab() {

      Hero hero = Dungeon.hero;

      BitmapText title =
          PixelScene.createText(
              Utils.format(TXT_TITLE, hero.lvl, hero.className()).toUpperCase(Locale.ENGLISH), 9);
      title.hardlight(TITLE_COLOR);
      title.measure();
      add(title);

      RedButton btnCatalogus =
          new RedButton(TXT_CATALOGUS) {
            @Override
            protected void onClick() {
              hide();
              GameScene.show(new WndCatalogus());
            }
          };
      btnCatalogus.setRect(
          0, title.y + title.height(), btnCatalogus.reqWidth() + 2, btnCatalogus.reqHeight() + 2);
      add(btnCatalogus);

      RedButton btnJournal =
          new RedButton(TXT_JOURNAL) {
            @Override
            protected void onClick() {
              hide();
              GameScene.show(new WndJournal());
            }
          };
      btnJournal.setRect(
          btnCatalogus.right() + 1,
          btnCatalogus.top(),
          btnJournal.reqWidth() + 2,
          btnJournal.reqHeight() + 2);
      add(btnJournal);

      // mod
      RedButton btnSkills =
          new RedButton(TXT_SKILLS) {
            @Override
            protected void onClick() {
              hide();
              GameScene.show(new WndSkills());
            }
          };
      btnSkills.setRect(
          btnJournal.right() + 1,
          btnJournal.top(),
          btnSkills.reqWidth() + 2,
          btnSkills.reqHeight() + 2);
      add(btnSkills);

      pos = btnCatalogus.bottom() + GAP;

      statSlot(TXT_STR, hero.STR());
      statSlot(TXT_HEALTH, hero.HP + "/" + hero.HT);
      statSlot(TXT_EXP, hero.exp + "/" + hero.maxExp());

      pos += GAP;

      statSlot(TXT_GOLD, Statistics.goldCollected);
      statSlot(TXT_DEPTH, Statistics.deepestFloor);

      pos += GAP;
    }