Exemplo n.º 1
0
  public String parseFMEchecStatsString(Objet obj, double poid) {
    StringBuilder stats = new StringBuilder();
    boolean isFirst = true;
    for (SpellEffect SE : obj.Effects) {
      if (!isFirst) stats.append(",");

      String[] infos = SE.getArgs().split(";");
      try {
        stats
            .append(Integer.toHexString(SE.getEffectID()))
            .append("#")
            .append(infos[0])
            .append("#")
            .append(infos[1])
            .append("#0#")
            .append(infos[5]);
      } catch (Exception e) {
        e.printStackTrace();
        continue;
      }
      ;

      isFirst = false;
    }

    for (Entry<Integer, Integer> entry : obj.Stats.getMap().entrySet()) {
      // En cas d'echec les stats négatives Chance,Agi,Intel,Force,Portee,Vita augmentes
      int newstats = 0;

      if (entry.getKey() == 152
          || entry.getKey() == 154
          || entry.getKey() == 155
          || entry.getKey() == 157
          || entry.getKey() == 116
          || entry.getKey() == 153) {
        float a = (float) ((entry.getValue() * poid) / 100);
        if (a < 1) a = 1;
        float chute = (float) (entry.getValue() + a);
        newstats = (int) Math.floor(chute);
        // On limite la chute du négatif a sont maximum
        if (newstats
            > Metier.getBaseMaxJet(
                obj.getTemplate().getID(), Integer.toHexString(entry.getKey()))) {
          newstats =
              Metier.getBaseMaxJet(obj.getTemplate().getID(), Integer.toHexString(entry.getKey()));
        }
      } else {
        if (entry.getKey() == 127 || entry.getKey() == 101)
          continue; // PM, pas de négatif ainsi que PA

        float chute = (float) (entry.getValue() - ((entry.getValue() * poid) / 100));
        newstats = (int) Math.floor(chute);
      }
      if (newstats < 1) continue;
      String jet = "0d0+" + newstats;
      if (!isFirst) stats.append(",");
      stats
          .append(Integer.toHexString(entry.getKey()))
          .append("#")
          .append(Integer.toHexString(newstats))
          .append("#0#0#")
          .append(jet);
      isFirst = false;
    }

    for (Entry<Integer, String> entry : obj.txtStats.entrySet()) {
      if (!isFirst) stats.append(",");
      stats.append(Integer.toHexString(entry.getKey())).append("#0#0#0#").append(entry.getValue());
      isFirst = false;
    }
    return stats.toString();
  }
Exemplo n.º 2
0
  /* *********FM SYSTEM********* */
  public String parseFMStatsString(String statsstr, Objet obj, int add, boolean negatif) {
    StringBuilder stats = new StringBuilder();
    boolean isFirst = true;
    for (SpellEffect SE : obj.Effects) {
      if (!isFirst) stats.append(",");

      String[] infos = SE.getArgs().split(";");
      try {
        stats
            .append(Integer.toHexString(SE.getEffectID()))
            .append("#")
            .append(infos[0])
            .append("#")
            .append(infos[1])
            .append("#0#")
            .append(infos[5]);
      } catch (Exception e) {
        e.printStackTrace();
        continue;
      }
      ;

      isFirst = false;
    }

    for (Entry<Integer, Integer> entry : obj.Stats.getMap().entrySet()) {
      if (!isFirst) stats.append(",");
      if (Integer.toHexString(entry.getKey()).compareTo(statsstr) == 0) {
        int newstats = 0;
        if (negatif) {
          newstats = entry.getValue() - add;
          if (newstats < 1) continue;
        } else {
          newstats = entry.getValue() + add;
        }
        String jet = "0d0+" + newstats;
        stats
            .append(Integer.toHexString(entry.getKey()))
            .append("#")
            .append(Integer.toHexString(entry.getValue()))
            .append(add)
            .append("#0#0#")
            .append(jet);
      } else {
        String jet = "0d0+" + entry.getValue();
        stats
            .append(Integer.toHexString(entry.getKey()))
            .append("#")
            .append(Integer.toHexString(entry.getValue()))
            .append("#0#0#")
            .append(jet);
      }
      isFirst = false;
    }

    for (Entry<Integer, String> entry : obj.txtStats.entrySet()) {
      if (!isFirst) stats.append(",");
      stats.append(Integer.toHexString(entry.getKey())).append("#0#0#0#").append(entry.getValue());
      isFirst = false;
    }

    return stats.toString();
  }