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