Example #1
1
  public static void addDebugModifications(Thing h) {
    h.set("IsImmortal", 1);
    h.set("IsDebugMode", 1);

    if ("QuickTester".equals(h.getString("HeroName"))) {
      h.addThing(Spell.create("Annihilation"));
      h.addThing(Spell.create("Blaze"));
      h.addThing(Spell.create("Ultimate Destruction"));
      Wish.makeWish("skills", 100);
    }
  }
Example #2
0
  public static Thing createHero(String name, String race, String profession) {

    Thing h = createBaseHero(race);
    Game.instance().initialize(h);

    if ((name == null) || (name.equals(""))) name = "Tester";
    setHeroName(h, name);

    // Debug mode modifications
    if (Game.isDebug()) {
      addDebugModifications(h);
    }

    // Race Modifications
    applyRace(h, race);

    // Professions
    applyProfession(h, profession);

    // Bonus items based on skills
    applyBonusItems(h);

    // set up HPS and MPS
    h.set(RPG.ST_HPSMAX, h.getBaseStat(RPG.ST_TG) + RPG.d(6));
    h.set(RPG.ST_MPSMAX, h.getBaseStat(RPG.ST_WP) + RPG.d(6));

    h.set(RPG.ST_HPS, h.getStat(RPG.ST_HPSMAX));
    h.set(RPG.ST_MPS, h.getStat(RPG.ST_MPSMAX));

    Being.utiliseItems(h);

    Wish.makeWish("id", 100);

    // score starts at zero
    h.set("Score", 0);

    // religion
    ArrayList gods = Gods.getPossibleGods(h);
    int gl = gods.size();
    if (gl > 0) {
      h.set("Religion", gods.get(RPG.r(gl)));
    } else {
      Game.warn("No religion available for " + race + " " + profession);
    }

    createHeroHistory(h);

    // performance improvement with flattened properties
    h.flattenProperties();

    return h;
  }