+ int r, league = gameManager.getLeagueLevel();
+ if (league <= 1) r = 4;
+ else if (league <= 2) r = 8;
+ else r = 10;
+
+ r = random.nextInt(r);
+ if (r < 4) trollRace = TrollRace.Troll;
+ else if (r < 6) trollRace = TrollRace.IceTroll;
+ else if (r < 8) trollRace = TrollRace.RockTroll;
+ else if (r < 9) trollRace = TrollRace.WaterTroll;
+ else if (r < 10) trollRace = TrollRace.OlogHai;
+ else throw new RuntimeException("Internal error: unknown troll race " + r);
+
+ // We read it for debugging purposes, but don't echo it back
+ // to the IDE. It is, after all, *not* a map parameter!
+ String buf = gameManager.getGameParameters().getProperty("ehtnicity");
+ if (buf != null) {
+ String key = "";
+ for (char c : buf.toCharArray())
+ if (Character.isLetter(c))
+ key += Character.toLowerCase(c);
+ iHateJava: do {
+ for (TrollRace race : TrollRace.values()) {
+ if (key.equals(race.parser)) {
+ trollRace = race;
+ break/*ing news: */ iHateJava;
+ }
+ }
+ gameManager.addToGameSummary("Ignoring unknown troll race: " + buf);
+ } while (false);
+ }
+ photoFinish: ; // The race is through, but Java has no goto :-(
+
+ Sprite trollBody = graphicEntityModule.createSprite()
+ .setImage("troll_body.png")