use of pcgen.core.AbilityCategory in project pcgen by PCGen.
the class AbilityToken method getToken.
/**
* @see pcgen.io.exporttoken.Token#getToken(java.lang.String,
* pcgen.core.PlayerCharacter, pcgen.io.ExportHandler)
*/
@Override
public String getToken(String tokenSource, PlayerCharacter pc, ExportHandler eh) {
// Skip the ABILITY token itself
final StringTokenizer aTok = new StringTokenizer(tokenSource, ".");
final String tokenString = aTok.nextToken();
// Get the Ability Category from the Gamemode given the key
final String categoryString = aTok.nextToken();
final AbilityCategory aCategory = "ANY".equals(categoryString) ? AbilityCategory.ANY : SettingsHandler.getGame().getAbilityCategory(categoryString);
// Get the ABILITY token for the category
return getTokenForCategory(tokenSource, pc, eh, aTok, tokenString, aCategory);
}
use of pcgen.core.AbilityCategory 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.core.AbilityCategory in project pcgen by PCGen.
the class CharacterAbilities method getTotalSelections.
/**
* Get the total number of selections for this category.
* @param categoryFacade The ability category to be retrieved.
* @return The total number of choices.
*/
public int getTotalSelections(AbilityCategoryFacade categoryFacade) {
if (categoryFacade == null || !(categoryFacade instanceof AbilityCategory)) {
return 0;
}
AbilityCategory category = (AbilityCategory) categoryFacade;
BigDecimal pool = theCharacter.getTotalAbilityPool(category);
return pool.intValue();
}
use of pcgen.core.AbilityCategory in project pcgen by PCGen.
the class CharacterAbilities method getRemainingSelections.
/**
* Get the number of selections that are remaining for this category.
* @param categoryFacade The ability category to be retrieved.
* @return The number of choices left.
*/
public int getRemainingSelections(AbilityCategoryFacade categoryFacade) {
if (categoryFacade == null || !(categoryFacade instanceof AbilityCategory)) {
return 0;
}
AbilityCategory category = (AbilityCategory) categoryFacade;
BigDecimal pool = theCharacter.getAvailableAbilityPool(category);
return pool.intValue();
}
use of pcgen.core.AbilityCategory in project pcgen by PCGen.
the class CharacterAbilities method updateAbilityCategoryTodo.
private void updateAbilityCategoryTodo(Category<Ability> cat) {
if (!(cat instanceof AbilityCategory)) {
return;
}
AbilityCategory category = (AbilityCategory) cat;
int numSelections = theCharacter.getAvailableAbilityPool(category).intValue();
if (category.getVisibility().isVisibleTo(View.HIDDEN_DISPLAY)) {
// Hide todos for categories that should not be displayed
numSelections = 0;
}
if (numSelections < 0) {
todoManager.addTodo(new TodoFacadeImpl(Tab.ABILITIES, category.getDisplayName(), "in_featTodoTooMany", category.getType(), //$NON-NLS-1$
1));
//$NON-NLS-1$
todoManager.removeTodo("in_featTodoRemain", category.getDisplayName());
} else if (numSelections > 0) {
todoManager.addTodo(new TodoFacadeImpl(Tab.ABILITIES, category.getDisplayName(), "in_featTodoRemain", category.getType(), //$NON-NLS-1$
1));
//$NON-NLS-1$
todoManager.removeTodo("in_featTodoTooMany", category.getDisplayName());
} else {
//$NON-NLS-1$
todoManager.removeTodo("in_featTodoRemain", category.getDisplayName());
//$NON-NLS-1$
todoManager.removeTodo("in_featTodoTooMany", category.getDisplayName());
}
}
Aggregations