use of pcgen.facade.core.AbilityFacade in project pcgen by PCGen.
the class CharacterAbilitiesTest method testRebuildAbilityListsNoMult.
/**
* Test method for {@link pcgen.gui2.facade.CharacterAbilities#rebuildAbilityLists()}.
*/
@Test
public final void testRebuildAbilityListsNoMult() {
PlayerCharacter pc = getCharacter();
CharacterAbilities ca = new CharacterAbilities(pc, uiDelegate, dataset, todoManager);
ca.rebuildAbilityLists();
ListFacade<AbilityCategoryFacade> categories = ca.getActiveAbilityCategories();
assertNotNull("Categories should not be null", categories);
assertTrue("Feat should be active", categories.containsElement(AbilityCategory.FEAT));
ListFacade<AbilityFacade> abilities = ca.getAbilities(AbilityCategory.FEAT);
assertNotNull("Feat list should not be null", abilities);
assertTrue("Feat list should be empty", abilities.isEmpty());
// Add an entry - note rebuild is implicit
Ability fencing = TestHelper.makeAbility("fencing", AbilityCategory.FEAT, "sport");
addAbility(AbilityCategory.FEAT, fencing);
abilities = ca.getAbilities(AbilityCategory.FEAT);
assertEquals("Feat list should have one entry", 1, abilities.getSize());
Ability abilityFromList = (Ability) abilities.getElementAt(0);
assertEquals("Should have found fencing", fencing, abilityFromList);
}
use of pcgen.facade.core.AbilityFacade in project pcgen by PCGen.
the class DataSet method getPrereqAbilities.
/* (non-Javadoc)
* @see pcgen.core.facade.DataSetFacade#getPrereqAbilities(pcgen.core.facade.AbilityFacade)
*/
@Override
public List<AbilityFacade> getPrereqAbilities(AbilityFacade abilityFacade) {
if (abilityFacade == null || !(abilityFacade instanceof Ability)) {
return Collections.emptyList();
}
Ability ability = (Ability) abilityFacade;
List<AbilityFacade> prereqList = new ArrayList<>();
for (Prerequisite prereq : ability.getPrerequisiteList()) {
prereqList.addAll(getAbilitiesFromPrereq(prereq, ability.getCDOMCategory()));
}
return prereqList;
}
use of pcgen.facade.core.AbilityFacade in project pcgen by PCGen.
the class EquipmentBuilderFacadeImpl method getSpellChoiceForEqMod.
private boolean getSpellChoiceForEqMod(EquipmentModifier eqMod) {
String choiceValue = eqMod.getSafe(StringKey.CHOICE_STRING).substring(15);
SpellBuilderFacadeImpl spellBuilderFI = new SpellBuilderFacadeImpl(choiceValue, character, equip);
if (!delegate.showCustomSpellDialog(spellBuilderFI)) {
return false;
}
InfoFacade castingClass = spellBuilderFI.getClassRef().get();
Spell theSpell = (Spell) spellBuilderFI.getSpellRef().get();
String variant = spellBuilderFI.getVariantRef().get();
if (variant == null) {
variant = "";
}
String spellType = spellBuilderFI.getSpellTypeRef().get();
int baseSpellLevel = spellBuilderFI.getSpellLevelRef().get();
int casterLevel = spellBuilderFI.getCasterLevelRef().get();
ListFacade<AbilityFacade> metamagicFeatsList = spellBuilderFI.getSelectedMetamagicFeats();
Object[] metamagicFeats = new Object[metamagicFeatsList.getSize()];
for (int i = 0; i < metamagicFeats.length; i++) {
metamagicFeats[i] = metamagicFeatsList.getElementAt(i);
}
int charges = getNumCharges(eqMod);
EquipmentModifier existingEqMod = equip.getEqModifierKeyed(eqMod.getKeyName(), true);
if (existingEqMod == null) {
equip.addEqModifier(eqMod, true, character);
}
existingEqMod = equip.getEqModifierKeyed(eqMod.getKeyName(), true);
EqModSpellInfo.setSpellInfo(equip, existingEqMod, (PObject) castingClass, theSpell, variant, spellType, baseSpellLevel, casterLevel, metamagicFeats, charges);
return true;
}
Aggregations