use of pcgen.core.Race in project pcgen by PCGen.
the class RaceToken method getRaceToken.
private static String getRaceToken(PlayerCharacter pc) {
String retString = Constants.EMPTY_STRING;
Race race = pc.getDisplay().getRace();
String tempRaceName = OutputNameFormatting.getOutputName(race);
if (tempRaceName == null || tempRaceName.isEmpty()) {
tempRaceName = race.getDisplayName();
}
StringBuilder extraRaceInfo = new StringBuilder(40);
String subRace = pc.getDisplay().getSubRace();
if (subRace != null) {
extraRaceInfo.append(subRace);
}
if (SettingsHandler.hideMonsterClasses()) {
LevelCommandFactory lcf = race.get(ObjectKey.MONSTER_CLASS);
if (lcf != null) {
PCClass monsterClass = lcf.getPCClass();
final PCClass aClass = pc.getClassKeyed(monsterClass.getKeyName());
if (aClass != null) {
int minHD = lcf.getLevelCount().resolve(pc, "").intValue();
int monsterHD = pc.getDisplay().getLevel(aClass);
if (monsterHD != minHD) {
if (extraRaceInfo.length() != 0) {
extraRaceInfo.append(' ');
}
extraRaceInfo.append(monsterHD).append(//$NON-NLS-1$
LanguageBundle.getString("in_hdLabel"));
}
}
}
}
retString = tempRaceName;
if (extraRaceInfo.length() != 0) {
//$NON-NLS-1$
retString += " (" + extraRaceInfo + ')';
}
return retString;
}
use of pcgen.core.Race in project pcgen by PCGen.
the class RaceToken method getSubToken.
private static String getSubToken(final String subToken, CharacterDisplay display) {
if (!subToken.equals(SUBTOKENLIST[0])) {
return Constants.EMPTY_STRING;
}
final List<SpecialAbility> saList = new ArrayList<>();
Race race = display.getRace();
saList.addAll(display.getResolvedUserSpecialAbilities(race));
saList.addAll(display.getResolvedSpecialAbilities(race));
if (saList.isEmpty()) {
return Constants.EMPTY_STRING;
}
StringBuilder returnString = new StringBuilder();
boolean firstLine = true;
for (SpecialAbility sa : saList) {
if (!firstLine) {
//$NON-NLS-1$
returnString.append(", ");
}
firstLine = false;
returnString.append(sa.getDisplayName());
}
return returnString.toString();
}
use of pcgen.core.Race in project pcgen by PCGen.
the class ClassLevelCommandTest method setUp.
/**
* @throws Exception
* @see pcgen.AbstractCharacterTestCase#setUp()
*/
@Override
protected void setUp() throws Exception {
super.setUp();
Campaign customCampaign = new Campaign();
customCampaign.setName("Unit Test");
customCampaign.setName("KEY_Unit Test");
customCampaign.addToListFor(ListKey.DESCRIPTION, new Description("Unit Test data"));
// Create the monseter class type
GameMode gamemode = SettingsHandler.getGame();
gamemode.addClassType("Monster CRFORMULA:0 ISMONSTER:YES XPPENALTY:NO");
gamemode.setSkillMultiplierLevels("4");
gamemode.setMaxNonEpicLevel(20);
CDOMDirectSingleRef<SizeAdjustment> mediumRef = CDOMDirectSingleRef.getRef(medium);
// Create the Nymph race
nymphRace = new Race();
nymphRace.setName("Nymph");
nymphRace.addToListFor(ListKey.HITDICE_ADVANCEMENT, Integer.MAX_VALUE);
nymphRace.put(FormulaKey.SIZE, new FixedSizeFormula(mediumRef));
Globals.getContext().getReferenceContext().importObject(nymphRace);
// Create the humanoid class
humanoidClass = new PCClass();
humanoidClass.setName("Humanoid");
humanoidClass.addToListFor(ListKey.TYPE, Type.getConstant("Monster"));
Globals.getContext().getReferenceContext().importObject(humanoidClass);
nymphClass = new PCClass();
nymphClass.setName("Nymph");
nymphClass.addToListFor(ListKey.TYPE, Type.getConstant("Monster"));
Globals.getContext().getReferenceContext().importObject(nymphClass);
megaCasterClass = new PCClass();
megaCasterClass.setName("MegaCaster");
BuildUtilities.setFact(megaCasterClass, "SpellType", "Arcane");
Globals.getContext().unconditionallyProcess(megaCasterClass, "SPELLSTAT", "CHA");
megaCasterClass.put(ObjectKey.SPELLBOOK, false);
megaCasterClass.put(ObjectKey.MEMORIZE_SPELLS, false);
Globals.getContext().getReferenceContext().importObject(megaCasterClass);
}
use of pcgen.core.Race in project pcgen by PCGen.
the class NaturalWeaponFacetTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
CDOMObject cdo1 = new PCTemplate();
cdo1.setName("Template1");
CDOMObject cdo2 = new Race();
cdo2.setName("Race1");
Equipment st1 = new Equipment();
st1.setName("Prof1");
Equipment st2 = new Equipment();
st1.setName("Prof2");
cdo1.addToListFor(ListKey.NATURAL_WEAPON, st1);
cdo2.addToListFor(ListKey.NATURAL_WEAPON, st2);
source = new CDOMObject[] { cdo1, cdo2 };
target = new Equipment[] { st1, st2 };
}
use of pcgen.core.Race in project pcgen by PCGen.
the class DamageReductionFacetTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
CDOMObject cdo1 = new PCTemplate();
cdo1.setName("Templ");
CDOMObject cdo2 = new Race();
cdo2.setName("Race");
DamageReduction dr1 = new DamageReduction(FormulaFactory.getFormulaFor(4), "good");
DamageReduction dr2 = new DamageReduction(FormulaFactory.getFormulaFor(2), "bad");
cdo1.addToListFor(ListKey.DAMAGE_REDUCTION, dr1);
cdo2.addToListFor(ListKey.DAMAGE_REDUCTION, dr2);
source = new CDOMObject[] { cdo1, cdo2 };
target = new DamageReduction[] { dr1, dr2 };
}
Aggregations