private Conclusion parseConclusion(Json.Object conclusionObject) {
   checkNotNull(conclusionObject, "Trigger must have a conclusion");
   Conclusion.Builder builder = new Conclusion.Builder();
   String text = conclusionObject.getString("text");
   checkNotNull(text, "Conclusion must have text");
   builder.text(text);
   builder.points(conclusionObject.getInt("points"));
   String skillReward = conclusionObject.getString("skill");
   if (skillReward != null) {
     builder.skill(Skill.named(skillReward));
   }
   return builder.build();
 }
 private Story parseStory(Json.Object jsonStory) {
   final String text = jsonStory.getString("text");
   Story.Builder storyBuilder = Story.withText(text);
   Json.Array jsonTriggers = jsonStory.getArray("triggers");
   for (int i = 0, limit = jsonTriggers.length(); i < limit; i++) {
     Json.Object jsonTrigger = jsonTriggers.getObject(i);
     parseTrigger(jsonTrigger, storyBuilder);
   }
   return storyBuilder.build();
 }
 private void parseTrigger(Json.Object jsonTrigger, Story.Builder storyBuilder) {
   String skillString = jsonTrigger.getString("skill");
   Json.Object conclusionObject = jsonTrigger.getObject("conclusion");
   Conclusion conclusion = parseConclusion(conclusionObject);
   if (skillString != null) {
     Skill skill = Skill.named(skillString);
     storyBuilder.trigger(SkillTrigger.skill(skill).conclusion(conclusion));
   } else {
     NoSkillTrigger noSkill = new NoSkillTrigger(conclusion);
     storyBuilder.trigger(noSkill);
   }
 }
  public Encounter parse(Json.Object object) {
    final String name = object.getString("name");
    final String imageKey = object.getString("image");

    Encounter.Builder encounterBuilder = Encounter.with(name).image(imageKey);
    Json.Array jsonReactions = object.getArray("reactions");
    for (int i = 0, limit = jsonReactions.length(); i < limit; i++) {
      Json.Object jsonReaction = jsonReactions.getObject(i);
      String reactionName = jsonReaction.getString("name");
      Reaction.Builder reactionBuilder = Reaction.create(reactionName);
      try {
        Json.Array array = jsonReaction.getArray("stories");
        for (int storyIndex = 0; storyIndex < array.length(); storyIndex++) {
          reactionBuilder.story(parseStory(array.getObject(storyIndex)));
        }
        encounterBuilder.reaction(reactionBuilder.build());
      } catch (Exception e) {
        throw new IllegalStateException("Failed to parse encounter " + name, e);
      }
    }
    return encounterBuilder.build();
  }