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)
| 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 | { |