Search in sources :

Example 96 with Race

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;
}
Also used : LevelCommandFactory(pcgen.cdom.content.LevelCommandFactory) Race(pcgen.core.Race) PCClass(pcgen.core.PCClass)

Example 97 with Race

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();
}
Also used : Race(pcgen.core.Race) ArrayList(java.util.ArrayList) SpecialAbility(pcgen.core.SpecialAbility)

Example 98 with Race

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);
}
Also used : GameMode(pcgen.core.GameMode) Campaign(pcgen.core.Campaign) Description(pcgen.core.Description) Race(pcgen.core.Race) PCClass(pcgen.core.PCClass) SizeAdjustment(pcgen.core.SizeAdjustment) FixedSizeFormula(pcgen.cdom.formula.FixedSizeFormula)

Example 99 with Race

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 };
}
Also used : Equipment(pcgen.core.Equipment) CDOMObject(pcgen.cdom.base.CDOMObject) Race(pcgen.core.Race) PCTemplate(pcgen.core.PCTemplate)

Example 100 with Race

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 };
}
Also used : CDOMObject(pcgen.cdom.base.CDOMObject) Race(pcgen.core.Race) PCTemplate(pcgen.core.PCTemplate) DamageReduction(pcgen.cdom.content.DamageReduction)

Aggregations

Race (pcgen.core.Race)167 Test (org.junit.Test)78 PCTemplate (pcgen.core.PCTemplate)66 PlayerCharacter (pcgen.core.PlayerCharacter)28 CDOMObject (pcgen.cdom.base.CDOMObject)16 LoadContext (pcgen.rules.context.LoadContext)16 PCClass (pcgen.core.PCClass)15 ArrayList (java.util.ArrayList)10 SizeAdjustment (pcgen.core.SizeAdjustment)10 ParseResult (pcgen.rules.persistence.token.ParseResult)10 AbstractTokenModelTest (tokenmodel.testsupport.AbstractTokenModelTest)10 PCStat (pcgen.core.PCStat)9 FixedSizeFormula (pcgen.cdom.formula.FixedSizeFormula)8 Equipment (pcgen.core.Equipment)8 BonusObj (pcgen.core.bonus.BonusObj)7 Formula (pcgen.base.formula.Formula)6 WieldCategory (pcgen.core.character.WieldCategory)6 GameMode (pcgen.core.GameMode)5 Skill (pcgen.core.Skill)5 CompanionList (pcgen.cdom.list.CompanionList)4