Search in sources :

Example 6 with LevelInfo

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

the class PCGenTestCase method setUp.

/**
	 * Sets up some basic stuff that must be present for tests to work.
	 */
@Override
protected void setUp() throws Exception {
    super.setUp();
    final GameMode gamemode = new GameMode("3.5");
    gamemode.setBonusFeatLevels("3|3");
    gamemode.setAlignmentText("Alignment");
    gamemode.addLevelInfo("Normal", new LevelInfo());
    gamemode.addXPTableName("Normal");
    gamemode.setDefaultXPTableName("Normal");
    gamemode.clearLoadContext();
    LoadInfo loadable = gamemode.getModeContext().getReferenceContext().constructNowIfNecessary(LoadInfo.class, gamemode.getName());
    loadable.addLoadScoreValue(0, BigDecimal.ONE);
    GameModeFileLoader.addDefaultTabInfo(gamemode);
    SystemCollections.addToGameModeList(gamemode);
    SettingsHandler.setGame("3.5");
    count = 0;
}
Also used : GameMode(pcgen.core.GameMode) LoadInfo(pcgen.core.system.LoadInfo) LevelInfo(pcgen.core.LevelInfo)

Example 7 with LevelInfo

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

the class SkillSitTokenTest method setUp.

/**
	 * @see pcgen.AbstractCharacterTestCase#setUp()
	 */
@Override
protected void setUp() throws Exception {
    super.setUp();
    PlayerCharacter character = getCharacter();
    final LevelInfo levelInfo = new LevelInfo();
    levelInfo.setLevelString("LEVEL");
    levelInfo.setMaxClassSkillString("LEVEL+3");
    levelInfo.setMaxCrossClassSkillString("(LEVEL+3)/2");
    GameMode gamemode = SettingsHandler.getGame();
    gamemode.addLevelInfo("Default", levelInfo);
    //Stats
    setPCStat(character, dex, 16);
    setPCStat(character, intel, 17);
    LoadContext context = Globals.getContext();
    BonusObj aBonus = Bonus.newBonus(context, "MODSKILLPOINTS|NUMBER|INT");
    if (aBonus != null) {
        intel.addToListFor(ListKey.BONUS, aBonus);
    }
    // Race
    Race testRace = new Race();
    testRace.setName("TestRace");
    character.setRace(testRace);
    // Class
    PCClass myClass = new PCClass();
    myClass.setName("My Class");
    myClass.put(FormulaKey.START_SKILL_POINTS, FormulaFactory.getFormulaFor(3));
    character.incrementClassLevel(5, myClass, true);
    //Skills
    knowledge = new Skill[2];
    knowledge[0] = new Skill();
    context.unconditionallyProcess(knowledge[0], "CLASSES", "MyClass");
    knowledge[0].setName("KNOWLEDGE (ARCANA)");
    TestHelper.addType(knowledge[0], "KNOWLEDGE.INT");
    CDOMDirectSingleRef<PCStat> intelRef = CDOMDirectSingleRef.getRef(intel);
    knowledge[0].put(ObjectKey.KEY_STAT, intelRef);
    context.getReferenceContext().importObject(knowledge[0]);
    aBonus = Bonus.newBonus(context, "SITUATION|Tumble=On Hot Concrete|2");
    if (aBonus != null) {
        knowledge[0].addToListFor(ListKey.BONUS, aBonus);
    }
    SkillRankControl.modRanks(8.0, myClass, true, character, knowledge[0]);
    knowledge[1] = new Skill();
    context.unconditionallyProcess(knowledge[1], "CLASSES", "MyClass");
    knowledge[1].setName("KNOWLEDGE (RELIGION)");
    TestHelper.addType(knowledge[1], "KNOWLEDGE.INT");
    knowledge[1].put(ObjectKey.KEY_STAT, intelRef);
    aBonus = Bonus.newBonus(context, "SITUATION|Balance=On a Ball|2");
    if (aBonus != null) {
        knowledge[1].addToListFor(ListKey.BONUS, aBonus);
    }
    context.getReferenceContext().importObject(knowledge[1]);
    SkillRankControl.modRanks(5.0, myClass, true, character, knowledge[1]);
    tumble = new Skill();
    context.unconditionallyProcess(tumble, "CLASSES", "MyClass");
    tumble.setName("Tumble");
    tumble.addToListFor(ListKey.TYPE, Type.getConstant("DEX"));
    tumble.addToListFor(ListKey.SITUATION, "On Hot Concrete");
    tumble.addToListFor(ListKey.SITUATION, "Down a Mountain");
    CDOMDirectSingleRef<PCStat> dexRef = CDOMDirectSingleRef.getRef(dex);
    tumble.put(ObjectKey.KEY_STAT, dexRef);
    context.getReferenceContext().importObject(tumble);
    SkillRankControl.modRanks(7.0, myClass, true, character, tumble);
    balance = new Skill();
    context.unconditionallyProcess(balance, "CLASSES", "MyClass");
    balance.setName("Balance");
    balance.addToListFor(ListKey.TYPE, Type.getConstant("DEX"));
    balance.addToListFor(ListKey.SITUATION, "On a Ball");
    balance.put(ObjectKey.KEY_STAT, dexRef);
    aBonus = Bonus.newBonus(context, "SKILL|Balance|2|PRESKILL:1,Tumble=5|TYPE=Synergy.STACK");
    if (aBonus != null) {
        balance.addToListFor(ListKey.BONUS, aBonus);
    }
    context.getReferenceContext().importObject(balance);
    SkillRankControl.modRanks(4.0, myClass, true, character, balance);
    context.getReferenceContext().buildDerivedObjects();
    context.getReferenceContext().resolveReferences(null);
    character.calcActiveBonuses();
}
Also used : GameMode(pcgen.core.GameMode) Skill(pcgen.core.Skill) PlayerCharacter(pcgen.core.PlayerCharacter) BonusObj(pcgen.core.bonus.BonusObj) LevelInfo(pcgen.core.LevelInfo) Race(pcgen.core.Race) LoadContext(pcgen.rules.context.LoadContext) PCClass(pcgen.core.PCClass) PCStat(pcgen.core.PCStat)

