use of pcgen.cdom.content.CNAbility 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.cdom.content.CNAbility 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.cdom.content.CNAbility 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;
}
use of pcgen.cdom.content.CNAbility in project pcgen by PCGen.
the class AbilityToken method removeChoice.
@Override
public void removeChoice(PlayerCharacter pc, CDOMObject owner, CNAbilitySelection choice) {
CNAbility cna = choice.getCNAbility();
Ability ab = cna.getAbility();
AbilityCategory cat = (AbilityCategory) cna.getAbilityCategory();
if (cna.getNature().equals(Nature.NORMAL)) {
pc.adjustAbilities(cat, ab.getSafe(ObjectKey.SELECTION_COST).negate());
pc.removeAbility(choice, UserSelection.getInstance(), UserSelection.getInstance());
} else {
pc.removeSavedAbility(choice, UserSelection.getInstance(), UserSelection.getInstance());
}
}
use of pcgen.cdom.content.CNAbility in project pcgen by PCGen.
the class AbilityToken method applyChoice.
@Override
public void applyChoice(CDOMObject owner, CNAbilitySelection choice, PlayerCharacter pc) {
CNAbility cna = choice.getCNAbility();
Ability ab = cna.getAbility();
AbilityCategory cat = (AbilityCategory) cna.getAbilityCategory();
boolean isVirtual = Nature.VIRTUAL.equals(cna.getNature());
if (isVirtual) {
pc.addSavedAbility(choice, UserSelection.getInstance(), UserSelection.getInstance());
} else {
pc.addAbility(choice, UserSelection.getInstance(), UserSelection.getInstance());
pc.adjustAbilities(cat, ab.getSafe(ObjectKey.SELECTION_COST));
}
}
Aggregations