MCPcopy Create free account
hub / github.com/PCGen/pcgen / testApply

Method testApply

code/src/java/pcgen/core/kit/KitDeity.java:107–212  ·  view source on GitHub ↗
(Kit aKit, PlayerCharacter aPC, List<String> warnings)

Source from the content-addressed store, hash-verified

105 }
106
107 @Override
108 public boolean testApply(Kit aKit, PlayerCharacter aPC, List<String> warnings)
109 {
110 domainsToAdd = null;
111
112 theDeity = theDeityRef.get();
113
114 if (!aPC.canSelectDeity(theDeity))
115 {
116 warnings.add("DEITY: Cannot select deity \"" + theDeity.getDisplayName() + "\"");
117 return false;
118 }
119 ChannelUtilities.setControlledChannel(aPC.getCharID(),
120 CControl.DEITYINPUT, theDeity);
121
122 if (theDomains == null || theDomains.isEmpty())
123 {
124 // nothing else to do.
125 return true;
126 }
127
128 if (aPC.getMaxCharacterDomains() <= 0)
129 {
130 warnings.add("DEITY: Not allowed to choose a domain");
131
132 return true;
133 }
134 int numberOfChoices;
135 if (choiceCount == null)
136 {
137 numberOfChoices = theDomains.size();
138 }
139 else
140 {
141 numberOfChoices = choiceCount.resolve(aPC, "").intValue();
142 }
143
144 //
145 // Can't choose more entries than there are...
146 //
147 if (numberOfChoices > theDomains.size())
148 {
149 numberOfChoices = theDomains.size();
150 }
151
152 if (numberOfChoices == 0)
153 {
154 // No choices allowed, we are done.
155 return true;
156 }
157
158 List<CDOMSingleRef<Domain>> xs;
159 if (numberOfChoices == theDomains.size())
160 {
161 xs = theDomains;
162 }
163 else
164 {

Callers

nothing calls this directly

Calls 15

setControlledChannelMethod · 0.95
getChoiceFromListMethod · 0.95
applyDomainMethod · 0.95
canSelectDeityMethod · 0.80
intValueMethod · 0.80
calcActiveBonusesMethod · 0.80
getMethod · 0.65
addMethod · 0.65
getDisplayNameMethod · 0.65
getCharIDMethod · 0.65

Tested by

no test coverage detected