use of pcgen.core.PlayerCharacter in project pcgen by PCGen.
the class SystemHP method isD20ModernMassive.
/**
* Returns true if the damage done is Massive damage under the
* d20 Modern system
*
* @param cbt
* @param damage
* @return true if the damage done is Massive damage under the
* d20 Modern system
*/
public static boolean isD20ModernMassive(Combatant cbt, int damage) {
if (cbt instanceof PcgCombatant) {
PcgCombatant pcgcbt = (PcgCombatant) cbt;
PlayerCharacter pc = pcgcbt.getPC();
PCStat stat = Globals.getContext().getReferenceContext().silentlyGetConstructedCDOMObject(PCStat.class, "CON");
if (damage > pc.getTotalStatFor(stat)) {
return true;
}
} else {
if (damage > cbt.getHP().getAttribute().getValue()) {
return true;
}
}
return false;
}
use of pcgen.core.PlayerCharacter in project pcgen by PCGen.
the class ClassSkillListFacet method levelChanged.
@Override
public void levelChanged(ClassLevelChangeEvent lce) {
if ((lce.getOldLevel() == 0) && (lce.getNewLevel() > 0)) {
PCClass cl = lce.getPCClass();
CharID id = lce.getCharID();
TransitionChoice<ClassSkillList> csc = cl.get(ObjectKey.SKILLLIST_CHOICE);
if (csc == null) {
ClassSkillList l = cl.get(ObjectKey.CLASS_SKILLLIST);
if (l != null) {
defaultClassSkillListFacet.add(id, cl, l, cl);
}
} else {
PlayerCharacter pc = trackingFacet.getPC(id);
for (ClassSkillList st : csc.driveChoice(pc)) {
add(id, cl, st, cl);
}
}
} else if ((lce.getOldLevel() > 0) && (lce.getNewLevel() == 0)) {
removeAllFromSource(lce.getCharID(), lce.getPCClass());
}
}
use of pcgen.core.PlayerCharacter in project pcgen by PCGen.
the class TemplateInputFacet method remove.
public void remove(CharID id, PCTemplate obj) {
unconditionalTemplateFacet.remove(id, obj);
PlayerCharacter pc = trackingFacet.getPC(id);
if (pc.isAllowInteraction()) {
templateSelectionFacet.remove(id, obj);
}
}
use of pcgen.core.PlayerCharacter in project pcgen by PCGen.
the class DomainInputFacet method remove.
public void remove(CharID id, Domain obj) {
PlayerCharacter pc = trackingFacet.getPC(id);
/*
* TODO This order of operations differs from Race and Template - is
* there a reason selection is first here and second there? Arguably
* this is correct since directSet is doing the selection last, so
* first-in first-out implies avoiding that issue
*/
if (pc.isAllowInteraction()) {
domainSelectionFacet.remove(id, obj);
}
domainFacet.remove(id, obj);
}
use of pcgen.core.PlayerCharacter in project pcgen by PCGen.
the class DomainInputFacet method importSelection.
public void importSelection(CharID id, Domain obj, String choice, ClassSource source) {
PlayerCharacter pc = trackingFacet.getPC(id);
if (ChooseActivation.hasNewChooseToken(obj)) {
ChoiceManagerList<?> aMan = ChooserUtilities.getChoiceManager(obj, pc);
String[] assoc = choice.split(",", -1);
for (String string : assoc) {
if (string.startsWith("FEAT?")) {
int openloc = string.indexOf('(');
int closeloc = string.lastIndexOf(')');
string = string.substring(openloc + 1, closeloc);
}
processImport(id, obj, aMan, string, source);
}
} else {
directSet(id, obj, null, source);
}
}
Aggregations