Example #1
0
  static {
    CHAPTERS.put(
        ID_SEWERS,
        "The Dungeon lies right beneath the City, its upper levels actually constitute the City's sewer system. "
            + "Being nominally a part of the City, these levels are not that dangerous. No one will call it a safe place, "
            + "but at least you won't need to deal with evil magic here.");

    CHAPTERS.put(
        ID_PRISON,
        "Many years ago an underground prison was built here for the most dangerous criminals. At the time it seemed "
            + "like a very clever idea, because this place indeed was very hard to escape. But soon dark miasma started to permeate "
            + "from below, driving prisoners and guards insane. In the end the prison was abandoned, though some convicts "
            + "were left locked up here.");

    CHAPTERS.put(
        ID_CAVES,
        "The caves, which stretch down under the abandoned prison, are sparcely populated. They lie too deep to be exploited "
            + "by the City and they are too poor in minerals to interest the dwarves. In the past there was a trade outpost "
            + "somewhere here on the route between these two states, but it has perished since the decline of Dwarven Metropolis. "
            + "Only omnipresent gnolls and subterranean animals dwell here now.");

    CHAPTERS.put(
        ID_METROPOLIS,
        "Dwarven Metropolis was once the greatest of dwarven city-states. In its heyday the mechanized army of dwarves "
            + "has successfully repelled the invasion of the old god and his demon army. But it is said, that the returning warriors "
            + "have brought seeds of corruption with them, and that victory was the beginning of the end for the underground kingdom.");

    CHAPTERS.put(
        ID_HALLS,
        "In the past these levels were the outskirts of Metropolis. After the costly victory in the war with the old god "
            + "dwarves were too weakened to clear them of remaining demons. Gradually demons have tightened their grip on this place "
            + "and now it's called Demon Halls.\n\n"
            + "Very few adventurers have ever descended this far...");
  }
  public static void clear() {

    now = 0;

    all.clear();

    ids.clear();
  }
  public static void remove(Actor actor) {

    if (actor != null) {
      all.remove(actor);
      actor.onRemove();

      if (actor.id > 0) {
        ids.remove(actor.id);
      }
    }
  }
  @Override
  protected void layout() {
    clear();

    SparseArray<Image> newIcons = new SparseArray<Image>();

    for (Buff buff : ch.buffs()) {
      int icon = buff.icon();
      if (icon != NONE) {
        Image img = new Image(texture);
        img.frame(film.get(icon));
        img.x = x + members.size() * (SIZE + 2);
        img.y = y;
        add(img);

        newIcons.put(icon, img);
      }
    }

    for (Integer key : icons.keyArray()) {
      if (newIcons.get(key) == null) {
        Image icon = icons.get(key);
        icon.origin.set(SIZE / 2);
        add(icon);
        add(
            new AlphaTweener(icon, 0, 0.6f) {
              @Override
              protected void updateValues(float progress) {
                super.updateValues(progress);
                image.scale.set(1 + 5 * progress);
              };
            });
      }
    }

    icons = newIcons;
  }
Example #5
0
  public static void showChapter(int id) {

    if (Dungeon.chapters.contains(id)) {
      return;
    }

    String text = CHAPTERS.get(id);
    if (text != null) {
      WndStory wnd = new WndStory(text);
      if ((wnd.delay = 0.6f) > 0) {
        wnd.shadow.visible = wnd.chrome.visible = wnd.tf.visible = false;
      }

      Game.scene().add(wnd);

      Dungeon.chapters.add(id);
    }
  }
  private static void add(Actor actor, float time) {

    if (all.contains(actor)) {
      return;
    }

    ids.put(actor.id(), actor);

    all.add(actor);
    actor.time += time;
    actor.onAdd();

    if (actor instanceof Char) {
      Char ch = (Char) actor;
      for (Buff buff : ch.buffs()) {
        all.add(buff);
        buff.onAdd();
      }
    }
  }
 public static Actor findById(int id) {
   return ids.get(id);
 }