Example 8 with LevelInfo

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

the class CharacterLevelsFacadeImplTest method setGameSkillRankData.

private void setGameSkillRankData(boolean crossClassCostTwo) {
    GameMode game = SettingsHandler.getGame();
    final XPTable xpTable = game.getLevelInfo(game.getDefaultXPTableName());
    LevelInfo levelInfo = xpTable.getLevelInfo(1);
    levelInfo.setLevelString("LEVEL");
    if (crossClassCostTwo) {
        levelInfo.setMaxClassSkillString("LEVEL+3");
        levelInfo.setMaxCrossClassSkillString("(LEVEL+3)/2");
        game.setSkillCost_CrossClass(2);
    } else {
        levelInfo.setMaxClassSkillString("LEVEL");
        levelInfo.setMaxCrossClassSkillString("LEVEL");
        game.setSkillCost_CrossClass(1);
    }
}
Also used : GameMode(pcgen.core.GameMode) XPTable(pcgen.core.XPTable) LevelInfo(pcgen.core.LevelInfo) PCLevelInfo(pcgen.core.pclevelinfo.PCLevelInfo)

Example 9 with LevelInfo

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

the class XPTableFacet method getLevelInfo.

/**
	 * Returns Level information for the given Level
	 * 
	 * @param level
	 *            the level for which Level Info should be returned
	 * @return The LevelInfo for the given level
	 */
public LevelInfo getLevelInfo(CharID id, int level) {
    if (level < 1) {
        return null;
    }
    XPTable table = get(id);
    if (table == null) {
        return null;
    }
    LevelInfo lInfo = table.getLevelInfo(String.valueOf(level));
    if (lInfo == null) {
        lInfo = table.getLevelInfo("LEVEL");
    }
    return lInfo;
}
Also used : XPTable(pcgen.core.XPTable) LevelInfo(pcgen.core.LevelInfo)

Example 10 with LevelInfo

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

the class SkillTokenTest method setUp.

/**
	 * @see pcgen.AbstractCharacterTestCase#setUp()
	 */
