use of pcgen.core.Ability in project pcgen by PCGen.
the class AbstractAbilityGrantCheckTest method generic.
public void generic() {
//Need to do these with 2 choices and test :P
// 6) Ability granted by a ADD:VFEAT token where the target (in parens) is MULT:YES STACK:YES CHOOSE:NOCHOICE and the stackable items are chosen more than once (STACK is used)
// 7) Ability granted by a ADD:VFEAT token where the target (in parens) is MULT:YES STACK:YES and any CHOOSE except NOCHOICE or USERINPUT. and the stackable items are chosen more than once (STACK is used)
Ability multyesstackyes = getMultYesStackYes("MultYes", "Target");
Ability multyesstackyesNC = getMultYesStackYesChooseNoChoice("MultYes");
}
use of pcgen.core.Ability in project pcgen by PCGen.
the class AbstractAbilityGrantCheckTest method testStackYesNC.
public void testStackYesNC() {
getMultYesStackNoChooseNoChoice("MultYesStackYesNC");
Ability parent = getGrantor("MultYesStackYesNC");
finishLoad();
applyParent(parent);
assertTrue(pc.hasAbilityKeyed(AbilityCategory.FEAT, "Parent"));
assertTrue(pc.hasAbilityKeyed(AbilityCategory.FEAT, "Grantor"));
assertTrue(pc.hasAbilityKeyed(AbilityCategory.FEAT, "MultYesStackYesNC"));
}
use of pcgen.core.Ability in project pcgen by PCGen.
the class AbstractAbilityGrantCheckTest method getMultNo.
public Ability getMultNo(String s) {
Ability a = create(Ability.class, s);
context.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, a);
ParseResult result = TYPE_TOKEN.parseToken(context, a, "Selectable");
if (result != ParseResult.SUCCESS) {
result.printMessages();
fail("Test Setup Failed");
}
return a;
}
use of pcgen.core.Ability in project pcgen by PCGen.
the class AbstractAbilityGrantCheckTest method getMultYesStackYes.
public Ability getMultYesStackYes(String s, String target) {
Ability a = create(Ability.class, s);
context.getReferenceContext().reassociateCategory(AbilityCategory.FEAT, a);
ParseResult result = AUTO_FEAT_TOKEN.parseToken(context, a, "FEAT|%LIST");
if (result != ParseResult.SUCCESS) {
result.printMessages();
fail("Test Setup Failed");
}
result = ABILITY_MULT_TOKEN.parseToken(context, a, "YES");
if (result != ParseResult.SUCCESS) {
result.printMessages();
fail("Test Setup Failed");
}
result = ABILITY_STACK_TOKEN.parseToken(context, a, "YES");
if (result != ParseResult.SUCCESS) {
result.printMessages();
fail("Test Setup Failed");
}
result = CHOOSE_FEATSELECTION_TOKEN.parseToken(context, a, target);
if (result != ParseResult.SUCCESS) {
result.printMessages();
fail("Test Setup Failed");
}
return a;
}
use of pcgen.core.Ability in project pcgen by PCGen.
the class SpellSupportFacadeImpl method queryUserForMetamagic.
/**
* Request the metamagic feats to be applied to a spell from the user via
* a chooser.
*
* @param spellNode The spell to have metamagic applied
* @return The list of metamagic feats to be applied.
*/
private List<Ability> queryUserForMetamagic(SpellNode spellNode) {
// get the list of metamagic feats for the PC
List<InfoFacade> availableList = buildAvailableMetamagicFeatList(spellNode);
if (availableList.isEmpty()) {
return Collections.emptyList();
}
String label = dataSet.getGameMode().getAddWithMetamagicMessage();
if (StringUtils.isEmpty(label)) {
label = LanguageBundle.getString("InfoSpells.add.with.metamagic");
}
final ArrayList<Ability> selectedList = new ArrayList<>();
GeneralChooserFacadeBase chooserFacade = new GeneralChooserFacadeBase(label, availableList, new ArrayList<>(), 99, infoFactory) {
@Override
public void commit() {
for (InfoFacade item : getSelectedList()) {
selectedList.add((Ability) item);
}
}
};
chooserFacade.setDefaultView(ChooserTreeViewType.NAME);
boolean result = delegate.showGeneralChooser(chooserFacade);
return result ? selectedList : null;
}
Aggregations