Example #1
0
 public RTerrain(Element e, String... path) {
   super(e.getAttributeValue("id"), path);
   color = e.getAttributeValue("color");
   text = e.getAttributeValue("char");
   description = e.getText();
   String mov = e.getAttributeValue("mod");
   if (mov != null) {
     modifier = Modifier.valueOf(mov.toUpperCase());
   }
   String mod = e.getAttributeValue("sub");
   if (mod != null) {
     type = Subtype.valueOf(mod.toUpperCase());
   }
 }
Example #2
0
 public Element toElement() {
   Element terrain = new Element("type");
   terrain.setAttribute("id", id);
   terrain.setAttribute("char", text);
   terrain.setAttribute("color", color);
   if (modifier != Modifier.NONE) {
     terrain.setAttribute("mod", modifier.toString());
   }
   if (description != null && !description.isEmpty()) {
     terrain.setText(description);
   }
   if (type != Subtype.NONE) {
     terrain.setAttribute("sub", type.toString());
   }
   return terrain;
 }