private static void doAttributes(final Creature cr, final CreatureType ct) {
   int attnum = ct.attnum.aValue();
   final EnumMap<Attribute, Integer> attcap = new EnumMap<Attribute, Integer>(Attribute.class);
   for (final Attribute at : Attribute.values()) {
     if (ct.attributeCap.containsKey(at)) {
       attcap.put(at, ct.attributeCap.get(at).aValue());
     } else {
       attcap.put(at, 10);
     }
   }
   for (final Attribute a : Attribute.values()) {
     attnum -= Math.min(4, cr.skill().getAttribute(a, false));
   }
   while (attnum > 0) {
     Attribute a = i.rng.randFromArray(Attribute.values());
     if (a == WISDOM && cr.alignment() == Alignment.LIBERAL && i.rng.likely(4)) {
       a = HEART;
     }
     if (a == HEART && cr.alignment() == Alignment.CONSERVATIVE && i.rng.likely(4)) {
       a = WISDOM;
     }
     if (cr.skill().getAttribute(a, false) < attcap.get(a)) {
       cr.skill().attribute(a, +1);
       attnum--;
     }
   }
 }
 @Override
 public void xmlSet(final String key, final String value) {
   switch (mode) {
     case DEFAULT:
       if ("age".equals(key)) {
         age = Age.valueOf(Xml.getText(value));
       } else if ("gender".equals(key)) {
         gender = Gender.valueOf(Xml.getText(value));
       } else if ("alignment".equals(key)) {
         alignment = Enum.valueOf(Alignment.class, Xml.getText(value));
       } else if ("money".equals(key)) {
         money = new Range(Xml.getText(value));
       } else if ("juice".equals(key)) {
         juice = new Range(Xml.getText(value));
       } else if ("infiltration".equals(key)) {
         infiltration = new Range(Xml.getText(value));
       } else if ("ccs".equals(key)) {
         ccs = Xml.getBoolean(value);
       } else if ("animalgloss".equals(key)) {
         animalGloss = Animal.valueOf(value);
       } else if ("lcsname".equals(key)) {
         lcsname = Xml.getText(value);
       } else if ("attnum".equals(key)) {
         attnum = new Range(Xml.getText(value));
       } else if ("teaches".equals(key)) {
         teaches = Activity.valueOf(value);
       } else if ("police".equals(key)) {
         police = Xml.getBoolean(value);
       } else if ("observationskill".equals(key)) {
         observationSkill = CheckDifficulty.valueOf(value);
       } else if ("receptive".equals(key)) {
         receptive = Xml.getBoolean(value);
       } else if ("coreskill".equals(key)) {
         coreSkill = Skill.valueOf(value);
       } else if ("influence".equals(key)) {
         influence = Xml.getInt(value);
       } else if ("seduce".equals(key)) {
         seduce = CheckDifficulty.valueOf(value);
       } else if ("stub".equals(key)) {
         stub = Xml.getBoolean(value);
       } else {
         Log.w(Game.LCS, "Oops: " + key + "=" + value);
       }
       break;
     case ARMOR:
       if ("item".equals(key)) {
         final ArmorType at = Game.type.armor.get("ARMOR_" + Xml.getText(value));
         if (at == null) {
           Log.e(Game.LCS, "No such armortype:" + Xml.getText(value));
         } else {
           armorTypes.add(at);
         }
       } else {
         Log.w(Game.LCS, "Bad key:" + key + "=" + value);
       }
       break;
     case WEAPON:
       if ("item".equals(key)) {
         weapontypes.add(new WeaponAssigner(Xml.getText(value)));
       } else {
         Log.w(Game.LCS, "Bad key:" + key + "=" + value);
       }
       break;
     case NAMES:
       if ("item".equals(key)) {
         names.add(Xml.getText(value));
       } else {
         Log.w(Game.LCS, "Bad key:" + key + "=" + value);
       }
       break;
     case SPECIALS:
       if ("item".equals(key)) {
         specials.add(Specials.valueOf(Xml.getText(value)));
       } else {
         Log.w(Game.LCS, "Bad key:" + key + "=" + value);
       }
       break;
     case WORKLOCATION:
       if ("item".equals(key)) {
         workLocation.add(AbstractSiteType.type(value));
       } else {
         Log.w(Game.LCS, "Bad key:" + key + "=" + value);
       }
       break;
     case SKILL:
       skills.put(Skill.valueOf(key), new Range(value));
       break;
     case ATTCAP:
       attributeCap.put(Attribute.valueOf(key), new Range(value));
       break;
     case ATTRIBUTE:
       attribute.put(Attribute.valueOf(key), new Range(value));
       break;
     case CRIMES:
       if (value.length() != 0) {
         offences.add(Crime.valueOf(value));
       } else {
         offences.add(null);
       }
       break;
     default:
       Log.e("LCS", "CreatureType xmlSet default:" + mode);
   }
 }