Search in sources :

Example 46 with Equipment

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

the class PreEquipTwoWeaponTest method testWield.

/**
	 * Test wield category tests
	 * @throws Exception
	 */
public void testWield() throws Exception {
    final PlayerCharacter character = getCharacter();
    final Race race = new Race();
    race.setName("Test Race");
    CDOMDirectSingleRef<SizeAdjustment> mediumRef = CDOMDirectSingleRef.getRef(medium);
    CDOMDirectSingleRef<SizeAdjustment> largeRef = CDOMDirectSingleRef.getRef(large);
    race.put(FormulaKey.SIZE, new FixedSizeFormula(mediumRef));
    character.setRace(race);
    LoadContext context = Globals.getContext();
    final Equipment longsword = new Equipment();
    longsword.setName("Longsword");
    character.addEquipment(longsword);
    longsword.setIsEquipped(true, character);
    longsword.setLocation(EquipmentLocation.EQUIPPED_TWO_HANDS);
    character.doAfavorForAunitTestThatIgnoresEquippingRules();
    Prerequisite prereq = new Prerequisite();
    prereq.setKind("equiptwoweapon");
    prereq.setKey("WIELDCATEGORY=OneHanded");
    prereq.setOperand("1");
    prereq.setOperator(PrerequisiteOperator.EQ);
    // Test 3.0 Style
    longsword.put(ObjectKey.SIZE, mediumRef);
    longsword.put(ObjectKey.BASESIZE, mediumRef);
    assertTrue("Weapon is M therefore OneHanded", PrereqHandler.passes(prereq, character, null));
    longsword.put(ObjectKey.SIZE, largeRef);
    longsword.put(ObjectKey.BASESIZE, largeRef);
    assertFalse("Weapon is L therefore TwoHanded", PrereqHandler.passes(prereq, character, null));
    // Test 3.5 style
    longsword.put(ObjectKey.SIZE, mediumRef);
    longsword.put(ObjectKey.BASESIZE, mediumRef);
    longsword.put(ObjectKey.WIELD, context.getReferenceContext().silentlyGetConstructedCDOMObject(WieldCategory.class, "TwoHanded"));
    assertFalse("Weapon is TwoHanded", PrereqHandler.passes(prereq, character, null));
    longsword.put(ObjectKey.WIELD, context.getReferenceContext().silentlyGetConstructedCDOMObject(WieldCategory.class, "OneHanded"));
    assertTrue("Weapon is OneHanded", PrereqHandler.passes(prereq, character, null));
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) Equipment(pcgen.core.Equipment) Race(pcgen.core.Race) LoadContext(pcgen.rules.context.LoadContext) WieldCategory(pcgen.core.character.WieldCategory) SizeAdjustment(pcgen.core.SizeAdjustment) FixedSizeFormula(pcgen.cdom.formula.FixedSizeFormula)

Example 47 with Equipment

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

the class PreEquipTwoWeaponTest method testType.

/**
	 * Test equipment type tests
	 * @throws Exception
	 */
public void testType() throws Exception {
    final PlayerCharacter character = getCharacter();
    final Equipment longsword = new Equipment();
    longsword.setName("Longsword");
    character.addEquipment(longsword);
    longsword.setIsEquipped(true, character);
    longsword.setLocation(EquipmentLocation.EQUIPPED_TWO_HANDS);
    character.doAfavorForAunitTestThatIgnoresEquippingRules();
    Prerequisite prereq = new Prerequisite();
    prereq.setKind("equiptwoweapon");
    prereq.setKey("TYPE=Weapon");
    prereq.setOperand("1");
    prereq.setOperator(PrerequisiteOperator.EQ);
    assertFalse("Equipment has no type", PrereqHandler.passes(prereq, character, null));
    longsword.addType(Type.WEAPON);
    assertTrue("Equipment is weapon", PrereqHandler.passes(prereq, character, null));
    prereq.setKey("TYPE.Armor");
    assertFalse("Equipment is not armor", PrereqHandler.passes(prereq, character, null));
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) Equipment(pcgen.core.Equipment)

