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