@Override public CMObject newInstance() { try { final DefaultCharStats newStats = getClass().newInstance(); if (newStats.myRace == null) newStats.myRace = CMClass.getRace("StdRace"); return newStats; } catch (final Exception e) { return new DefaultCharStats(); } }
// create a new one of these @Override public CMObject copyOf() { final DefaultCharStats newOne = new DefaultCharStats(); if (myClasses != null) newOne.myClasses = myClasses.clone(); if (myRace != null) newOne.myRace = myRace; if (myLevels != null) newOne.myLevels = myLevels.clone(); if (bodyAlterations != null) newOne.bodyAlterations = bodyAlterations.clone(); if (profAdj != null) newOne.profAdj = new TreeMap<String, Integer>(profAdj); newOne.stats = stats.clone(); return newOne; }