Search in sources :

Example 11 with Combatant

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

the class ExperienceAdjusterPlugin method handleAdjustCRButton.

/**
	 * Handle adjust CR button
	 */
private void handleAdjustCRButton() {
    if (eaView.getCharacterList().getSelectedIndex() != -1) {
        final Collection list = eaView.getCharacterList().getSelectedValuesList();
        for (final Object aList : list) {
            final ExperienceListItem item = (ExperienceListItem) aList;
            Combatant cbt = item.getCombatant();
            adjustCR(cbt);
        }
    }
    if (eaView.getEnemyList().getSelectedIndex() != -1) {
        final Collection list = eaView.getEnemyList().getSelectedValuesList();
        for (final Object aList : list) {
            ExperienceListItem item = (ExperienceListItem) aList;
            Combatant cbt = item.getCombatant();
            adjustCR(cbt);
        }
    }
    update();
}
Also used : Collection(java.util.Collection) Combatant(gmgen.plugin.Combatant) AddDefeatedCombatant(plugin.experience.gui.AddDefeatedCombatant)

Example 12 with Combatant

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

the class Initiative method combatantDied.

/**
	 * Set the current initiative holder to dead
	 * @param deadIH
	 */
private void combatantDied(InitHolder deadIH) {
    writeToCombatTabWithRound(deadIH.getName() + " (" + deadIH.getPlayer() + ") Killed");
    for (InitHolder anInitList : initList) {
        String cbtType = "";
        if (anInitList instanceof Combatant) {
            Combatant cbt = (Combatant) anInitList;
            cbtType = cbt.getCombatantType();
        }
        if (cbtType.equals("Enemy") && (anInitList.getStatus() != State.Dead)) {
            return;
        }
    }
    writeToCombatTabWithRound("Combat finished, all enemies killed");
    checkDeadTabs();
}
Also used : Combatant(gmgen.plugin.Combatant) PcgCombatant(gmgen.plugin.PcgCombatant) XMLCombatant(plugin.initiative.XMLCombatant) InitHolder(gmgen.plugin.InitHolder)

Example 13 with Combatant

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

the class Initiative method checkDeadTabs.

/**
	 * Check for dead combatants
	 */
