Search in sources :

Example 16 with AbilityCategory

use of pcgen.core.AbilityCategory in project pcgen by PCGen.

the class KitAbilities method apply.

@Override
public void apply(PlayerCharacter aPC) {
    for (CNAbilitySelection cnas : abilitiesToAdd) {
        aPC.addAbility(cnas, UserSelection.getInstance(), UserSelection.getInstance());
        if (isFree()) {
            AbilityCategory category = catRef.get();
            aPC.adjustAbilities(category, BigDecimal.ONE);
        }
    }
}
Also used : CNAbilitySelection(pcgen.cdom.helper.CNAbilitySelection) AbilityCategory(pcgen.core.AbilityCategory)

Example 17 with AbilityCategory

use of pcgen.core.AbilityCategory 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;
}
Also used : Ability(pcgen.core.Ability) CNAbility(pcgen.cdom.content.CNAbility) CNAbility(pcgen.cdom.content.CNAbility) HashMapToList(pcgen.base.util.HashMapToList) AbilityCategory(pcgen.core.AbilityCategory)

Example 18 with AbilityCategory

use of pcgen.core.AbilityCategory 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;
}
Also used : Ability(pcgen.core.Ability) CNAbility(pcgen.cdom.content.CNAbility) CNAbility(pcgen.cdom.content.CNAbility) HashMapToList(pcgen.base.util.HashMapToList) AbilityCategory(pcgen.core.AbilityCategory)

Example 19 with AbilityCategory

use of pcgen.core.AbilityCategory in project pcgen by PCGen.

the class VAbilityToken method getAbilityList.

/**
	 * @see pcgen.io.exporttoken.AbilityToken#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;
}
Also used : Ability(pcgen.core.Ability) CNAbility(pcgen.cdom.content.CNAbility) CNAbility(pcgen.cdom.content.CNAbility) HashMapToList(pcgen.base.util.HashMapToList) AbilityCategory(pcgen.core.AbilityCategory)

Example 20 with AbilityCategory

use of pcgen.core.AbilityCategory in project pcgen by PCGen.

the class AbilityListTokenTest method setUp.

/*
	 * @see TestCase#setUp()
	 */
@Override
protected void setUp() throws Exception {
    super.setUp();
    // Make some ability categories and add them to the game mode
    AbilityCategory bardCategory = Globals.getContext().getReferenceContext().constructNowIfNecessary(AbilityCategory.class, "BARDIC");
    Ability ab1 = TestHelper.makeAbility("Perform (Dance)", AbilityCategory.FEAT, "General.Fighter");
    ab1.put(ObjectKey.MULTIPLE_ALLOWED, Boolean.FALSE);
    ab1.put(ObjectKey.VISIBILITY, Visibility.DEFAULT);
    addAbility(AbilityCategory.FEAT, ab1);
    Ability ab2 = TestHelper.makeAbility("Perform (Dance)", "BARDIC", "General.Bardic");
    ab2.put(ObjectKey.MULTIPLE_ALLOWED, Boolean.FALSE);
    addAbility(bardCategory, ab2);
    Ability ab3 = TestHelper.makeAbility("Perform (Oratory)", AbilityCategory.FEAT, "General.Fighter");
    ab3.put(ObjectKey.MULTIPLE_ALLOWED, Boolean.FALSE);
    addAbility(AbilityCategory.FEAT, ab3);
    Ability ab4 = TestHelper.makeAbility("Silent Step", AbilityCategory.FEAT, "General");
    ab4.put(ObjectKey.MULTIPLE_ALLOWED, Boolean.FALSE);
    addAbility(AbilityCategory.FEAT, ab4);
}
Also used : Ability(pcgen.core.Ability) AbilityCategory(pcgen.core.AbilityCategory)

Aggregations

AbilityCategory (pcgen.core.AbilityCategory)72 Ability (pcgen.core.Ability)60 CNAbility (pcgen.cdom.content.CNAbility)34 HashMapToList (pcgen.base.util.HashMapToList)14 ArrayList (java.util.ArrayList)10 PlayerCharacter (pcgen.core.PlayerCharacter)10 StringTokenizer (java.util.StringTokenizer)9 Test (org.junit.Test)9 CNAbilitySelection (pcgen.cdom.helper.CNAbilitySelection)7 Nature (pcgen.cdom.enumeration.Nature)6 BigDecimal (java.math.BigDecimal)5 AssociatedPrereqObject (pcgen.cdom.base.AssociatedPrereqObject)4 CDOMObject (pcgen.cdom.base.CDOMObject)4 CDOMReference (pcgen.cdom.base.CDOMReference)4 CDOMSingleRef (pcgen.cdom.reference.CDOMSingleRef)4 PCTemplate (pcgen.core.PCTemplate)3 SpecialAbility (pcgen.core.SpecialAbility)3 BonusObj (pcgen.core.bonus.BonusObj)3 ParseResult (pcgen.rules.persistence.token.ParseResult)3 HashSet (java.util.HashSet)2