Search in sources :

Example 1 with TransmitInitiativeValuesBetweenComponentsMessage

use of pcgen.pluginmgr.messages.TransmitInitiativeValuesBetweenComponentsMessage in project pcgen by PCGen.

the class EncounterPlugin method handleTransferToTracker.

/**
	 * Handles the <b>Begin Combat</b> button.
	 */
public void handleTransferToTracker() {
    int i;
    PlayerCharacter aPC;
    JFrame oldRoot = Globals.getRootFrame();
    Globals.setRootFrame(GMGenSystem.inst);
    theModel.setPCs(theModel.size());
    try {
        for (i = 0; i < theModel.size(); i++) {
            aPC = theModel.getPCs()[i];
            aPC.setImporting(false);
            if (!handleRace(aPC, i)) {
                continue;
            }
            LevelCommandFactory lcf = aPC.getDisplay().getRace().get(ObjectKey.MONSTER_CLASS);
            if (lcf != null) {
                handleMonster(aPC, lcf);
            } else {
                handleNonMonster(aPC);
            }
            handleEquipment(aPC);
            aPC.setPCAttribute(PCAttribute.PLAYERSNAME, "Enemy");
            theList.add(new PcgCombatant(aPC, "Enemy", messageHandler));
        }
        JOptionPane.showMessageDialog(null, "You will now be returned to PCGen so that you can finalise your selected combatants.\nOnce they are finalised, return to the GMGen Initiative tab to begin the combat!", "Combatant Setup Complete", JOptionPane.INFORMATION_MESSAGE);
        messageHandler.handleMessage(new TransmitInitiativeValuesBetweenComponentsMessage(this, theList));
        removeAll();
    } catch (Throwable e) {
        e.printStackTrace();
    }
    Globals.setRootFrame(oldRoot);
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) LevelCommandFactory(pcgen.cdom.content.LevelCommandFactory) PcgCombatant(gmgen.plugin.PcgCombatant) JFrame(javax.swing.JFrame) TransmitInitiativeValuesBetweenComponentsMessage(pcgen.pluginmgr.messages.TransmitInitiativeValuesBetweenComponentsMessage)

Aggregations

PcgCombatant (gmgen.plugin.PcgCombatant)1 JFrame (javax.swing.JFrame)1 LevelCommandFactory (pcgen.cdom.content.LevelCommandFactory)1 PlayerCharacter (pcgen.core.PlayerCharacter)1 TransmitInitiativeValuesBetweenComponentsMessage (pcgen.pluginmgr.messages.TransmitInitiativeValuesBetweenComponentsMessage)1