use of pcgen.core.Skill in project pcgen by PCGen.
the class LocalAddedSkillCostFacetTest method testRemoveUselessClass.
@Test
public void testRemoveUselessClass() {
Skill t1 = getObject();
assertFalse(getFacet().contains(id, class1, SkillCost.CLASS, t1));
getFacet().add(id, class1, SkillCost.CLASS, t1, source1);
getFacet().add(id, class2, SkillCost.CLASS, t1, source1);
assertTrue(getFacet().contains(id, class1, SkillCost.CLASS, t1));
assertFalse(getFacet().contains(id, class1, SkillCost.CROSS_CLASS, t1));
assertTrue(getFacet().contains(id, class2, SkillCost.CLASS, t1));
//No cross pollution
getFacet().remove(id, class3, SkillCost.CLASS, t1, source1);
assertTrue(getFacet().contains(id, class2, SkillCost.CLASS, t1));
getFacet().remove(id, class2, SkillCost.CLASS, t1, source1);
assertFalse(getFacet().contains(id, class2, SkillCost.CLASS, t1));
assertTrue(getFacet().contains(id, class1, SkillCost.CLASS, t1));
getFacet().remove(id, class1, SkillCost.CLASS, t1, source1);
assertFalse(getFacet().contains(id, class1, SkillCost.CLASS, t1));
}
use of pcgen.core.Skill in project pcgen by PCGen.
the class LocalAddedSkillCostFacetTest method testAddTwoClasses.
@Test
public void testAddTwoClasses() {
Skill t1 = getObject();
Skill t2 = getObject();
assertFalse(getFacet().contains(id, class1, SkillCost.CLASS, t1));
getFacet().add(id, class1, SkillCost.CLASS, t1, source1);
assertTrue(getFacet().contains(id, class1, SkillCost.CLASS, t1));
assertFalse(getFacet().contains(id, class1, SkillCost.CLASS, t2));
assertFalse(getFacet().contains(id, class1, SkillCost.CROSS_CLASS, t1));
assertFalse(getFacet().contains(id, class2, SkillCost.CLASS, t1));
assertFalse(getFacet().contains(id, class2, SkillCost.CLASS, t2));
//No cross pollution
assertFalse(getFacet().contains(altid, class1, SkillCost.CLASS, t1));
getFacet().add(id, class2, SkillCost.CLASS, t2, source1);
assertTrue(getFacet().contains(id, class1, SkillCost.CLASS, t1));
assertFalse(getFacet().contains(id, class1, SkillCost.CLASS, t2));
assertFalse(getFacet().contains(id, class1, SkillCost.CROSS_CLASS, t1));
assertTrue(getFacet().contains(id, class2, SkillCost.CLASS, t2));
assertFalse(getFacet().contains(id, class2, SkillCost.CLASS, t1));
//No cross pollution
assertFalse(getFacet().contains(altid, class1, SkillCost.CLASS, t1));
assertFalse(getFacet().contains(altid, class2, SkillCost.CLASS, t2));
}
use of pcgen.core.Skill in project pcgen by PCGen.
the class LocalAddedSkillCostFacetTest method testRemoveUselessSkill.
@Test
public void testRemoveUselessSkill() {
Skill t1 = getObject();
getFacet().add(id, class1, SkillCost.CLASS, t1, source1);
//Just don't throw an exception
getFacet().remove(id, class1, SkillCost.CLASS, getAltObject(), source1);
}
use of pcgen.core.Skill in project pcgen by PCGen.
the class LocalAddedSkillCostFacetTest method testAddMultGet.
@Test
public void testAddMultGet() {
Skill t1 = getObject();
assertFalse(getFacet().contains(id, class1, SkillCost.CLASS, t1));
getFacet().add(id, class1, SkillCost.CLASS, t1, source1);
assertTrue(getFacet().contains(id, class1, SkillCost.CLASS, t1));
assertFalse(getFacet().contains(id, class1, SkillCost.CROSS_CLASS, t1));
//No cross pollution
assertFalse(getFacet().contains(altid, class1, SkillCost.CLASS, t1));
Skill t2 = getAltObject();
//Second add doesn't change anything
getFacet().add(id, class1, SkillCost.CROSS_CLASS, t2, source1);
assertTrue(getFacet().contains(id, class1, SkillCost.CLASS, t1));
assertTrue(getFacet().contains(id, class1, SkillCost.CROSS_CLASS, t2));
assertFalse(getFacet().contains(id, class1, SkillCost.CLASS, t2));
//No cross pollution
assertFalse(getFacet().contains(altid, class1, SkillCost.CROSS_CLASS, t2));
}
use of pcgen.core.Skill in project pcgen by PCGen.
the class PreVarTest method test2857848c.
public void test2857848c() {
final PCClass warrior = new PCClass();
warrior.setName("Warrior");
LoadContext context = Globals.getContext();
context.unconditionallyProcess(warrior, "DEFINE", "MyVar|0");
context.unconditionallyProcess(warrior, "BONUS", "VAR|MyVar|2");
final PCClass notawarrior = new PCClass();
notawarrior.setName("NotAWarrior");
context.unconditionallyProcess(notawarrior, "PREVARGTEQ", "MyVar,1");
Skill concentration = context.getReferenceContext().constructCDOMObject(Skill.class, "Concentration");
context.unconditionallyProcess(notawarrior, "CSKILL", "Concentration");
context.unconditionallyProcess(notawarrior, "BONUS", "SKILL|Concentration|5");
assertTrue(context.getReferenceContext().resolveReferences(null));
PCClassLoader loader = new PCClassLoader();
try {
SourceEntry se = new CampaignSourceEntry(new Campaign(), new URI("file://test"));
loader.completeObject(context, se, warrior);
loader.completeObject(context, se, notawarrior);
PlayerCharacter character = this.getCharacter();
assertFalse(notawarrior.qualifies(character, notawarrior));
//Fails
character.incrementClassLevel(1, notawarrior);
assertEquals(0, SkillModifier.modifier(concentration, character).intValue());
character.incrementClassLevel(1, warrior);
assertEquals(0, SkillModifier.modifier(concentration, character).intValue());
assertTrue(notawarrior.qualifies(character, notawarrior));
character.incrementClassLevel(1, notawarrior);
assertEquals(5, SkillModifier.modifier(concentration, character).intValue());
} catch (URISyntaxException | PersistenceLayerException e) {
fail(e.getMessage());
}
}
Aggregations