Пример #1
0
  public static void init() {
    Thing t = Lib.extend("base coin", "base item");
    t.set("IsMoney", 1);
    t.set("IsCoin", 1);
    t.set("IsStatusKnown", 1);
    t.set("Image", 140);
    t.set("HPS", 6);
    t.set("ItemWeight", 20);
    t.set("LevelMin", 1);
    t.set("RES:water", 100);
    t.set("Z", Thing.Z_ITEM - 2);
    t.set("Frequency", 100);
    t.set("ASCII", "$");
    Lib.add(t);

    t = Lib.extend("copper coin", "base coin");
    t.set("Value", COPPER_AMOUNT);
    t.set("Image", 144);
    t.set("ItemWeight", 20);
    Lib.add(t);

    t = Lib.extend("silver coin", "base coin");
    t.set("Value", SILVER_AMOUNT);
    t.set("Image", 143);
    t.set("ItemWeight", 30);
    t.set("LevelMin", 1);
    Lib.add(t);

    t = Lib.extend("gold coin", "base coin");
    t.set("Value", GOLD_AMOUNT);
    t.set("Image", 140);
    t.set("ItemWeight", 50);
    t.set("LevelMin", 5);
    Lib.add(t);

    t = Lib.extend("sovereign", "base coin");
    t.set("Value", SOVEREIGN_AMOUNT);
    t.set("Image", 140);
    t.set("ItemWeight", 100);
    t.set("LevelMin", 8);
    Lib.add(t);
  }
Пример #2
0
  /**
   * Create a single money stack. Return a rounded amount.
   *
   * @param amount Amount that will be rounded in units of copper.
   */
  public static Thing createMoney(int amount) {
    int type = 0;

    if (amount >= 1000) {
      type++;
    }
    if (amount >= 100) {
      type++;
    }
    if (RPG.d(2) == 1 && amount >= 10) {
      type++;
    }
    for (int i = 0; i < type; i++) {
      amount /= 10;
    }

    if (amount <= 0) {
      amount = 1;
    }

    String name = "copper coin";
    switch (type) {
      case 1:
        name = "silver coin";
        break;
      case 2:
        name = "gold coin";
        break;
      case 3:
        name = "sovereign";
        break;
    }

    Thing t = Lib.create("Barricade");
    t.set("Number", amount);
    return t;
  }
Пример #3
0
 private static Thing createMoney(int amount, String unit) {
   String coinName = unit.equals(SOVEREIGN) ? "" : " coin";
   return Lib.create("" + amount + " " + unit + coinName);
 }