Search in sources :

Example 11 with Ability

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");
}
Also used : Ability(pcgen.core.Ability) CNAbility(pcgen.cdom.content.CNAbility)

Example 12 with Ability

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"));
}
Also used : Ability(pcgen.core.Ability) CNAbility(pcgen.cdom.content.CNAbility)

Example 13 with Ability

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;
}
Also used : Ability(pcgen.core.Ability) CNAbility(pcgen.cdom.content.CNAbility) ParseResult(pcgen.rules.persistence.token.ParseResult)

Example 14 with Ability

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;
}
Also used : Ability(pcgen.core.Ability) CNAbility(pcgen.cdom.content.CNAbility) ParseResult(pcgen.rules.persistence.token.ParseResult)

Example 15 with Ability

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;
}
Also used : Ability(pcgen.core.Ability) CNAbility(pcgen.cdom.content.CNAbility) InfoFacade(pcgen.facade.core.InfoFacade) ArrayList(java.util.ArrayList)

Aggregations

Ability (pcgen.core.Ability)279 CNAbility (pcgen.cdom.content.CNAbility)128 AbilityCategory (pcgen.core.AbilityCategory)60 PlayerCharacter (pcgen.core.PlayerCharacter)54 Test (org.junit.Test)46 ArrayList (java.util.ArrayList)43 CNAbilitySelection (pcgen.cdom.helper.CNAbilitySelection)25 ParseResult (pcgen.rules.persistence.token.ParseResult)21 HashMapToList (pcgen.base.util.HashMapToList)15 PCClass (pcgen.core.PCClass)15 Spell (pcgen.core.spell.Spell)15 StringTokenizer (java.util.StringTokenizer)14 TestContext (plugin.lsttokens.editcontext.testsupport.TestContext)13 LoadContext (pcgen.rules.context.LoadContext)12 SpecialAbility (pcgen.core.SpecialAbility)11 CharacterSpell (pcgen.core.character.CharacterSpell)11 PreParserFactory (pcgen.persistence.lst.prereq.PreParserFactory)11 List (java.util.List)10 CDOMObject (pcgen.cdom.base.CDOMObject)10 CDOMSingleRef (pcgen.cdom.reference.CDOMSingleRef)10