Search in sources :

Example 6 with Combatant

use of gmgen.plugin.Combatant in project pcgen by PCGen.

the class Initiative method raiseCombatant.

/**  Raises the selected combatants from the dead */
private void raiseCombatant() {
    final List selectedList = getSelected();
    while (!selectedList.isEmpty()) {
        InitHolder iH = (InitHolder) selectedList.remove(0);
        if (iH instanceof Combatant) {
            Combatant cbt = (Combatant) iH;
            writeToCombatTabWithRound(iH.getName() + " (" + cbt.getPlayer() + ") Raised");
            cbt.raise();
            combatantUpdated(cbt);
        }
    }
    initList.sort();
    refreshTable();
}
Also used : Combatant(gmgen.plugin.Combatant) PcgCombatant(gmgen.plugin.PcgCombatant) XMLCombatant(plugin.initiative.XMLCombatant) List(java.util.List) InitHolderList(gmgen.plugin.InitHolderList) ArrayList(java.util.ArrayList) InitHolder(gmgen.plugin.InitHolder)

Example 7 with Combatant

use of gmgen.plugin.Combatant in project pcgen by PCGen.

the class Initiative method addInitHolder.

/**
	 * Add an initiative holder (a combatant)
	 * @param iH
	 */
public void addInitHolder(InitHolder iH) {
    if (iH instanceof Combatant) {
        Combatant cbt = (Combatant) iH;
        if (!initList.isUniqueName(cbt.getName())) {
            cbt.setName(initList.getUniqueName(cbt.getName()));
        }
        addTab(cbt);
    }
    initList.add(iH);
}
Also used : Combatant(gmgen.plugin.Combatant) PcgCombatant(gmgen.plugin.PcgCombatant) XMLCombatant(plugin.initiative.XMLCombatant)

Example 8 with Combatant

use of gmgen.plugin.Combatant in project pcgen by PCGen.

the class Initiative method rollSave.

//** End Functions implementing button calls for top toolbar **
//** Functions implementing button calls for the bottom toolbar **
/**
	 * Save the initiative roll
	 */
private void rollSave() {
    final List<InitHolder> selectedList = getSelected();
    //int dc = 0;
    //int type = SavingThrowDialog.NULL_SAVE;
    SaveModel model = new SaveModel();
    while (!selectedList.isEmpty()) {
        InitHolder iH = selectedList.remove(0);
        if (iH instanceof Combatant) {
            model = performSave(model, iH);
        }
    }
    refreshTable();
}
Also used : SaveModel(plugin.initiative.SaveModel) Combatant(gmgen.plugin.Combatant) PcgCombatant(gmgen.plugin.PcgCombatant) XMLCombatant(plugin.initiative.XMLCombatant) InitHolder(gmgen.plugin.InitHolder)

Example 9 with Combatant

use of gmgen.plugin.Combatant in project pcgen by PCGen.

the class Initiative method refocusCombatant.

/**  Refocuses the selected combatants */
private void refocusCombatant() {
    final List selectedList = getSelected();
    while (!selectedList.isEmpty()) {
        InitHolder iH = (InitHolder) selectedList.remove(0);
        if (iH instanceof Combatant) {
            Combatant cbt = (Combatant) iH;
            cbt.init.refocus();
            combatantUpdated(cbt);
            writeToCombatTabWithRound(cbt.getName() + " (" + cbt.getPlayer() + ") Refocused");
        }
    }
    initList.sort();
    refreshTable();
}
Also used : Combatant(gmgen.plugin.Combatant) PcgCombatant(gmgen.plugin.PcgCombatant) XMLCombatant(plugin.initiative.XMLCombatant) List(java.util.List) InitHolderList(gmgen.plugin.InitHolderList) ArrayList(java.util.ArrayList) InitHolder(gmgen.plugin.InitHolder)

Example 10 with Combatant

use of gmgen.plugin.Combatant in project pcgen by PCGen.

the class Initiative method nextInit.

/**  Moves to the next active initiative */
private void nextInit() {
    int oldInit = currentInit;
    setCurrentInit(currentInit - 1);
    int bleedingTime = SettingsHandler.getGMGenOption(InitiativePlugin.LOG_NAME + ".Damage.Dying", PreferencesDamagePanel.DAMAGE_DYING_END);
    for (int i = 0; i < initList.size(); i++) {
        InitHolder iH = initList.get(i);
        if (iH instanceof Event) {
            Event e = (Event) iH;
            int eInit = e.getInitiative().getCurrentInitiative();
            if (oldInit == eInit) {
                int duration = e.decDuration();
                if (duration < 0) {
                    writeToCombatTabWithRound(e.getPlayer() + "'s " + e.getName() + " ended");
                    if (e.isAlert()) {
                        JOptionPane.showMessageDialog(this, e.getEndText());
                    }
                    initList.remove(i);
                }
            }
        } else if (iH instanceof Combatant) {
            Combatant cbt = (Combatant) iH;
            int cInit = cbt.getInitiative().getCurrentInitiative();
            if (oldInit == cInit) {
                cbt.decDuration();
                if (bleedingTime == PreferencesDamagePanel.DAMAGE_DYING_INITIATIVE) {
                    bleed((Combatant) iH);
                }
            }
        }
    }
    if (currentInit <= 0) {
        int maxInit = initList.getMaxInit();
        setCurrentInit(maxInit);
        for (InitHolder anInitList : initList) {
            if (bleedingTime == PreferencesDamagePanel.DAMAGE_DYING_END) {
                if (anInitList instanceof Combatant) {
                    bleed((Combatant) anInitList);
                }
            }
            anInitList.endRound();
        }
        round++;
        writeToCombatTab("Round " + round);
        setCurrentInit(maxInit);
    } else if (!initList.initValid(currentInit)) {
        nextInit();
    }
    refreshTable();
}
Also used : HyperlinkEvent(javax.swing.event.HyperlinkEvent) ListSelectionEvent(javax.swing.event.ListSelectionEvent) ActionEvent(java.awt.event.ActionEvent) Event(gmgen.plugin.Event) Combatant(gmgen.plugin.Combatant) PcgCombatant(gmgen.plugin.PcgCombatant) XMLCombatant(plugin.initiative.XMLCombatant) InitHolder(gmgen.plugin.InitHolder)

Aggregations

Combatant (gmgen.plugin.Combatant)24 PcgCombatant (gmgen.plugin.PcgCombatant)18 XMLCombatant (plugin.initiative.XMLCombatant)18 InitHolder (gmgen.plugin.InitHolder)13 InitHolderList (gmgen.plugin.InitHolderList)4 ArrayList (java.util.ArrayList)4 List (java.util.List)4 HyperlinkEvent (javax.swing.event.HyperlinkEvent)4 Event (gmgen.plugin.Event)3 InfoCharacterDetails (gmgen.plugin.InfoCharacterDetails)3 State (gmgen.plugin.State)3 ActionEvent (java.awt.event.ActionEvent)3 HyperlinkListener (javax.swing.event.HyperlinkListener)3 GMGenSystem (gmgen.GMGenSystem)2 FlippingSplitPane (gmgen.gui.FlippingSplitPane)2 Spell (gmgen.plugin.Spell)2 SystemHP (gmgen.plugin.SystemHP)2 SystemInitiative (gmgen.plugin.SystemInitiative)2 Dice (gmgen.plugin.dice.Dice)2 CombatantHasBeenUpdatedMessage (gmgen.pluginmgr.messages.CombatantHasBeenUpdatedMessage)2