use of pcgen.core.Ability in project pcgen by PCGen.
the class Aspect method printAspect.
public static String printAspect(PlayerCharacter pc, AspectName key, List<CNAbility> abilities, boolean printName) {
if (abilities.isEmpty()) {
return "";
}
Ability sampleAbilityObject = abilities.get(0).getAbility();
StringBuilder buff = new StringBuilder(50);
List<Aspect> aspects = sampleAbilityObject.get(MapKey.ASPECT, key);
Aspect aspect = lastPassingAspect(aspects, pc, sampleAbilityObject);
if (aspect != null) {
if (printName) {
buff.append(aspect.getName()).append(": ");
}
buff.append(aspect.getAspectText(pc, abilities));
}
return buff.toString();
}
use of pcgen.core.Ability in project pcgen by PCGen.
the class CNAbilitySelectionUtilities method canCoExist.
public static boolean canCoExist(CNAbilitySelection cnas1, CNAbilitySelection cnas2) {
CNAbility cna = cnas1.getCNAbility();
Ability a = cna.getAbility();
CNAbility ocna = cnas2.getCNAbility();
if (!ocna.getAbilityCategory().getParentCategory().equals(cna.getAbilityCategory().getParentCategory())) {
//This test is only required because Ability only checks key :/
return true;
}
if (!ocna.getAbility().equals(a)) {
//Different abilities, so doesn't matter...
return true;
}
//Same ability here
if (!a.getSafe(ObjectKey.MULTIPLE_ALLOWED)) {
//If MULT:NO, then can't coexist...
return false;
}
//MULT:YES here
if (a.getSafe(ObjectKey.STACKS)) {
//Allows stacking, so always true (give or take NUMCHOICES?)
return true;
}
//STACK:NO here
if (cnas1.getSelection().equals(cnas2.getSelection())) {
//enforce STACK:NO
return false;
}
return true;
}
use of pcgen.core.Ability in project pcgen by PCGen.
the class AbilityTargetSelector method applyChoice.
@Override
public void applyChoice(ChooseDriver obj, T choice, PlayerCharacter pc) {
Ability ab = ability.get();
ChooseInformation ci = ab.get(ObjectKey.CHOOSE_INFO);
detailedApply(obj, ci, choice, pc);
}
use of pcgen.core.Ability 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.core.Ability 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;
}
Aggregations