Search in sources :

Example 36 with GameMode

use of pcgen.core.GameMode in project pcgen by PCGen.

the class CharacterLevelsFacadeImplTest method before.

@Before
public void before() throws Exception {
    delegate = new MockUIDelegate();
    todoManager = new TodoManager();
    final GameMode gameMode = SettingsHandler.getGame();
    dataSetFacade = new MockDataSetFacade(gameMode);
}
Also used : GameMode(pcgen.core.GameMode) Before(org.junit.Before)

Example 37 with GameMode

use of pcgen.core.GameMode in project pcgen by PCGen.

the class DataLoadTest method getBasicSources.

private static List<SourceSelectionFacade> getBasicSources() {
    List<SourceSelectionFacade> basicSources = new ArrayList<>();
    for (Campaign campaign : Globals.getCampaignList()) {
        if (campaign.showInMenu()) {
            SourceSelectionFacade sourceSelection = FacadeFactory.createSourceSelection(campaign.getGameModes().getElementAt(0), Collections.singletonList(campaign), campaign.getName());
            basicSources.add(sourceSelection);
        }
    }
    for (GameMode mode : SystemCollections.getUnmodifiableGameModeList()) {
        String title = mode.getDefaultSourceTitle();
        if (title == null && !mode.getDefaultDataSetList().isEmpty()) {
            title = mode.getName();
        }
        if (!mode.getDefaultDataSetList().isEmpty()) {
            List<CampaignFacade> qcamps = new ArrayList<>();
            List<String> sources = mode.getDefaultDataSetList();
            for (String string : sources) {
                Campaign camp = Globals.getCampaignKeyed(string);
                assertNotNull("Cannot find source " + string + " for game mode " + mode, camp);
                qcamps.add(camp);
            }
            basicSources.add(FacadeFactory.createSourceSelection(mode, qcamps, mode.getDefaultSourceTitle()));
        }
    }
    return basicSources;
}
Also used : GameMode(pcgen.core.GameMode) SourceSelectionFacade(pcgen.facade.core.SourceSelectionFacade) Campaign(pcgen.core.Campaign) ArrayList(java.util.ArrayList) CampaignFacade(pcgen.facade.core.CampaignFacade)

Example 38 with GameMode

use of pcgen.core.GameMode in project pcgen by PCGen.

the class IconTokenTest method testInValidSyntax.

public void testInValidSyntax() throws Exception {
    GameMode gameMode = SettingsHandler.getGame();
    IconToken token = new IconToken();
    assertFalse("Parse should fail", token.parse(gameMode, "Eyegear:preview/summary/images/icon_eye.png", uri));
    assertFalse("Parse should fail", token.parse(gameMode, "Eyegear|preview/summary/images|icon_eye.png", uri));
}
Also used : GameMode(pcgen.core.GameMode)

Example 39 with GameMode

use of pcgen.core.GameMode 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 40 with GameMode

use of pcgen.core.GameMode in project pcgen by PCGen.

the class AbstractTokenModelTest method setUpContext.