Example 48 with Equipment

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

the class WeaponTokenTest method setUp.

/*
	 * @see TestCase#setUp()
	 */
@Override
protected void setUp() throws Exception {
    super.setUp();
    PlayerCharacter character = getCharacter();
    LoadContext context = Globals.getContext();
    //Stats
    setPCStat(character, str, 15);
    setPCStat(character, dex, 16);
    setPCStat(character, intel, 17);
    BonusObj aBonus = Bonus.newBonus(context, "COMBAT|TOHIT.Melee|STR|TYPE=Ability");
    if (aBonus != null) {
        str.addToListFor(ListKey.BONUS, aBonus);
    }
    aBonus = Bonus.newBonus(context, "COMBAT|DAMAGE.Melee,DAMAGE.Thrown|STR");
    if (aBonus != null) {
        str.addToListFor(ListKey.BONUS, aBonus);
    }
    aBonus = Bonus.newBonus(context, "COMBAT|DAMAGEMULT:0|0.5*(STR>=0)");
    if (aBonus != null) {
        str.addToListFor(ListKey.BONUS, aBonus);
    }
    aBonus = Bonus.newBonus(context, "COMBAT|DAMAGEMULT:1|1");
    if (aBonus != null) {
        str.addToListFor(ListKey.BONUS, aBonus);
    }
    aBonus = Bonus.newBonus(context, "COMBAT|DAMAGEMULT:2|1.5*(STR>=0)");
    if (aBonus != null) {
        str.addToListFor(ListKey.BONUS, aBonus);
    }
    aBonus = Bonus.newBonus(context, "MODSKILLPOINTS|NUMBER|INT");
    if (aBonus != null) {
        intel.addToListFor(ListKey.BONUS, aBonus);
    }
    // Race
    Race testRace = new Race();
    testRace.setName("TestRace");
    testRace.put(StringKey.KEY_NAME, "KEY_TEST_RACE");
    CDOMDirectSingleRef<SizeAdjustment> mediumRef = CDOMDirectSingleRef.getRef(medium);
    CDOMDirectSingleRef<SizeAdjustment> largeRef = CDOMDirectSingleRef.getRef(large);
    testRace.put(FormulaKey.SIZE, new FixedSizeFormula(mediumRef));
    character.setRace(testRace);
    // Class
    PCClass myClass = new PCClass();
    myClass.setName("My Class");
    myClass.put(StringKey.KEY_NAME, "KEY_MY_CLASS");
    myClass.put(FormulaKey.START_SKILL_POINTS, FormulaFactory.getFormulaFor(3));
    final BonusObj babClassBonus = Bonus.newBonus(context, "COMBAT|BASEAB|CL+15");
    myClass.getOriginalClassLevel(1).addToListFor(ListKey.BONUS, babClassBonus);
    context.getReferenceContext().importObject(myClass);
    character.incrementClassLevel(1, myClass, true);
    character.calcActiveBonuses();
    dblWpn = new Equipment();
    dblWpn.setName("DoubleWpn");
    dblWpn.put(StringKey.KEY_NAME, "KEY_DOUBLE_WPN");
    TestHelper.addType(dblWpn, "Weapon.Melee.Martial.Double.Standard.Bludgeoning.Flail");
    dblWpn.getEquipmentHead(1).put(StringKey.DAMAGE, "1d10");
    dblWpn.getEquipmentHead(2).put(StringKey.DAMAGE, "1d6");
    dblWpn.getEquipmentHead(1).put(IntegerKey.CRIT_MULT, 2);
    dblWpn.getEquipmentHead(2).put(IntegerKey.CRIT_MULT, 2);
    dblWpn.getEquipmentHead(1).put(IntegerKey.CRIT_RANGE, 1);
    dblWpn.getEquipmentHead(2).put(IntegerKey.CRIT_RANGE, 1);
    dblWpn.put(IntegerKey.SLOTS, 2);
    dblWpn.put(ObjectKey.WIELD, context.getReferenceContext().silentlyGetConstructedCDOMObject(WieldCategory.class, "TwoHanded"));
    dblWpn.put(ObjectKey.SIZE, mediumRef);
    dblWpn.put(ObjectKey.BASESIZE, mediumRef);
    character.addEquipment(dblWpn);
    EquipSet def = new EquipSet("0.1", "Default");
    character.addEquipSet(def);
    EquipSet es = new EquipSet("0.1.1", "Double Weapon", dblWpn.getKeyName(), dblWpn);
    character.addEquipSet(es);
    character.setCalcEquipmentList();
    WeaponProf wp = new WeaponProf();
    wp.setName("DoubleWpn");
    wp.put(IntegerKey.HANDS, Constants.HANDS_SIZE_DEPENDENT);
    context.getReferenceContext().importObject(wp);
    wp = new WeaponProf();
    wp.setName("Sword (Bastard)");
    wp.put(StringKey.KEY_NAME, "KEY_Sword (Bastard)");
    TestHelper.addType(wp, "MARTIAL.EXOTIC");
    context.getReferenceContext().importObject(wp);
    bastardSword = new Equipment();
    bastardSword.setName("Sword, Bastard");
    bastardSword.put(StringKey.KEY_NAME, "BASTARD_SWORD");
    bastardSword.put(ObjectKey.WEAPON_PROF, new CDOMDirectSingleRef<>(wp));
    TestHelper.addType(bastardSword, "Weapon.Melee.Martial.Exotic.Standard.Slashing.Sword");
    bastardSword.getEquipmentHead(1).put(StringKey.DAMAGE, "1d10");
    bastardSword.getEquipmentHead(1).put(IntegerKey.CRIT_MULT, 2);
    bastardSword.getEquipmentHead(1).put(IntegerKey.CRIT_RANGE, 2);
    bastardSword.put(ObjectKey.WIELD, context.getReferenceContext().silentlyGetConstructedCDOMObject(WieldCategory.class, "TwoHanded"));
    bastardSword.put(ObjectKey.SIZE, mediumRef);
    bastardSword.put(ObjectKey.BASESIZE, mediumRef);
    wp = new WeaponProf();
    wp.setName("Longsword");
    wp.put(StringKey.KEY_NAME, "KEY_LONGSWORD");
    wp.addToListFor(ListKey.TYPE, Type.getConstant("MARTIAL"));
    context.getReferenceContext().importObject(wp);
    largeSword = new Equipment();
    largeSword.setName("Longsword (Large)");
    largeSword.put(StringKey.KEY_NAME, "KEY_LONGSWORD_LARGE");
    largeSword.put(StringKey.OUTPUT_NAME, "Longsword (Large)");
    largeSword.put(ObjectKey.WEAPON_PROF, new CDOMDirectSingleRef<>(wp));
    TestHelper.addType(largeSword, "Weapon.Melee.Martial.Standard.Slashing.Sword");
    largeSword.getEquipmentHead(1).put(StringKey.DAMAGE, "1d10");
    largeSword.getEquipmentHead(1).put(IntegerKey.CRIT_MULT, 2);
    largeSword.getEquipmentHead(1).put(IntegerKey.CRIT_RANGE, 2);
    largeSword.put(ObjectKey.WIELD, context.getReferenceContext().silentlyGetConstructedCDOMObject(WieldCategory.class, "OneHanded"));
    largeSword.put(ObjectKey.SIZE, largeRef);
    largeSword.put(ObjectKey.BASESIZE, largeRef);
    fineSword = new Equipment();
    fineSword.setName("Longsword (Fine)");
    fineSword.put(StringKey.KEY_NAME, "KEY_LONGSWORD_FINE");
    fineSword.put(StringKey.OUTPUT_NAME, "Longsword (Fine)");
    fineSword.put(ObjectKey.WEAPON_PROF, new CDOMDirectSingleRef<>(wp));
    TestHelper.addType(fineSword, "Weapon.Melee.Martial.Standard.Slashing.Sword.Finesseable");
    fineSword.getEquipmentHead(1).put(StringKey.DAMAGE, "1d10");
    fineSword.getEquipmentHead(1).put(IntegerKey.CRIT_MULT, 2);
    fineSword.getEquipmentHead(1).put(IntegerKey.CRIT_RANGE, 2);
    fineSword.put(ObjectKey.WIELD, context.getReferenceContext().silentlyGetConstructedCDOMObject(WieldCategory.class, "OneHanded"));
    fineSword.put(ObjectKey.SIZE, mediumRef);
    fineSword.put(ObjectKey.BASESIZE, mediumRef);
    WeaponProf spearwp = new WeaponProf();
    spearwp.setName("Spear");
    spearwp.put(StringKey.KEY_NAME, "KEY_SPEAR");
    spearwp.addToListFor(ListKey.TYPE, Type.getConstant("MARTIAL"));
    context.getReferenceContext().importObject(spearwp);
    longSpear = new Equipment();
    longSpear.setName("Longspear");
    longSpear.put(StringKey.KEY_NAME, "KEY_LONGSPEAR");
    longSpear.put(StringKey.OUTPUT_NAME, "Longspear");
    longSpear.put(ObjectKey.WEAPON_PROF, new CDOMDirectSingleRef<>(spearwp));
    TestHelper.addType(longSpear, "Weapon.Melee.Martial.Standard.Piercing.Spear");
    longSpear.getEquipmentHead(1).put(StringKey.DAMAGE, "1d6");
    longSpear.getEquipmentHead(1).put(IntegerKey.CRIT_MULT, 2);
    longSpear.getEquipmentHead(1).put(IntegerKey.CRIT_RANGE, 1);
    longSpear.put(ObjectKey.WIELD, context.getReferenceContext().silentlyGetConstructedCDOMObject(WieldCategory.class, "TwoHanded"));
    longSpear.put(ObjectKey.SIZE, mediumRef);
    longSpear.put(ObjectKey.BASESIZE, mediumRef);
    longSpear.put(IntegerKey.REACH, 10);
    GameMode gm = SettingsHandler.getGame();
    RuleCheck rc = new RuleCheck();
    rc.setName("SIZECAT");
    gm.getModeContext().getReferenceContext().importObject(rc);
    SettingsHandler.setRuleCheck("SIZECAT", true);
    gm.setWCStepsFormula("EQUIP.SIZE.INT-PC.SIZE.INT");
    gm.setWeaponReachFormula("(RACEREACH+(max(0,REACH-5)))*REACHMULT");
    wp = new WeaponProf();
    wp.setName("Silly Bite");
    wp.put(StringKey.KEY_NAME, "SillyBite");
    //wp.setTypeInfo("Weapon.Natural.Melee.Finesseable.Bludgeoning.Piercing.Slashing");
    wp.addToListFor(ListKey.TYPE, Type.NATURAL);
    context.getReferenceContext().importObject(wp);
    bite = new Equipment();
    bite.setName("Silly Bite");
    bite.put(StringKey.KEY_NAME, "SillyBite");
    bite.put(StringKey.OUTPUT_NAME, "Silly Bite (For Test)");
    TestHelper.addType(bite, "Weapon.Natural.Melee.Finesseable.Bludgeoning.Piercing.Slashing");
    bite.put(ObjectKey.WEIGHT, BigDecimal.ZERO);
    bite.put(ObjectKey.SIZE, mediumRef);
    bite.put(ObjectKey.BASESIZE, mediumRef);
    aBonus = Bonus.newBonus(context, "WEAPON|ATTACKS|" + 7);
    if (aBonus != null) {
        bite.addToListFor(ListKey.BONUS, aBonus);
    }
    bite.put(IntegerKey.SLOTS, 0);
    bite.setQty(Float.valueOf(1));
    bite.setNumberCarried(1.0f);
    bite.put(ObjectKey.ATTACKS_PROGRESS, false);
    bite.getEquipmentHead(1).put(StringKey.DAMAGE, "1d10");
    bite.getEquipmentHead(1).put(IntegerKey.CRIT_MULT, 2);
    bite.getEquipmentHead(1).put(IntegerKey.CRIT_RANGE, 2);
    bite.put(ObjectKey.WIELD, context.getReferenceContext().silentlyGetConstructedCDOMObject(WieldCategory.class, "OneHanded"));
    bite.put(ObjectKey.WEAPON_PROF, new CDOMDirectSingleRef<>(wp));
    longbow = new Equipment();
    longbow.setName("Longbow");
    TestHelper.addType(longbow, "Weapon.Martial.Ranged.Standard.Piercing.Container.Projectile.Bow.Longbow");
    longbow.put(ObjectKey.TOTAL_CAPACITY, Capacity.ANY);
    longbow.put(ObjectKey.CONTAINER_WEIGHT_CAPACITY, BigDecimal.ONE);
    longbow.addToListFor(ListKey.CAPACITY, new Capacity("Arrow", BigDecimal.ONE));
    longbow.setQty(Float.valueOf(1));
    longbow.setNumberCarried(1.0f);
    arrow = new Equipment();
    arrow.setName("Arrow");
    TestHelper.addType(arrow, "Ammunition.Standard.Arrow.Individual");
    // Weild categories
    WieldCategory twoHanded = context.getReferenceContext().silentlyGetConstructedCDOMObject(WieldCategory.class, "TwoHanded");
    twoHanded.setSizeDifference(1);
    // Equip mods
    EquipmentModifier eqMod = new EquipmentModifier();
    eqMod.setName("Plus 1 Enhancement");
    eqMod.put(StringKey.KEY_NAME, "PLUS1W");
    TestHelper.addType(eqMod, "Ammunition.Weapon");
    eqMod.put(IntegerKey.PLUS, 1);
    eqMod.addToListFor(ListKey.ITEM_TYPES, "Enhancement");
    eqMod.addToListFor(ListKey.ITEM_TYPES, "Magic");
    eqMod.addToListFor(ListKey.ITEM_TYPES, "Plus1");
    aBonus = Bonus.newBonus(context, "WEAPON|DAMAGE,TOHIT|1|TYPE=Enhancement");
    if (aBonus != null) {
        eqMod.addToListFor(ListKey.BONUS, aBonus);
    }
    context.getReferenceContext().importObject(eqMod);
    eqMod = new EquipmentModifier();
    eqMod.setName("Plus 2 Enhancement");
    eqMod.put(StringKey.KEY_NAME, "PLUS2W");
    TestHelper.addType(eqMod, "Ammunition.Weapon");
    eqMod.put(IntegerKey.PLUS, 2);
    eqMod.addToListFor(ListKey.ITEM_TYPES, "Enhancement");
    eqMod.addToListFor(ListKey.ITEM_TYPES, "Magic");
    eqMod.addToListFor(ListKey.ITEM_TYPES, "Plus2");
    aBonus = Bonus.newBonus(context, "WEAPON|DAMAGE,TOHIT|2|TYPE=Enhancement");
    if (aBonus != null) {
        eqMod.addToListFor(ListKey.BONUS, aBonus);
    }
    context.getReferenceContext().importObject(eqMod);
    eqMod = new EquipmentModifier();
    eqMod.setName("Masterwork");
    eqMod.put(StringKey.KEY_NAME, "MWORKW");
    TestHelper.addType(eqMod, "Ammunition.Weapon");
    eqMod.addToListFor(ListKey.ITEM_TYPES, "Masterwork");
    aBonus = Bonus.newBonus(context, "WEAPON|TOHIT|1|TYPE=Enhancement");
    if (aBonus != null) {
        eqMod.addToListFor(ListKey.BONUS, aBonus);
    }
    context.getReferenceContext().importObject(eqMod);
    PCTemplate pct = new PCTemplate();
    context.unconditionallyProcess(pct, "AUTO", "WEAPONPROF|KEY_Sword (Bastard)|KEY_LONGSWORD|SillyBite");
    character.addTemplate(pct);
    wpnBonusPct = new PCTemplate();
    context.unconditionallyProcess(wpnBonusPct, "BONUS", "WEAPONPROF=DoubleWpn|DAMAGE|3");
    context.unconditionallyProcess(wpnBonusPct, "BONUS", "WEAPONPROF=DoubleWpn|TOHIT|4");
    wpnBonusAbility = TestHelper.makeAbility("FEAT_BONUS", AbilityCategory.FEAT, "General");
    context.unconditionallyProcess(wpnBonusAbility, "BONUS", "WEAPONPROF=DoubleWpn|DAMAGE|1");
    context.unconditionallyProcess(wpnBonusAbility, "BONUS", "WEAPONPROF=DoubleWpn|TOHIT|2");
    assertTrue(context.getReferenceContext().resolveReferences(null));
}
Also used : BonusObj(pcgen.core.bonus.BonusObj) EquipSet(pcgen.core.character.EquipSet) WeaponProf(pcgen.core.WeaponProf) PCClass(pcgen.core.PCClass) FixedSizeFormula(pcgen.cdom.formula.FixedSizeFormula) GameMode(pcgen.core.GameMode) EquipmentModifier(pcgen.core.EquipmentModifier) PlayerCharacter(pcgen.core.PlayerCharacter) Equipment(pcgen.core.Equipment) Capacity(pcgen.cdom.helper.Capacity) Race(pcgen.core.Race) LoadContext(pcgen.rules.context.LoadContext) WieldCategory(pcgen.core.character.WieldCategory) RuleCheck(pcgen.core.RuleCheck) PCTemplate(pcgen.core.PCTemplate) SizeAdjustment(pcgen.core.SizeAdjustment)

