Exemplo n.º 1
0
  @Override
  public boolean attack(Char enemy) {

    for (int i = 1; i < Ballistica.distance; i++) {

      int pos = Ballistica.trace[i];

      Char ch = Actor.findChar(pos);
      if (ch == null) {
        continue;
      }

      if (hit(this, ch, true)) {
        ch.damage(Random.NormalIntRange(14, 20), this);

        if (Dungeon.visible[pos]) {
          ch.getSprite().flash();
          CellEmitter.center(pos).burst(PurpleParticle.BURST, Random.IntRange(1, 2));
        }

        if (!ch.isAlive() && ch == Dungeon.hero) {
          Dungeon.fail(
              Utils.format(ResultDescriptions.MOB, Utils.indefinite(getName()), Dungeon.depth));
          GLog.n(TXT_DEATHGAZE_KILLED, getName());
        }
      } else {
        ch.getSprite().showStatus(CharSprite.NEUTRAL, ch.defenseVerb());
      }
    }

    return true;
  }
Exemplo n.º 2
0
  public static void saveLevel() throws IOException {
    Bundle bundle = new Bundle();
    bundle.put(LEVEL, level);

    OutputStream output =
        Game.instance.openFileOutput(
            Utils.format(depthFile(hero.heroClass), depth), Game.MODE_PRIVATE);
    Bundle.write(bundle, output);
    output.close();
  }
Exemplo n.º 3
0
 @Override
 public String info() {
   switch (quantity) {
     case 0:
       return TXT_COLLECT;
     case 1:
       return TXT_INFO_1;
     default:
       return Utils.format(TXT_INFO, quantity);
   }
 }
Exemplo n.º 4
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");
  }
Exemplo n.º 5
0
  public static void deleteGame(HeroClass cl, boolean deleteLevels) {

    Game.instance.deleteFile(gameFile(cl));

    if (deleteLevels) {
      int depth = 1;
      while (Game.instance.deleteFile(Utils.format(depthFile(cl), depth))) {
        depth++;
      }
    }

    GamesInProgress.delete(cl);
  }
  public void showStatus(int color, String text, Object... args) {
    if (getVisible()) {
      if (args.length > 0) {
        text = Utils.format(text, args);
      }

      if (ModdingMode.getClassicTextRenderingMode()) {
        if (ch != null) {
          FloatingText.show(x + width * 0.5f, y, ch.getPos(), text, color);
        } else {
          FloatingText.show(x + width * 0.5f, y, text, color);
        }
      } else {
        if (ch != null) {
          SystemFloatingText.show(x + width * 0.5f, y, ch.getPos(), text, color);
        } else {
          SystemFloatingText.show(x + width * 0.5f, y, text, color);
        }
      }
    }
  }
Exemplo n.º 7
0
 @Override
 public String info() {
   return String.format(TXT_INFO, Utils.indefinite(plantName), desc());
 }
Exemplo n.º 8
0
 @Override
 public String toString() {
   return levelKnown ? Utils.format(TXT_TO_STRING, super.toString(), STR) : super.toString();
 }