use of pcgen.cdom.content.CNAbility in project pcgen by PCGen.
the class ChooserUtilities method getConfiguredController.
public static <T> ChoiceManagerList<T> getConfiguredController(final ChooseDriver aPObject, final PlayerCharacter aPC, final AbilityCategory category, List<String> reservedList) {
ChoiceManagerList aMan = getChoiceManager(aPObject, aPC);
if (aMan == null) {
return null;
}
if (aPObject instanceof CNAbility) {
CNAbility driver = (CNAbility) aPObject;
Ability a = driver.getAbility();
AbilityCategory cat;
if (category == null) {
cat = SettingsHandler.getGame().getAbilityCategory(a.getCategory());
} else {
cat = category;
}
aMan.setController(new AbilityChooseController(a, cat, aPC, aMan));
List<CNAbility> abilities = aPC.getMatchingCNAbilities(a);
for (CNAbility cna : abilities) {
reservedList.addAll(aPC.getAssociationList(cna));
}
} else if (aPObject instanceof Skill) {
Skill s = (Skill) aPObject;
aMan.setController(new SkillChooseController(s, aPC));
}
return aMan;
}
use of pcgen.cdom.content.CNAbility in project pcgen by PCGen.
the class QualifiedName method processChooseInfo.
private static <T> void processChooseInfo(StringBuilder aStrBuf, PlayerCharacter pc, ChooseInformation<T> chooseInfo, List<CNAbility> list) {
List<T> allSelections = new ArrayList<>();
for (CNAbility cna : list) {
if (pc.hasAssociations(cna)) {
List<? extends T> selections = (List<? extends T>) pc.getDetailedAssociations(cna);
allSelections.addAll(selections);
}
}
String choiceInfo = chooseInfo.composeDisplay(allSelections).toString();
if (!choiceInfo.isEmpty()) {
aStrBuf.append(" (");
aStrBuf.append(choiceInfo);
aStrBuf.append(")");
}
}
use of pcgen.cdom.content.CNAbility in project pcgen by PCGen.
the class GrantedAbilityFacet method getCNAbilities.
public Collection<CNAbility> getCNAbilities(CharID id, Ability ability) {
Set<CNAbility> returnList = new HashSet<>();
List<List<SourcedCNAS>> list = getList(id);
if (list != null) {
Category<Ability> cat = ability.getCDOMCategory();
for (List<SourcedCNAS> array : list) {
CNAbility cna = array.get(0).cnas.getCNAbility();
if (cna.getAbilityCategory().getParentCategory().equals(cat) && cna.getAbilityKey().equals(ability.getKeyName())) {
returnList.add(cna);
}
}
}
return returnList;
}
use of pcgen.cdom.content.CNAbility in project pcgen by PCGen.
the class GrantedAbilityFacet method getPoolAbilities.
public Collection<CNAbility> getPoolAbilities(CharID id, Category<Ability> cat, Nature n) {
List<CNAbility> returnList = new ArrayList<>();
List<List<SourcedCNAS>> list = getList(id);
if (list != null) {
for (List<SourcedCNAS> array : list) {
CNAbility cna = array.get(0).cnas.getCNAbility();
if (cna.getAbilityCategory().equals(cat) && cna.getNature() == n) {
returnList.add(cna);
}
}
}
return returnList;
}
use of pcgen.cdom.content.CNAbility in project pcgen by PCGen.
the class GrantedAbilityFacet method getCNAbilities.
public Collection<CNAbility> getCNAbilities(CharID id, Category<Ability> cat) {
if (cat.getParentCategory() != cat) {
//warning
}
List<CNAbility> returnList = new ArrayList<>();
List<List<SourcedCNAS>> list = getList(id);
if (list != null) {
for (List<SourcedCNAS> array : list) {
CNAbility cna = array.get(0).cnas.getCNAbility();
if (cna.getAbilityCategory().getParentCategory().equals(cat)) {
returnList.add(cna);
}
}
}
return returnList;
}
Aggregations