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);
}
Aggregations