use of pcgen.core.Skill in project pcgen by PCGen.
the class MonCSkillToSkillCostFacet method dataAdded.
@Override
public void dataAdded(DataFacetChangeEvent<CharID, PCClass> dfce) {
PCClass cl = dfce.getCDOMObject();
if (cl.isMonster()) {
CharID id = dfce.getCharID();
SkillCost cost = SkillCost.CLASS;
for (Skill sk : monsterCSkillFacet.getSet(id)) {
add(id, cl, cost, sk, monsterCSkillFacet);
}
}
}
use of pcgen.core.Skill in project pcgen by PCGen.
the class ChooserUtilities method getConfiguredController.
public static <T> ChoiceManagerList<T> getConfiguredController(final ChooseDriver aPObject, final PlayerCharacter aPC, final AbilityCategory category, List<String> reservedList) {
ChoiceManagerList aMan = getChoiceManager(aPObject, aPC);
if (aMan == null) {
return null;
}
if (aPObject instanceof CNAbility) {
CNAbility driver = (CNAbility) aPObject;
Ability a = driver.getAbility();
AbilityCategory cat;
if (category == null) {
cat = SettingsHandler.getGame().getAbilityCategory(a.getCategory());
} else {
cat = category;
}
aMan.setController(new AbilityChooseController(a, cat, aPC, aMan));
List<CNAbility> abilities = aPC.getMatchingCNAbilities(a);
for (CNAbility cna : abilities) {
reservedList.addAll(aPC.getAssociationList(cna));
}
} else if (aPObject instanceof Skill) {
Skill s = (Skill) aPObject;
aMan.setController(new SkillChooseController(s, aPC));
}
return aMan;
}
use of pcgen.core.Skill in project pcgen by PCGen.
the class SkillChoice method getSkill.
/**
* Gets the skill associated with this chioce. If this choice is a group
* of choices, the specific skill will be selected randomly.
*
* @return A <tt>Skill</tt>
*/
public Skill getSkill() {
final Skill skill = theSkillList.getRandomValue();
theSkillList.add(skill, NPCGenerator.getSubSkillWeightAdd());
return skill;
}
use of pcgen.core.Skill in project pcgen by PCGen.
the class PCCountSkillsTermEvaluator method resolve.
@Override
public Float resolve(PlayerCharacter pc) {
int count = 0;
//TODO This is a bug, it assumes export
final List<Skill> skills = pc.getDisplay().getPartialSkillList(View.VISIBLE_EXPORT);
SkillFilter filter = SkillFilter.getByToken(filterToken);
if (filter == null || filter == SkillFilter.Selected) {
filter = pc.getSkillFilter();
}
for (Skill sk : skills) {
if (pc.includeSkill(sk, filter) && sk.qualifies(pc, null)) {
count++;
}
}
return (float) count;
}
use of pcgen.core.Skill in project pcgen by PCGen.
the class KitSkill method testApply.
@Override
public boolean testApply(Kit aKit, PlayerCharacter aPC, List<String> warnings) {
skillsToAdd = new ArrayList<>();
List<Skill> skillChoices = getSkillChoices(aPC);
if (skillChoices == null || skillChoices.isEmpty()) {
// They didn't make a choice so don't add any ranks.
return false;
}
for (Skill skill : skillChoices) {
BigDecimal ranksLeftToAdd = getRank();
if (ranksLeftToAdd == null) {
ranksLeftToAdd = BigDecimal.ONE;
}
double ranksLeft = ranksLeftToAdd.doubleValue();
List<PCClass> classList = new ArrayList<>();
if (className != null) {
String classKey = className.get().getKeyName();
// Make sure if they specified a class to add from we try that
// class first.
PCClass pcClass = aPC.getClassKeyed(classKey);
if (pcClass != null) {
classList.add(pcClass);
} else {
warnings.add("SKILL: Could not find specified class " + classKey + " in PC to add ranks from.");
}
}
for (PCClass pcClass : aPC.getClassSet()) {
if (!classList.contains(pcClass)) {
classList.add(pcClass);
}
}
// Try and find a class we can add them from.
boolean oldImporting = aPC.isImporting();
aPC.setImporting(true);
for (PCClass pcClass : classList) {
final KitSkillAdd sta = addRanks(aPC, pcClass, skill, ranksLeft, isFree(), warnings);
if (sta != null) {
skillsToAdd.add(sta);
ranksLeft -= sta.getRanks();
if (ranksLeft <= 0.0) {
break;
}
}
}
aPC.setImporting(oldImporting);
if (ranksLeft > 0.0) {
warnings.add("SKILL: Could not add " + ranksLeft + " ranks to " + skill.getKeyName() + ". Not enough points.");
}
}
return true;
}
Aggregations