/** * Returns a non-null Collection of the Racial Sub Types for the Player Character represented by * the given CharID. * * <p>This method is value-semantic in that ownership of the returned Collection is transferred to * the class calling this method. Modification of the returned Collection will not modify this * RacialSubTypesFacet and modification of this RacialSubTypesFacet will not modify the returned * Collection. Modifications to the returned Collection will also not modify any future or * previous objects returned by this (or other) methods on RacialSubTypesFacet. * * @param id The CharID representing the Player Character for which the Racial Sub Types should be * returned * @return A non-null Collection of the Racial Sub Types for the Player Character represented by * the given CharID */ public Collection<RaceSubType> getRacialSubTypes(CharID id) { List<RaceSubType> racialSubTypes = new ArrayList<>(); Race race = raceFacet.get(id); if (race != null) { for (RaceSubType st : race.getSafeListFor(ListKey.RACESUBTYPE)) { racialSubTypes.add(st); } } Collection<PCTemplate> templates = templateFacet.getSet(id); if (!templates.isEmpty()) { List<RaceSubType> added = new ArrayList<>(); List<RaceSubType> removed = new ArrayList<>(); for (PCTemplate aTemplate : templates) { added.addAll(aTemplate.getSafeListFor(ListKey.RACESUBTYPE)); removed.addAll(aTemplate.getSafeListFor(ListKey.REMOVED_RACESUBTYPE)); } for (RaceSubType st : added) { racialSubTypes.add(st); } for (RaceSubType st : removed) { racialSubTypes.remove(st); } } return Collections.unmodifiableList(racialSubTypes); }
/** * Returns the index of the active AgeSet on the Player Character. * * <p>In general, use of this method outside of AgeSetFacet is discouraged. If this method is * being used, a serious analysis should be taking place to determine if the AgeSet itself (in * other words, the get method of AgeSetFacet) can be used instead. * * @param id The CharID identifying the Player Character for which the index of the active AgeSet * should be returned. * @return The index of the active AgeSet on the Player Character. */ public int getAgeSetIndex(CharID id) { BioSet bioSet = bioSetFacet.get(id); String region = regionFacet.getRegion(id); Race race = raceFacet.get(id); String raceName = race == null ? "" : race.getKeyName().trim(); List<String> values = bioSet.getValueInMaps(region, raceName, "BASEAGE"); if (values == null) { return 0; } int pcAge = ageFacet.getAge(id); int ageSet = -1; for (String s : values) { int setBaseAge = Integer.parseInt(s); if (pcAge < setBaseAge) { break; } ++ageSet; } // // Check to see if character is younger than earliest age group // if (ageSet < 0) { ageSet = 0; } return ageSet; }
/** * Returns the unarmed damage String for the Race of the Player Character identified by the given * CharID. * * @param id The CharID identifying the Player Character * @return The unarmed damage String for the Race of the Player Character identified by the given * CharID */ public String getUDamForRace(CharID id) { Race race = raceFacet.get(id); int iSize = formulaResolvingFacet .resolve(id, race.getSafe(FormulaKey.SIZE), race.getQualifiedKey()) .intValue(); SizeAdjustment defAdj = SizeUtilities.getDefaultSizeAdjustment(); SizeAdjustment sizAdj = Globals.getContext() .getReferenceContext() .getSortedList(SizeAdjustment.class, IntegerKey.SIZEORDER) .get(iSize); if (sizAdj != null) { return Globals.adjustDamage("1d3", defAdj, sizAdj); } return "1d3"; }