Example 49 with Equipment

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

the class StatTokenTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    LoadContext context = Globals.getContext();
    boots = new Equipment();
    boots.setName("Boots of Dex");
    BonusObj aBonus = Bonus.newBonus(context, "STAT|DEX|2|TYPE=Enhancement");
    if (aBonus != null) {
        boots.addToListFor(ListKey.BONUS, aBonus);
    }
    spell = new Spell();
    spell.setName("Weasel's Slipperiness");
    aBonus = Bonus.newBonus(context, "STAT|DEX|4|TYPE=Enhancement");
    if (aBonus != null) {
        spell.addToListFor(ListKey.BONUS, aBonus);
    }
    template1 = new PCTemplate();
    template1.setName("Munchkiny Goodness I");
    aBonus = Bonus.newBonus(context, "STAT|STR,CON,DEX|1|TYPE=Luck");
    if (aBonus != null) {
        template1.addToListFor(ListKey.BONUS, aBonus);
    }
    template2 = new PCTemplate();
    template2.setName("Munchkiny Goodness II");
    aBonus = Bonus.newBonus(context, "STAT|STR,CON,DEX|1|TYPE=Enhancement");
    if (aBonus != null) {
        template2.addToListFor(ListKey.BONUS, aBonus);
    }
    template3 = new PCTemplate();
    template3.setName("Lock the stat");
    template3.addToListFor(ListKey.STAT_MINVALUE, new StatLock(context.getReferenceContext().getCDOMReference(PCStat.class, "WIS"), FormulaFactory.getFormulaFor("12")));
    template4 = new PCTemplate();
    template4.setName("Unwise");
    aBonus = Bonus.newBonus(context, "STAT|WIS|-8|TYPE=Enhancement");
    if (aBonus != null) {
        template4.addToListFor(ListKey.BONUS, aBonus);
    }
}
Also used : Equipment(pcgen.core.Equipment) BonusObj(pcgen.core.bonus.BonusObj) LoadContext(pcgen.rules.context.LoadContext) PCTemplate(pcgen.core.PCTemplate) Spell(pcgen.core.spell.Spell) StatLock(pcgen.cdom.helper.StatLock)