@Override
protected void setUp() throws Exception {
    super.setUp();
    PlayerCharacter character = getCharacter();
    final LevelInfo levelInfo = new LevelInfo();
    levelInfo.setLevelString("LEVEL");
    levelInfo.setMaxClassSkillString("LEVEL+3");
    levelInfo.setMaxCrossClassSkillString("(LEVEL+3)/2");
    GameMode gamemode = SettingsHandler.getGame();
    gamemode.addLevelInfo("Default", levelInfo);
    //Stats
    setPCStat(character, dex, 16);
    setPCStat(character, intel, 17);
    LoadContext context = Globals.getContext();
    BonusObj aBonus = Bonus.newBonus(context, "MODSKILLPOINTS|NUMBER|INT");
    if (aBonus != null) {
        intel.addToListFor(ListKey.BONUS, aBonus);
    }
    // Race
    Race testRace = new Race();
    testRace.setName("TestRace");
    character.setRace(testRace);
    // Class
    PCClass myClass = new PCClass();
    myClass.setName("My Class");
    myClass.put(FormulaKey.START_SKILL_POINTS, FormulaFactory.getFormulaFor(3));
    character.incrementClassLevel(5, myClass, true);
    //Skills
    knowledge = new Skill[2];
    knowledge[0] = new Skill();
    context.unconditionallyProcess(knowledge[0], "CLASSES", "MyClass");
    knowledge[0].setName("KNOWLEDGE (ARCANA)");
    TestHelper.addType(knowledge[0], "KNOWLEDGE.INT");
    CDOMDirectSingleRef<PCStat> intelRef = CDOMDirectSingleRef.getRef(intel);
    knowledge[0].put(ObjectKey.KEY_STAT, intelRef);
    context.getReferenceContext().importObject(knowledge[0]);
    SkillRankControl.modRanks(8.0, myClass, true, character, knowledge[0]);
    knowledge[1] = new Skill();
    context.unconditionallyProcess(knowledge[1], "CLASSES", "MyClass");
    knowledge[1].setName("KNOWLEDGE (RELIGION)");
    TestHelper.addType(knowledge[1], "KNOWLEDGE.INT");
    knowledge[1].put(ObjectKey.KEY_STAT, intelRef);
    context.getReferenceContext().importObject(knowledge[1]);
    SkillRankControl.modRanks(5.0, myClass, true, character, knowledge[1]);
    tumble = new Skill();
    context.unconditionallyProcess(tumble, "CLASSES", "MyClass");
    tumble.setName("Tumble");
    tumble.addToListFor(ListKey.TYPE, Type.getConstant("DEX"));
    CDOMDirectSingleRef<PCStat> dexRef = CDOMDirectSingleRef.getRef(dex);
    tumble.put(ObjectKey.KEY_STAT, dexRef);
    context.getReferenceContext().importObject(tumble);
    SkillRankControl.modRanks(7.0, myClass, true, character, tumble);
    balance = new Skill();
    context.unconditionallyProcess(balance, "CLASSES", "MyClass");
    balance.setName("Balance");
    balance.addToListFor(ListKey.TYPE, Type.getConstant("DEX"));
    balance.put(ObjectKey.KEY_STAT, dexRef);
    aBonus = Bonus.newBonus(context, "SKILL|Balance|2|PRESKILL:1,Tumble=5|TYPE=Synergy.STACK");
    if (aBonus != null) {
        balance.addToListFor(ListKey.BONUS, aBonus);
    }
    context.getReferenceContext().importObject(balance);
    SkillRankControl.modRanks(4.0, myClass, true, character, balance);
    context.getReferenceContext().buildDerivedObjects();
    context.getReferenceContext().resolveReferences(null);
    character.calcActiveBonuses();
}
Also used : GameMode(pcgen.core.GameMode) Skill(pcgen.core.Skill) PlayerCharacter(pcgen.core.PlayerCharacter) BonusObj(pcgen.core.bonus.BonusObj) LevelInfo(pcgen.core.LevelInfo) Race(pcgen.core.Race) LoadContext(pcgen.rules.context.LoadContext) PCClass(pcgen.core.PCClass) PCStat(pcgen.core.PCStat)

Aggregations

LevelInfo (pcgen.core.LevelInfo)11 GameMode (pcgen.core.GameMode)6 XPTable (pcgen.core.XPTable)5 PCStat (pcgen.core.PCStat)4 PlayerCharacter (pcgen.core.PlayerCharacter)4 LoadContext (pcgen.rules.context.LoadContext)4 Test (org.junit.Test)3 CharID (pcgen.cdom.enumeration.CharID)3 AbstractItemFacetTest (pcgen.cdom.testsupport.AbstractItemFacetTest)3 PCClass (pcgen.core.PCClass)3 Race (pcgen.core.Race)3 Skill (pcgen.core.Skill)3 BonusObj (pcgen.core.bonus.BonusObj)3 LoadInfo (pcgen.core.system.LoadInfo)2 StringTokenizer (java.util.StringTokenizer)1 Before (org.junit.Before)1 Equipment (pcgen.core.Equipment)1 PCLevelInfo (pcgen.core.pclevelinfo.PCLevelInfo)1 AbstractReferenceContext (pcgen.rules.context.AbstractReferenceContext)1