use of pcgen.core.Deity in project pcgen by PCGen.
the class DeityWeaponProfFacet method dataAdded.
/**
* Adds WeaponProfs granted to the Player Character due to the Deity
* selection of the Player Character.
*
* Triggered when one of the Facets to which DeityWeaponProfFacet listens
* fires a DataFacetChangeEvent to indicate a Deity was added to a Player
* Character.
*
* @param dfce
* The DataFacetChangeEvent containing the information about the
* change
*
* @see pcgen.cdom.facet.event.DataFacetChangeListener#dataAdded(pcgen.cdom.facet.event.DataFacetChangeEvent)
*/
@Override
public void dataAdded(DataFacetChangeEvent<CharID, Deity> dfce) {
Deity deity = dfce.getCDOMObject();
List<CDOMReference<WeaponProf>> weaponList = deity.getListFor(ListKey.DEITYWEAPON);
if (weaponList != null) {
for (CDOMReference<WeaponProf> ref : weaponList) {
for (WeaponProf wp : ref.getContainedObjects()) {
/*
* CONSIDER This is an open question, IMHO - why is natural
* excluded here? This is magic to me - thpr Oct 14, 2008
*/
if (!wp.isType("Natural")) {
add(dfce.getCharID(), wp, dfce.getCDOMObject());
}
}
}
}
}
use of pcgen.core.Deity in project pcgen by PCGen.
the class ClassData method getDomainWeights.
public WeightedCollection<Domain> getDomainWeights(final String aDeityKey) {
if (theDomainWeights == null) {
theDomainWeights = new HashMap<>();
}
WeightedCollection<Domain> domains = theDomainWeights.get(aDeityKey);
if (domains == null) {
domains = new WeightedCollection<>();
Deity deity = Globals.getContext().getReferenceContext().silentlyGetConstructedCDOMObject(Deity.class, aDeityKey);
for (CDOMReference<Domain> deityDomains : deity.getSafeListMods(Deity.DOMAINLIST)) {
domains.addAll(deityDomains.getContainedObjects(), deity.getListAssociations(Deity.DOMAINLIST, deityDomains).size());
}
}
return domains;
}
use of pcgen.core.Deity in project pcgen by PCGen.
the class Gui2InfoFactory method getHTMLInfo.
/**
* @see pcgen.core.facade.InfoFactory#getHTMLInfo(pcgen.core.facade.DeityFacade)
*/
@Override
public String getHTMLInfo(DeityFacade deityFacade) {
if (!(deityFacade instanceof Deity)) {
return EMPTY_STRING;
}
Deity aDeity = (Deity) deityFacade;
final HtmlInfoBuilder infoText = new HtmlInfoBuilder();
if (aDeity != null) {
infoText.appendTitleElement(OutputNameFormatting.piString(aDeity, false));
infoText.appendLineBreak();
infoText.appendI18nFormattedElement("in_InfoDescription", //$NON-NLS-1$
DescriptionFormatting.piWrapDesc(aDeity, pc.getDescription(aDeity), false));
appendFacts(infoText, aDeity);
String aString = getPantheons(aDeity);
if (aString != null) {
infoText.appendSpacer();
infoText.appendI18nElement("in_pantheon", //$NON-NLS-1$
aString);
}
infoText.appendSpacer();
infoText.appendI18nElement("in_domains", //$NON-NLS-1$
getDomains(aDeity));
List<CDOMReference<WeaponProf>> dwp = aDeity.getListFor(ListKey.DEITYWEAPON);
if (dwp != null) {
infoText.appendSpacer();
infoText.appendI18nFormattedElement(//$NON-NLS-1$
"in_deityFavWeap", ReferenceUtilities.joinLstFormat(dwp, "|"));
}
aString = PrerequisiteUtilities.preReqHTMLStringsForList(pc, null, aDeity.getPrerequisiteList(), false);
if (!aString.isEmpty()) {
infoText.appendSpacer();
//$NON-NLS-1$
infoText.appendI18nFormattedElement(//$NON-NLS-1$
"in_InfoRequirements", aString);
}
aString = aDeity.getSource();
if (!aString.isEmpty()) {
infoText.appendSpacer();
//$NON-NLS-1$
infoText.appendI18nFormattedElement(//$NON-NLS-1$
"in_InfoSource", aString);
}
}
return infoText.toString();
}
use of pcgen.core.Deity in project pcgen by PCGen.
the class Gui2InfoFactory method getFavoredWeapons.
/**
* Get a display string of the deity's favored weapons.
* @param deityFacade The deity to be output.
* @return The comma separated list of weapons.
*/
@Override
public String getFavoredWeapons(DeityFacade deityFacade) {
if (deityFacade == null || !(deityFacade instanceof Deity)) {
return EMPTY_STRING;
}
Deity deity = (Deity) deityFacade;
List<CDOMReference<WeaponProf>> wpnList = deity.getSafeListFor(ListKey.DEITYWEAPON);
return ReferenceUtilities.joinLstFormat(wpnList, ",");
}
Aggregations