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--;
     }
   }
 }