Search in sources :

Example 21 with Combatant

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

the class ExperienceAdjusterModel method updatePartyExperience.

/**
	 * Updates the value displayed on the GUI for group experience.
	 */
void updatePartyExperience() {
    int expType = SettingsHandler.getGMGenOption(ExperienceAdjusterPlugin.LOG_NAME + ".ExperienceType", PreferencesExperiencePanel.EXPERIENCE_35);
    if (expType == PreferencesExperiencePanel.EXPERIENCE_3) {
        partyExperience = getPartyTotalExperience();
    } else {
        partyExperience = 0;
        for (int i = 0; i < party.size(); i++) {
            Combatant cbt = ((ExperienceListItem) party.get(i)).getCombatant();
            partyExperience += getCombatantExperience(cbt);
        }
    }
}
Also used : Combatant(gmgen.plugin.Combatant)

Example 22 with Combatant

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

the class ExperienceAdjusterModel method addExperienceToCharacter.

/**
	 * Adds experience to a certain character.
	 * @param item
	 * @param experience the value to add to the character.
	 */
void addExperienceToCharacter(ExperienceListItem item, int experience) {
    Combatant cbt = item.getCombatant();
    cbt.setXP(cbt.getXP() + experience);
    LogUtilities.inst().logMessage(ExperienceAdjusterPlugin.LOG_NAME, cbt.getName() + " Awarded " + experience + " Experience");
}
Also used : Combatant(gmgen.plugin.Combatant)

Example 23 with Combatant

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

the class ExperienceAdjusterModel method populateLists.

/**
	 * Populate lists
	 */
void populateLists() {
    if (combat != null) {
        party.removeAllElements();
        enemies.removeAllElements();
        for (int i = 0; i < combat.size(); i++) {
            InitHolder iH = combat.get(i);
            if (iH instanceof Combatant) {
                Combatant cbt = (Combatant) iH;
                if (cbt.getCombatantType().equals("PC")) {
                    party.addElement(new ExperienceListItem(cbt));
                } else if (cbt.getCombatantType().equals("Enemy")) {
                    if (cbt.getStatus() == State.Dead || cbt.getStatus() == State.Defeated) {
                        enemies.addElement(new ExperienceListItem(cbt));
                    }
                }
            }
        }
    }
}
Also used : Combatant(gmgen.plugin.Combatant) InitHolder(gmgen.plugin.InitHolder)

Example 24 with Combatant

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

the class ExperienceAdjusterModel method addExperienceToParty.

/**
	 * Adds experience to a group of combatants.
	 */
void addExperienceToParty() {
    int expType = SettingsHandler.getGMGenOption(ExperienceAdjusterPlugin.LOG_NAME + ".ExperienceType", PreferencesExperiencePanel.EXPERIENCE_35);
    LogUtilities.inst().logMessage(ExperienceAdjusterPlugin.LOG_NAME, "Party Awarded " + getPartyExperience() + " Total Experience Split as:");
    for (int i = 0; i < party.size(); i++) {
        Combatant cbt = ((ExperienceListItem) party.get(i)).getCombatant();
        if (expType == PreferencesExperiencePanel.EXPERIENCE_3) {
            cbt.setXP(cbt.getXP() + (getPartyTotalExperience() / party.size()));
            LogUtilities.inst().logMessage(ExperienceAdjusterPlugin.LOG_NAME, cbt.getName() + ": " + (getPartyTotalExperience() / party.size()));
        } else {
            cbt.setXP(cbt.getXP() + getCombatantExperience(cbt));
            LogUtilities.inst().logMessage(ExperienceAdjusterPlugin.LOG_NAME, cbt.getName() + ": " + getCombatantExperience(cbt));
        }
    }
}
Also used : Combatant(gmgen.plugin.Combatant)

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