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