private static void doRandomSkills(final Creature cr) {
   int randomskills = i.rng.nextInt(4) + 4;
   if (cr.age() > 20) {
     randomskills += randomskills * (cr.age() - 20.0) / 20.0;
   } else {
     randomskills -= (20 - cr.age()) / 2;
   }
   // RANDOM STARTING SKILLS
   while (randomskills > 0) {
     final Skill randomskill = i.rng.randFromArray(Skill.values());
     // 95% chance of not allowing some skills for anybody...
     if (randomskill == Skill.SHOOTINGUP) {
       continue; // don't automatically give skill in this, it's not useful
     }
     if (i.rng.likely(20)
         && (randomskill == HEAVYWEAPONS
             || randomskill == SMG
             || randomskill == SWORD
             || randomskill == RIFLE
             || randomskill == AXE
             || randomskill == CLUB
             || randomskill == PSYCHOLOGY)) {
       continue;
     }
     // 90% chance of not allowing some skills, other than
     // for conservatives
     if (i.rng.likely(10) && cr.alignment() != Alignment.CONSERVATIVE) {
       if (randomskill == SHOTGUN) {
         continue;
       }
       if (randomskill == PISTOL) {
         continue;
       }
     }
     if (cr.skill().skillCap(randomskill, true) > cr.skill().skill(randomskill)) {
       cr.skill().setSkill(randomskill, cr.skill().skill(randomskill) + 1);
       randomskills--;
     }
     while (true) {
       if (randomskills != 0
           && i.rng.likely(2)
           && cr.skill().skillCap(randomskill, true) > cr.skill().skill(randomskill)
           && cr.skill().skill(randomskill) < 4) {
         cr.skill().setSkill(randomskill, cr.skill().skill(randomskill) + 1);
         randomskills--;
       } else {
         break;
       }
     }
   }
 }
 @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);
   }
 }