private void checkDeadTabs() {
    initList.stream().filter(anInitList -> anInitList.getStatus() == State.Dead).forEach(anInitList -> {
        if (showDead.isSelected() && (anInitList instanceof Combatant) && (tpaneInfo.indexOfTab(anInitList.getName()) == -1)) {
            Combatant cbt = (Combatant) anInitList;
            addTab(cbt);
        } else {
            removeTab(anInitList);
        }
    });
}
Also used : PluginManager(pcgen.pluginmgr.PluginManager) Globals(pcgen.core.Globals) Combatant(gmgen.plugin.Combatant) InfoCharacterDetails(gmgen.plugin.InfoCharacterDetails) HyperlinkEvent(javax.swing.event.HyperlinkEvent) JDialog(javax.swing.JDialog) DiceRollModel(plugin.initiative.DiceRollModel) JTableHeader(javax.swing.table.JTableHeader) TableCellRenderer(javax.swing.table.TableCellRenderer) NumberFormatter(javax.swing.text.NumberFormatter) PcgCombatant(gmgen.plugin.PcgCombatant) Document(org.jdom2.Document) Dice(gmgen.plugin.dice.Dice) Vector(java.util.Vector) SettingsHandler(pcgen.core.SettingsHandler) LogUtilities(gmgen.util.LogUtilities) JFileChooser(javax.swing.JFileChooser) DefaultFormatter(javax.swing.text.DefaultFormatter) JComboBox(javax.swing.JComboBox) ListSelectionEvent(javax.swing.event.ListSelectionEvent) FlippingSplitPane(gmgen.gui.FlippingSplitPane) InitHolder(gmgen.plugin.InitHolder) DefaultTableModel(javax.swing.table.DefaultTableModel) Format(org.jdom2.output.Format) Logging(pcgen.util.Logging) Spell(gmgen.plugin.Spell) PCStat(pcgen.core.PCStat) SpellModel(plugin.initiative.SpellModel) GMGenSystem(gmgen.GMGenSystem) Component(java.awt.Component) Collectors(java.util.stream.Collectors) SystemInitiative(gmgen.plugin.SystemInitiative) List(java.util.List) InitHolderList(gmgen.plugin.InitHolderList) CheckModel(plugin.initiative.CheckModel) JSeparator(javax.swing.JSeparator) Writer(java.io.Writer) JCheckBox(javax.swing.JCheckBox) JTable(javax.swing.JTable) XMLCombatant(plugin.initiative.XMLCombatant) Element(org.jdom2.Element) State(gmgen.plugin.State) PlayerCharacter(pcgen.core.PlayerCharacter) PObjectModel(plugin.initiative.PObjectModel) TableColumnModel(javax.swing.table.TableColumnModel) FileNameExtensionFilter(javax.swing.filechooser.FileNameExtensionFilter) InitiativePlugin(plugin.initiative.InitiativePlugin) ArrayList(java.util.ArrayList) AttackModel(plugin.initiative.AttackModel) PCGenMessageHandler(pcgen.pluginmgr.PCGenMessageHandler) SystemHP(gmgen.plugin.SystemHP) LanguageBundle(pcgen.system.LanguageBundle) PCGenSettings(pcgen.system.PCGenSettings) HyperlinkListener(javax.swing.event.HyperlinkListener) SAXBuilder(org.jdom2.input.SAXBuilder) JButton(javax.swing.JButton) JFormattedTextField(javax.swing.JFormattedTextField) TableColumn(javax.swing.table.TableColumn) FileWriter(java.io.FileWriter) IOException(java.io.IOException) JOptionPane(javax.swing.JOptionPane) FileFilter(javax.swing.filechooser.FileFilter) ActionEvent(java.awt.event.ActionEvent) File(java.io.File) DefaultCellEditor(javax.swing.DefaultCellEditor) XMLOutputter(org.jdom2.output.XMLOutputter) CombatantHasBeenUpdatedMessage(gmgen.pluginmgr.messages.CombatantHasBeenUpdatedMessage) Event(gmgen.plugin.Event) SaveModel(plugin.initiative.SaveModel) Combatant(gmgen.plugin.Combatant) PcgCombatant(gmgen.plugin.PcgCombatant) XMLCombatant(plugin.initiative.XMLCombatant)

Example 14 with Combatant

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

the class Initiative method doSubdual.

/**
	 * <p>Applies subdual damage to combatant.  This allows other methods to damage
	 * combatants who are not necessarily selected at the time.</p>
	 *
	 * @param damage
	 *             Points of damage to do.
	 * @param iH
	 *             InitHolder to damage.
	 */
private void doSubdual(int damage, InitHolder iH) {
    if (iH instanceof Combatant) {
        Combatant cbt = (Combatant) iH;
        cbt.subdualDamage(damage);
        combatantUpdated(cbt);
        writeToCombatTabWithRound(cbt.getName() + " (" + cbt.getPlayer() + ") Took " + damage + " Subdual Damage: " + cbt.getHP().getCurrent() + '(' + cbt.getHP().getSubdual() + "s)/" + cbt.getHP().getMax());
    }
}
Also used : Combatant(gmgen.plugin.Combatant) PcgCombatant(gmgen.plugin.PcgCombatant) XMLCombatant(plugin.initiative.XMLCombatant)

Example 15 with Combatant

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

the class Initiative method killCombatant.

/**  Kills the selected combatants */
private void killCombatant() {
    final List<InitHolder> selectedList = getSelected();
    while (!selectedList.isEmpty()) {
        InitHolder iH = selectedList.remove(0);
        if (iH instanceof Combatant) {
            Combatant cbt = (Combatant) iH;
            cbt.kill();
            combatantDied(cbt);
            combatantUpdated(cbt);
        }
    }
    initList.sort();
    refreshTable();
}
Also used : 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