use of pcgen.persistence.lst.SourceEntry in project pcgen by PCGen.
the class PreVarTest method test2857848b.
public void test2857848b() {
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");
Skill concentration = context.getReferenceContext().constructCDOMObject(Skill.class, "Concentration");
context.unconditionallyProcess(notawarrior, "CSKILL", "Concentration");
context.unconditionallyProcess(notawarrior, "BONUS", "SKILL|Concentration|5|PREVARGT:MyVar,1");
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();
character.incrementClassLevel(1, notawarrior);
assertEquals(0, SkillModifier.modifier(concentration, character).intValue());
character.incrementClassLevel(1, warrior);
assertEquals(5, SkillModifier.modifier(concentration, character).intValue());
} catch (URISyntaxException | PersistenceLayerException e) {
fail(e.getMessage());
}
}
use of pcgen.persistence.lst.SourceEntry in project pcgen by PCGen.
the class PreVarTest method test2856622.
public void test2856622() {
LoadContext context = Globals.getContext();
final PCClass warrior = new PCClass();
warrior.setName("Warrior");
PCClassLevel level1 = warrior.getOriginalClassLevel(1);
context.unconditionallyProcess(level1, "SAB", "Test Works|PREVARGTEQ:CL,3");
assertTrue(context.getReferenceContext().resolveReferences(null));
PlayerCharacter character = this.getCharacter();
character.incrementClassLevel(1, warrior);
PCClassLoader loader = new PCClassLoader();
try {
SourceEntry se = new CampaignSourceEntry(new Campaign(), new URI("file://test"));
loader.completeObject(context, se, warrior);
List<SpecialAbility> sabList = level1.getListFor(ListKey.SAB);
assertNotNull(sabList);
assertEquals(1, sabList.size());
SpecialAbility sab = sabList.get(0);
assertFalse(sab.qualifies(character, warrior));
character.incrementClassLevel(1, warrior);
assertFalse(sab.qualifies(character, warrior));
character.incrementClassLevel(1, warrior);
assertTrue(sab.qualifies(character, warrior));
} catch (URISyntaxException | PersistenceLayerException e) {
fail(e.getMessage());
}
}
Aggregations