use of pcgen.core.Ability in project pcgen by PCGen.
the class AbstractGlobalTargetedSaveRestoreTest method testAddAbilityVirtualTarget.
@Test
public void testAddAbilityVirtualTarget() {
TokenRegistration.register(plugin.bonustokens.SkillRank.class);
T target = create(getObjectClass(), "Target");
Ability abil = context.getReferenceContext().constructCDOMObject(Ability.class, "GrantedAbility");
context.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, abil);
new plugin.lsttokens.add.AbilityToken().parseToken(context, target, "FEAT|VIRTUAL|GrantedAbility");
Skill granted = create(Skill.class, "GrantedSkill");
create(Skill.class, "IgnoredSkill");
new plugin.lsttokens.choose.SkillToken().parseToken(context, abil, "GrantedSkill|IgnoredSkill");
new plugin.lsttokens.BonusLst().parseToken(context, abil, "SKILLRANK|%LIST|1");
abil.put(ObjectKey.MULTIPLE_ALLOWED, true);
Object o = prepare(target);
finishLoad();
assertEquals(0.0f, SkillRankControl.getTotalRank(pc, granted));
applyObject(target);
pc.setDirty(true);
pc.calcActiveBonuses();
assertEquals(1.0f, SkillRankControl.getTotalRank(pc, granted));
runRoundRobin(getPreEqualityCleanup());
assertEquals(1.0f, SkillRankControl.getTotalRank(pc, granted));
assertEquals(1.0f, SkillRankControl.getTotalRank(reloadedPC, granted));
remove(o);
reloadedPC.setDirty(true);
//This fails (see CODE-2387)
//assertEquals(0.0f, SkillRankControl.getTotalRank(reloadedPC, granted));
}
use of pcgen.core.Ability in project pcgen by PCGen.
the class AbilityIntegrationTest method testRoundRobinMixed.
@Test
public void testRoundRobinMixed() throws PersistenceLayerException {
verifyCleanStart();
Ability ab = primaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil1");
primaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
ab = secondaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil1");
secondaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
ab = primaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil2");
primaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
ab = secondaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil2");
secondaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
TestContext tc = new TestContext();
commit(testCampaign, tc, "FEAT|VIRTUAL|.CLEAR.Abil2|Abil1");
commit(modCampaign, tc, "FEAT|AUTOMATIC|.CLEAR.Abil1|Abil2");
completeRoundRobin(tc);
}
use of pcgen.core.Ability in project pcgen by PCGen.
the class AbilityIntegrationTest method testRoundRobinClearOrder.
@Test
public void testRoundRobinClearOrder() throws PersistenceLayerException {
verifyCleanStart();
Ability ab = primaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil1");
primaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
ab = secondaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil1");
secondaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
ab = primaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil2");
primaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
ab = secondaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil2");
secondaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
TestContext tc = new TestContext();
commit(testCampaign, tc, "FEAT|VIRTUAL|.CLEAR", "FEAT|VIRTUAL|Abil1|Abil2");
commit(modCampaign, tc, "FEAT|VIRTUAL|.CLEAR");
completeRoundRobin(tc);
}
use of pcgen.core.Ability in project pcgen by PCGen.
the class AbilityIntegrationTest method testRoundRobinNoReset.
@Test
public void testRoundRobinNoReset() throws PersistenceLayerException {
verifyCleanStart();
Ability ab = primaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil1");
primaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
ab = secondaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil1");
secondaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
ab = primaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil2");
primaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
ab = secondaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil2");
secondaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
TestContext tc = new TestContext();
commit(testCampaign, tc, "FEAT|VIRTUAL|Abil1|Abil2");
emptyCommit(modCampaign, tc);
completeRoundRobin(tc);
}
use of pcgen.core.Ability in project pcgen by PCGen.
the class AbilityIntegrationTest method testRoundRobinSimple.
@Test
public void testRoundRobinSimple() throws PersistenceLayerException {
verifyCleanStart();
Ability ab = primaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil1");
primaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
ab = secondaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil1");
secondaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
ab = primaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil2");
primaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
ab = secondaryContext.getReferenceContext().constructCDOMObject(Ability.class, "Abil2");
secondaryContext.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, ab);
TestContext tc = new TestContext();
commit(testCampaign, tc, "FEAT|NORMAL|Abil1");
commit(modCampaign, tc, "FEAT|VIRTUAL|TYPE=TestType");
completeRoundRobin(tc);
}
Aggregations