use of pcgen.base.util.HashMapToList 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.base.util.HashMapToList 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.base.util.HashMapToList 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.base.util.HashMapToList in project pcgen by PCGen.
the class ChangeprofLst method unparse.
@Override
public String[] unparse(LoadContext context, CDOMObject obj) {
Changes<ChangeProf> changes = context.getObjectContext().getListChanges(obj, ListKey.CHANGEPROF);
Collection<ChangeProf> added = changes.getAdded();
if (added == null || added.isEmpty()) {
// Zero indicates no Token
return null;
}
HashMapToList<CDOMGroupRef<WeaponProf>, CDOMReference<WeaponProf>> m = new HashMapToList<>();
for (ChangeProf cp : added) {
CDOMReference<WeaponProf> source = cp.getSource();
CDOMGroupRef<WeaponProf> result = cp.getResult();
m.addToListFor(result, source);
}
SortedSet<CDOMReference<WeaponProf>> set = new TreeSet<>(ReferenceUtilities.REFERENCE_SORTER);
Set<String> returnSet = new TreeSet<>();
for (CDOMGroupRef<WeaponProf> result : m.getKeySet()) {
StringBuilder sb = new StringBuilder();
boolean needComma = false;
set.clear();
set.addAll(m.getListFor(result));
for (CDOMReference<WeaponProf> source : set) {
if (needComma) {
sb.append(Constants.COMMA);
}
needComma = true;
String sourceLst = source.getLSTformat(false);
if (sourceLst.startsWith(Constants.LST_TYPE_EQUAL)) {
sb.append(Constants.LST_TYPE_DOT);
sb.append(sourceLst.substring(5));
} else {
sb.append(sourceLst);
}
}
sb.append(Constants.EQUALS).append(result.getLSTformat(false).substring(5));
returnSet.add(sb.toString());
}
return new String[] { StringUtil.join(returnSet, Constants.PIPE) };
}
use of pcgen.base.util.HashMapToList in project pcgen by PCGen.
the class FeatAutoToken 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.AUTOMATIC)) {
listOfAbilities.addToListFor(cna.getAbility(), cna);
}
}
}
return listOfAbilities;
}
Aggregations