Search in sources :

Example 16 with InfoFacade

use of pcgen.facade.core.InfoFacade in project pcgen by PCGen.

the class RandomChooser method makeChoice.

@Override
public boolean makeChoice(ChooserFacade chooserFacade) {
    while (chooserFacade.getRemainingSelections().get() > 0 && !chooserFacade.getAvailableList().isEmpty()) {
        ListFacade<InfoFacade> availableList = chooserFacade.getAvailableList();
        final InfoFacade addObj = availableList.getElementAt(RandomUtil.getRandomInt(availableList.getSize() - 1));
        chooserFacade.addSelected(addObj);
    }
    if (chooserFacade.getRemainingSelections().get() == 0 || !chooserFacade.isRequireCompleteSelection()) {
        chooserFacade.commit();
        return true;
    }
    chooserFacade.rollback();
    return false;
}
Also used : InfoFacade(pcgen.facade.core.InfoFacade)

Aggregations

InfoFacade (pcgen.facade.core.InfoFacade)16 ArrayList (java.util.ArrayList)7 Spell (pcgen.core.spell.Spell)4 Ability (pcgen.core.Ability)3 Domain (pcgen.core.Domain)3 Equipment (pcgen.core.Equipment)3 PCClass (pcgen.core.PCClass)3 CNAbility (pcgen.cdom.content.CNAbility)2 AvailableSpell (pcgen.cdom.helper.AvailableSpell)2 PObject (pcgen.core.PObject)2 AbilityFacade (pcgen.facade.core.AbilityFacade)2 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 ButtonGroup (javax.swing.ButtonGroup)1 JPanel (javax.swing.JPanel)1 JRadioButton (javax.swing.JRadioButton)1 TitledBorder (javax.swing.border.TitledBorder)1 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)1 EquipmentModifier (pcgen.core.EquipmentModifier)1 PlayerCharacter (pcgen.core.PlayerCharacter)1