use of pcgen.base.util.HashMapToList in project pcgen by PCGen.
the class AbilityToken method getAbilityList.
/**
* Returns the correct list of abilities for the character. This method is
* overridden in subclasses if they need to change the list of abilities
* looked at.
*
* @param pc
* The character who's abilities we are retrieving.
* @param aCategory
* The category of ability being reported.
* @return List of abilities.
*/
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);
}
}
}
return listOfAbilities;
}
use of pcgen.base.util.HashMapToList in project pcgen by PCGen.
the class KitTemplate method buildSelectedTemplateMap.
/**
* Extract the templates to be applied and their choices
* @param aPC The PC the kit is being applied to.
* @param apply Is this a real application, false if a test run.
* @return The map of templates and child templates to be added
*/
private HashMapToList<PCTemplate, PCTemplate> buildSelectedTemplateMap(PlayerCharacter aPC, boolean apply) {
boolean tempShowHP = SettingsHandler.getShowHPDialogAtLevelUp();
SettingsHandler.setShowHPDialogAtLevelUp(false);
if (!apply) {
ChooserFactory.pushChooserClassname(//$NON-NLS-1$
"pcgen.util.chooser.RandomChooser");
}
HashMapToList<PCTemplate, PCTemplate> selectedMap = new HashMapToList<>();
for (CDOMSingleRef<PCTemplate> ref : templateList.getKeySet()) {
PCTemplate templateToAdd = ref.get();
List<CDOMSingleRef<PCTemplate>> subList = templateList.getListFor(ref);
List<PCTemplate> subAdded = new ArrayList<>();
if (subList != null) {
for (CDOMSingleRef<PCTemplate> subRef : subList) {
PCTemplate ownedTemplate = subRef.get();
subAdded.add(ownedTemplate);
aPC.setTemplatesAdded(templateToAdd, ownedTemplate);
}
}
aPC.addTemplate(templateToAdd);
selectedMap.initializeListFor(templateToAdd);
selectedMap.addAllToListFor(templateToAdd, subAdded);
}
if (!apply) {
ChooserFactory.popChooserClassname();
}
SettingsHandler.setShowHPDialogAtLevelUp(tempShowHP);
return selectedMap;
}
use of pcgen.base.util.HashMapToList in project pcgen by PCGen.
the class VFeatListToken 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 (aCat.getParentCategory().equals(aCategory)) {
for (CNAbility cna : pc.getPoolAbilities(aCat, Nature.VIRTUAL)) {
listOfAbilities.addToListFor(cna.getAbility(), cna);
}
}
}
return listOfAbilities;
}
use of pcgen.base.util.HashMapToList in project pcgen by PCGen.
the class VAbilityListToken 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.VIRTUAL)) {
listOfAbilities.addToListFor(cna.getAbility(), cna);
}
}
}
return listOfAbilities;
}
use of pcgen.base.util.HashMapToList in project pcgen by PCGen.
the class VAbilityToken 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.VIRTUAL)) {
listOfAbilities.addToListFor(cna.getAbility(), cna);
}
}
}
return listOfAbilities;
}
Aggregations