protected void setUpContext() throws PersistenceLayerException {
    ChooserFactory.pushChooserClassname(RandomChooser.class.getName());
    TokenRegistration.clearTokens();
    TokenRegistration.register(AUTO_LANG_TOKEN);
    TokenRegistration.register(ABILITY_VISIBLE_TOKEN);
    TokenRegistration.register(AUTO_TOKEN);
    TokenRegistration.register(CHOOSE_TOKEN);
    TokenRegistration.register(CHOOSE_LANG_TOKEN);
    TokenRegistration.register(ABILITY_MULT_TOKEN);
    TokenRegistration.register(EQUIP_TYPE_TOKEN);
    TokenRegistration.register(EQUIP_PROFICIENCY_TOKEN);
    TokenRegistration.register(LANGBONUS_PRIM);
    TokenRegistration.register(PC_QUAL);
    TokenRegistration.register(getToken());
    TokenRegistration.register(plugin.bonustokens.Feat.class);
    directAbilityFacet = FacetLibrary.getFacet(DirectAbilityFacet.class);
    activeEqModFacet = FacetLibrary.getFacet(ActiveEqModFacet.class);
    alignmentFacet = FacetLibrary.getFacet(AlignmentFacet.class);
    bioSetFacet = FacetLibrary.getFacet(BioSetFacet.class);
    checkFacet = FacetLibrary.getFacet(CheckFacet.class);
    classFacet = FacetLibrary.getFacet(ClassFacet.class);
    classLevelFacet = FacetLibrary.getFacet(ClassLevelFacet.class);
    companionModFacet = FacetLibrary.getFacet(CompanionModFacet.class);
    deityFacet = FacetLibrary.getFacet(DeityFacet.class);
    domainFacet = FacetLibrary.getFacet(DomainFacet.class);
    expandedCampaignFacet = FacetLibrary.getFacet(ExpandedCampaignFacet.class);
    languageFacet = FacetLibrary.getFacet(LanguageFacet.class);
    raceFacet = FacetLibrary.getFacet(RaceInputFacet.class);
    sizeFacet = FacetLibrary.getFacet(SizeFacet.class);
    skillFacet = FacetLibrary.getFacet(SkillFacet.class);
    statFacet = FacetLibrary.getFacet(StatFacet.class);
    templateInputFacet = FacetLibrary.getFacet(TemplateInputFacet.class);
    templateConsolidationFacet = FacetLibrary.getFacet(TemplateFacet.class);
    weaponProfModelFacet = FacetLibrary.getFacet(WeaponProfModelFacet.class);
    Globals.createEmptyRace();
    Globals.setUseGUI(false);
    Globals.emptyLists();
    GameMode gamemode = SettingsHandler.getGame();
    gamemode.clearLoadContext();
    str = BuildUtilities.createStat("Strength", "STR");
    str.put(VariableKey.getConstant("LOADSCORE"), FormulaFactory.getFormulaFor("STRSCORE"));
    str.put(VariableKey.getConstant("OFFHANDLIGHTBONUS"), FormulaFactory.getFormulaFor(2));
    dex = BuildUtilities.createStat("Dexterity", "DEX");
    PCStat con = BuildUtilities.createStat("Constitution", "CON");
    intel = BuildUtilities.createStat("Intelligence", "INT");
    wis = BuildUtilities.createStat("Wisdom", "WIS");
    cha = BuildUtilities.createStat("Charisma", "CHA");
    AbstractReferenceContext ref = Globals.getContext().getReferenceContext();
    lg = BuildUtilities.createAlignment("Lawful Good", "LG");
    ref.importObject(lg);
    ln = BuildUtilities.createAlignment("Lawful Neutral", "LN");
    ref.importObject(ln);
    le = BuildUtilities.createAlignment("Lawful Evil", "LE");
    ref.importObject(le);
    ng = BuildUtilities.createAlignment("Neutral Good", "NG");
    ref.importObject(ng);
    tn = BuildUtilities.createAlignment("True Neutral", "TN");
    ref.importObject(tn);
    ne = BuildUtilities.createAlignment("Neutral Evil", "NE");
    ref.importObject(ne);
    cg = BuildUtilities.createAlignment("Chaotic Good", "CG");
    ref.importObject(cg);
    cn = BuildUtilities.createAlignment("Chaotic Neutral", "CN");
    ref.importObject(cn);
    ce = BuildUtilities.createAlignment("Chaotic Evil", "CE");
    ref.importObject(ce);
    ref.importObject(BuildUtilities.createAlignment("None", "NONE"));
    ref.importObject(BuildUtilities.createAlignment("Deity's", "Deity"));
    gamemode.setBonusFeatLevels("3|3");
    SettingsHandler.setGame("3.5");
    ref.importObject(str);
    ref.importObject(dex);
    ref.importObject(con);
    ref.importObject(intel);
    ref.importObject(wis);
    ref.importObject(cha);
    fine = BuildUtilities.createSize("Fine", 0);
    diminutive = BuildUtilities.createSize("Diminutive", 1);
    tiny = BuildUtilities.createSize("Tiny", 2);
    small = BuildUtilities.createSize("Small", 3);
    medium = BuildUtilities.createSize("Medium", 4);
    medium.put(ObjectKey.IS_DEFAULT_SIZE, true);
    large = BuildUtilities.createSize("Large", 5);
    huge = BuildUtilities.createSize("Huge", 6);
    gargantuan = BuildUtilities.createSize("Gargantuan", 7);
    colossal = BuildUtilities.createSize("Colossal", 8);
    context = Globals.getContext();
    create(Language.class, "Common");
    BuildUtilities.createFact(context, "ClassType", PCClass.class);
    FactDefinition<?, String> fd = BuildUtilities.createFact(context, "SpellType", PCClass.class);
    fd.setSelectable(true);
    context.getReferenceContext().importObject(AbilityCategory.FEAT);
    SourceFileLoader.createLangBonusObject(Globals.getContext());
}
Also used : AbstractReferenceContext(pcgen.rules.context.AbstractReferenceContext) TemplateFacet(pcgen.cdom.facet.model.TemplateFacet) RandomChooser(pcgen.util.chooser.RandomChooser) CompanionModFacet(pcgen.cdom.facet.model.CompanionModFacet) DomainFacet(pcgen.cdom.facet.model.DomainFacet) StatFacet(pcgen.cdom.facet.model.StatFacet) AlignmentFacet(pcgen.cdom.facet.model.AlignmentFacet) ActiveEqModFacet(pcgen.cdom.facet.model.ActiveEqModFacet) ClassFacet(pcgen.cdom.facet.model.ClassFacet) WeaponProfModelFacet(pcgen.cdom.facet.model.WeaponProfModelFacet) ClassLevelFacet(pcgen.cdom.facet.model.ClassLevelFacet) CheckFacet(pcgen.cdom.facet.model.CheckFacet) BioSetFacet(pcgen.cdom.facet.model.BioSetFacet) GameMode(pcgen.core.GameMode) RaceInputFacet(pcgen.cdom.facet.input.RaceInputFacet) SizeFacet(pcgen.cdom.facet.model.SizeFacet) ExpandedCampaignFacet(pcgen.cdom.facet.model.ExpandedCampaignFacet) DeityFacet(pcgen.cdom.facet.model.DeityFacet) DirectAbilityFacet(pcgen.cdom.facet.DirectAbilityFacet) TemplateInputFacet(pcgen.cdom.facet.input.TemplateInputFacet) PCStat(pcgen.core.PCStat) LanguageFacet(pcgen.cdom.facet.model.LanguageFacet) SkillFacet(pcgen.cdom.facet.model.SkillFacet)

Aggregations

GameMode (pcgen.core.GameMode)58 PCStat (pcgen.core.PCStat)10 PlayerCharacter (pcgen.core.PlayerCharacter)8 File (java.io.File)7 Campaign (pcgen.core.Campaign)7 LoadContext (pcgen.rules.context.LoadContext)7 LevelInfo (pcgen.core.LevelInfo)6 Race (pcgen.core.Race)6 AbstractReferenceContext (pcgen.rules.context.AbstractReferenceContext)6 ArrayList (java.util.ArrayList)5 PCClass (pcgen.core.PCClass)5 BonusObj (pcgen.core.bonus.BonusObj)4 Before (org.junit.Before)3 Equipment (pcgen.core.Equipment)3 CampaignFacade (pcgen.facade.core.CampaignFacade)3 FileWriter (java.io.FileWriter)2 IOException (java.io.IOException)2 Writer (java.io.Writer)2 HashMap (java.util.HashMap)2 JLabel (javax.swing.JLabel)2