use of pcgen.cdom.content.CNAbility in project pcgen by PCGen.
the class FeatAllToken method getAbilityList.
/**
* @see pcgen.io.exporttoken.AbilityToken#getAbilityList(pcgen.core.PlayerCharacter, pcgen.core.AbilityCategory)
*/
@Override
protected MapToList<Ability, CNAbility> getAbilityList(PlayerCharacter pc, final AbilityCategory aCategory) {
final MapToList<Ability, CNAbility> listOfAbilities = new HashMapToList<>();
Collection<AbilityCategory> allCats = SettingsHandler.getGame().getAllAbilityCategories();
for (AbilityCategory aCat : allCats) {
if (aCat.getParentCategory().equals(aCategory)) {
for (CNAbility cna : pc.getPoolAbilities(aCat, Nature.NORMAL)) {
listOfAbilities.addToListFor(cna.getAbility(), cna);
}
for (CNAbility cna : pc.getPoolAbilities(aCat, Nature.AUTOMATIC)) {
listOfAbilities.addToListFor(cna.getAbility(), cna);
}
for (CNAbility cna : pc.getPoolAbilities(aCat, Nature.VIRTUAL)) {
listOfAbilities.addToListFor(cna.getAbility(), cna);
}
}
}
return listOfAbilities;
}
use of pcgen.cdom.content.CNAbility in project pcgen by PCGen.
the class AbilityAllListToken method getAbilityList.
/**
* @see pcgen.io.exporttoken.AbilityListToken#getAbilityList(pcgen.core.PlayerCharacter, pcgen.core.AbilityCategory)
*/
@Override
protected MapToList<Ability, CNAbility> getAbilityList(PlayerCharacter pc, final AbilityCategory aCategory) {
final MapToList<Ability, CNAbility> listOfAbilities = new HashMapToList<>();
Collection<AbilityCategory> allCats = SettingsHandler.getGame().getAllAbilityCategories();
for (AbilityCategory aCat : allCats) {
if (AbilityCategory.ANY.equals(aCategory) || aCat.getParentCategory().equals(aCategory)) {
for (CNAbility cna : pc.getPoolAbilities(aCat, Nature.NORMAL)) {
listOfAbilities.addToListFor(cna.getAbility(), cna);
}
for (CNAbility cna : pc.getPoolAbilities(aCat, Nature.AUTOMATIC)) {
listOfAbilities.addToListFor(cna.getAbility(), cna);
}
for (CNAbility cna : pc.getPoolAbilities(aCat, Nature.VIRTUAL)) {
listOfAbilities.addToListFor(cna.getAbility(), cna);
}
}
}
return listOfAbilities;
}
use of pcgen.cdom.content.CNAbility in project pcgen by PCGen.
the class AbilityAllToken method getAbilityList.
/**
* @see pcgen.io.exporttoken.AbilityToken#getAbilityList(pcgen.core.PlayerCharacter, pcgen.core.AbilityCategory)
*/
@Override
protected MapToList<Ability, CNAbility> getAbilityList(PlayerCharacter pc, final AbilityCategory aCategory) {
final MapToList<Ability, CNAbility> listOfAbilities = new HashMapToList<>();
Collection<AbilityCategory> allCats = SettingsHandler.getGame().getAllAbilityCategories();
for (AbilityCategory aCat : allCats) {
if (AbilityCategory.ANY.equals(aCategory) || aCat.getParentCategory().equals(aCategory)) {
for (CNAbility cna : pc.getPoolAbilities(aCat, Nature.NORMAL)) {
listOfAbilities.addToListFor(cna.getAbility(), cna);
}
for (CNAbility cna : pc.getPoolAbilities(aCat, Nature.AUTOMATIC)) {
listOfAbilities.addToListFor(cna.getAbility(), cna);
}
for (CNAbility cna : pc.getPoolAbilities(aCat, Nature.VIRTUAL)) {
listOfAbilities.addToListFor(cna.getAbility(), cna);
}
}
}
return listOfAbilities;
}
use of pcgen.cdom.content.CNAbility in project pcgen by PCGen.
the class AbstractCNASEnforcingFacetTest method testDifferentSelectionStack.
@Test
public void testDifferentSelectionStack() {
Object source1 = new Object();
assertTrue(getFacet().isEmpty(id));
assertEquals(0, getFacet().getCount(id));
CNAbility n1 = CNAbilityFactory.getCNAbility(feat, Nature.NORMAL, stackyes);
CNAbility n2 = CNAbilityFactory.getCNAbility(feat, Nature.NORMAL, stackyes);
CNAbilitySelection cnas1 = new CNAbilitySelection(n1, "English");
CNAbilitySelection cnas2 = new CNAbilitySelection(n2, "German");
assertTrue(getFacet().add(id, cnas1, source1));
assertFalse(getFacet().isEmpty(id));
assertEquals(1, getFacet().getCount(id));
assertTrue(getFacet().add(id, cnas2, source1));
assertEquals(2, getFacet().getCount(id));
assertTrue(getFacet().remove(id, cnas2, source1));
assertEquals(1, getFacet().getCount(id));
assertFalse(getFacet().isEmpty(id));
assertTrue(getFacet().remove(id, cnas1, source1));
assertEquals(0, getFacet().getCount(id));
assertTrue(getFacet().isEmpty(id));
}
use of pcgen.cdom.content.CNAbility in project pcgen by PCGen.
the class AbstractCNASEnforcingFacetTest method testDifferentAbility.
@Test
public void testDifferentAbility() {
Object source1 = new Object();
assertTrue(getFacet().isEmpty(id));
assertEquals(0, getFacet().getCount(id));
CNAbility nomultCNA = CNAbilityFactory.getCNAbility(feat, Nature.NORMAL, nomult);
CNAbility othernomultCNA = CNAbilityFactory.getCNAbility(feat, Nature.NORMAL, othernomult);
CNAbilitySelection cnas1 = new CNAbilitySelection(nomultCNA);
CNAbilitySelection cnas2 = new CNAbilitySelection(othernomultCNA);
assertTrue(getFacet().add(id, cnas1, source1));
assertFalse(getFacet().isEmpty(id));
assertEquals(1, getFacet().getCount(id));
assertTrue(getFacet().add(id, cnas2, source1));
assertEquals(2, getFacet().getCount(id));
assertTrue(getFacet().remove(id, cnas2, source1));
assertEquals(1, getFacet().getCount(id));
assertFalse(getFacet().isEmpty(id));
assertTrue(getFacet().remove(id, cnas1, source1));
assertEquals(0, getFacet().getCount(id));
assertTrue(getFacet().isEmpty(id));
}
Aggregations