Example 50 with Equipment

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

the class ExportHandlerTest method setUp.

/**
	 * @see pcgen.AbstractCharacterTestCase#setUp()
	 */
@Override
protected void setUp() throws Exception {
    super.setUp();
    PlayerCharacter character = getCharacter();
    LoadContext context = Globals.getContext();
    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);
    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);
    character.setSkillOrder(knowledge[0], 2);
    Globals.getContext().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);
    character.setSkillOrder(knowledge[1], 3);
    Globals.getContext().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);
    character.setSkillOrder(tumble, 4);
    Globals.getContext().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);
    character.setSkillOrder(balance, 1);
    aBonus = Bonus.newBonus(context, "SKILL|Balance|2|PRESKILL:1,Tumble=5|TYPE=Synergy.STACK");
    if (aBonus != null) {
        balance.addToListFor(ListKey.BONUS, aBonus);
    }
    Globals.getContext().getReferenceContext().importObject(balance);
    SkillRankControl.modRanks(4.0, myClass, true, character, balance);
    character.calcActiveBonuses();
    weapon = new Equipment();
    weapon.setName("TestWpn");
    weapon.addToListFor(ListKey.TYPE, Type.WEAPON);
    gem = new Equipment();
    gem.setName("TestGem");
    gem.addToListFor(ListKey.TYPE, Type.getConstant("gem"));
    gem.setQty(1);
    armor = new Equipment();
    armor.setName("TestArmorSuit");
    TestHelper.addType(armor, "armor.suit");
    context.getReferenceContext().buildDerivedObjects();
    context.getReferenceContext().resolveReferences(null);
}
Also used : GameMode(pcgen.core.GameMode) Skill(pcgen.core.Skill) PlayerCharacter(pcgen.core.PlayerCharacter) BonusObj(pcgen.core.bonus.BonusObj) Equipment(pcgen.core.Equipment) LevelInfo(pcgen.core.LevelInfo) Race(pcgen.core.Race) LoadContext(pcgen.rules.context.LoadContext) PCClass(pcgen.core.PCClass) PCStat(pcgen.core.PCStat)

Aggregations

Equipment (pcgen.core.Equipment)166 PlayerCharacter (pcgen.core.PlayerCharacter)41 ArrayList (java.util.ArrayList)28 StringTokenizer (java.util.StringTokenizer)25 EquipSet (pcgen.core.character.EquipSet)22 CDOMObject (pcgen.cdom.base.CDOMObject)20 LoadContext (pcgen.rules.context.LoadContext)15 SizeAdjustment (pcgen.core.SizeAdjustment)11 EquipmentHead (pcgen.cdom.inst.EquipmentHead)10 WeaponProf (pcgen.core.WeaponProf)10 CharID (pcgen.cdom.enumeration.CharID)9 WieldCategory (pcgen.core.character.WieldCategory)9 CDOMReference (pcgen.cdom.base.CDOMReference)8 ArmorProf (pcgen.core.ArmorProf)8 EquipmentModifier (pcgen.core.EquipmentModifier)8 Race (pcgen.core.Race)8 ShieldProf (pcgen.core.ShieldProf)8 BonusObj (pcgen.core.bonus.BonusObj)8 Test (org.junit.Test)7 ScopeInstance (pcgen.base.formula.base.ScopeInstance)7