Esempio n. 1
0
 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);
   }
 }
Esempio n. 2
0
 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();
 }