use of pcgen.core.Campaign in project pcgen by PCGen.
the class AbstractKitTokenTestCase method classSetUp.
@BeforeClass
public static void classSetUp() throws URISyntaxException {
testCampaign = new CampaignSourceEntry(new Campaign(), new URI("file:/Test%20Case"));
classSetUpFired = true;
}
use of pcgen.core.Campaign in project pcgen by PCGen.
the class FacadeFactory method passesPrereqs.
public static boolean passesPrereqs(List<CampaignFacade> campaigns) {
PersistenceManager pman = PersistenceManager.getInstance();
List<URI> oldList = pman.getChosenCampaignSourcefiles();
List<URI> uris = new ArrayList<>();
for (CampaignFacade campaignFacade : campaigns) {
uris.add(((Campaign) campaignFacade).getSourceURI());
}
pman.setChosenCampaignSourcefiles(uris);
for (CampaignFacade campaignFacade : campaigns) {
Campaign camp = ((Campaign) campaignFacade);
if (!camp.qualifies(null, camp)) {
pman.setChosenCampaignSourcefiles(oldList);
return false;
}
}
pman.setChosenCampaignSourcefiles(oldList);
return true;
}
use of pcgen.core.Campaign 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());
}
}
use of pcgen.core.Campaign in project pcgen by PCGen.
the class PreVarTest method test2857849and2862276.
public void test2857849and2862276() {
LoadContext context = Globals.getContext();
final PCClass spellcaster = new PCClass();
spellcaster.setName("Spellcaster");
context.getReferenceContext().importObject(spellcaster);
context.unconditionallyProcess(spellcaster, "SPELLTYPE", "Arcane");
context.unconditionallyProcess(spellcaster, "SPELLSTAT", "INT");
context.unconditionallyProcess(spellcaster, "PREVARGTEQ", "BASESPELLSTAT,2");
PCClassLoader loader = new PCClassLoader();
try {
SourceEntry se = new CampaignSourceEntry(new Campaign(), new URI("file://test"));
loader.completeObject(context, se, spellcaster);
context.getReferenceContext().resolveReferences(null);
PlayerCharacter character = this.getCharacter();
setPCStat(character, intel, 16);
assertTrue(spellcaster.qualifies(character, spellcaster));
} catch (URISyntaxException | PersistenceLayerException e) {
fail(e.getMessage());
}
}
use of pcgen.core.Campaign in project pcgen by PCGen.
the class PreVarTest method test2857849a.
public void test2857849a() {
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");
PCClassLoader loader = new PCClassLoader();
try {
SourceEntry se = new CampaignSourceEntry(new Campaign(), new URI("file://test"));
final PCClass notawarrior = loader.parseLine(context, null, "CLASS:NotAWarrior\tPREVARGTEQ:MyVar,1", se);
loader.completeObject(context, se, warrior);
loader.completeObject(context, se, notawarrior);
PlayerCharacter character = this.getCharacter();
assertFalse(notawarrior.qualifies(character, notawarrior));
character.incrementClassLevel(1, warrior);
assertTrue(notawarrior.qualifies(character, notawarrior));
} catch (URISyntaxException | PersistenceLayerException e) {
fail(e.getMessage());
}
}
Aggregations