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

Method update

code/src/java/pcgen/cdom/facet/model/SizeFacet.java:153–190  ·  view source on GitHub ↗

Forces a complete update of the size information for the Player Character identified by the given CharID. @param id The CharID indicating the Player Character on which to update the size information

(CharID id)

Source from the content-addressed store, hash-verified

151 * the size information
152 */
153 public void update(CharID id)
154 {
155 SizeFacetInfo info = getConstructingInfo(id);
156 int iSize = calcRacialSizeInt(id);
157
158 Race race = raceFacet.get(id);
159 if (race != null)
160 {
161 // Now check and see if a class has modified
162 // the size of the character with something like:
163 // BONUS:SIZEMOD|NUMBER|+1
164 iSize += (int) bonusCheckingFacet.getBonus(id, "SIZEMOD", "NUMBER");
165
166 // Now see if there is a HD advancement in size
167 // (Such as for Dragons)
168 iSize += sizesToAdvance(id, race);
169
170 //
171 // Must still be a valid size
172 //
173 int maxIndex =
174 Globals.getContext().getReferenceContext().getConstructedObjectCount(SIZEADJUSTMENT_CLASS) - 1;
175 iSize = Math.min(maxIndex, Math.max(0, iSize));
176 }
177
178 SizeAdjustment oldSize = info.sizeAdj;
179 SizeAdjustment newSize = Globals.getContext().getReferenceContext()
180 .getSortedList(SizeAdjustment.class, IntegerKey.SIZEORDER).get(iSize);
181 info.sizeAdj = newSize;
182 if (oldSize != newSize)
183 {
184 if (oldSize != null)
185 {
186 fireDataFacetChangeEvent(id, oldSize, DataFacetChangeEvent.DATA_REMOVED);
187 }
188 fireDataFacetChangeEvent(id, newSize, DataFacetChangeEvent.DATA_ADDED);
189 }
190 }
191
192 private int sizesToAdvance(CharID id, Race race)
193 {

Calls 12

getConstructingInfoMethod · 0.95
calcRacialSizeIntMethod · 0.95
sizesToAdvanceMethod · 0.95
getContextMethod · 0.95
getSortedListMethod · 0.80
getMethod · 0.65
getReferenceContextMethod · 0.65
getBonusMethod · 0.45
minMethod · 0.45
maxMethod · 0.45