use of pcgen.cdom.content.CNAbility in project pcgen by PCGen.
the class CNAbilitySelectionUtilitiesTest method testStack.
@Test
public void testStack() {
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, "English");
assertTrue(CNAbilitySelectionUtilities.canCoExist(cnas1, cnas2));
}
use of pcgen.cdom.content.CNAbility in project pcgen by PCGen.
the class AbilityTargetSaveRestoreTest method remove.
@Override
protected void remove(Object o) {
Ability abil = (Ability) o;
CNAbility cna = CNAbilityFactory.getCNAbility(AbilityCategory.FEAT, Nature.NORMAL, abil);
String assoc = null;
if (ChooseActivation.hasNewChooseToken(abil)) {
assoc = "Granted";
}
CNAbilitySelection cnas = new CNAbilitySelection(cna, assoc);
reloadedPC.removeAbility(cnas, UserSelection.getInstance(), UserSelection.getInstance());
//TODO These need to be moved into being core behaviors somehow
CDOMObjectUtilities.removeAdds(abil, reloadedPC);
CDOMObjectUtilities.restoreRemovals(abil, reloadedPC);
reloadedPC.adjustMoveRates();
}
use of pcgen.cdom.content.CNAbility in project pcgen by PCGen.
the class VFeatToken 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.VIRTUAL)) {
listOfAbilities.addToListFor(cna.getAbility(), cna);
}
}
}
return listOfAbilities;
}
use of pcgen.cdom.content.CNAbility in project pcgen by PCGen.
the class FeatToken method getList.
private <R> List<R> getList(PlayerCharacter pc, Ability a) {
// workaround for cloning issue
List<R> availableList = new ArrayList<>();
List<CNAbility> theFeats = pc.getMatchingCNAbilities(a);
for (CNAbility ability : theFeats) {
@SuppressWarnings("unchecked") List<? extends R> list = (List<? extends R>) pc.getDetailedAssociations(ability);
if (list != null) {
availableList.addAll(list);
}
}
return availableList;
}
use of pcgen.cdom.content.CNAbility in project pcgen by PCGen.
the class AbstractCharacterTestCase method removeAbility.
protected void removeAbility(AbilityCategory cat, Ability a) {
if (a.getSafe(ObjectKey.MULTIPLE_ALLOWED)) {
fail("addAbility takes Mult:NO Abilities");
}
CNAbility cna = CNAbilityFactory.getCNAbility(cat, Nature.NORMAL, a);
character.removeAbility(new CNAbilitySelection(cna, null), UserSelection.getInstance(), UserSelection.getInstance());
}
Aggregations