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

Method getPurchaseModeBaseStatScore

code/src/java/pcgen/core/GameMode.java:1225–1253  ·  view source on GitHub ↗

Get the highest stat score that can be purchased free. @param aPC @return purchase mode base score

(final PlayerCharacter aPC)

Source from the content-addressed store, hash-verified

1223 * @return purchase mode base score
1224 */
1225 public int getPurchaseModeBaseStatScore(final PlayerCharacter aPC)
1226 {
1227 int minVal = getPurchaseScoreMin(aPC);
1228 for (int i = 0, x = getPurchaseScoreMax() - getPurchaseScoreMin() + 1; i < x; ++i)
1229 {
1230 if (getAbilityScoreCost(i) == 0)
1231 {
1232 if ((getPurchaseScoreMin() + i) >= minVal)
1233 {
1234 return getPurchaseScoreMin() + i;
1235 }
1236 }
1237 }
1238
1239 //
1240 // Make sure that the minimum stat value is legal. This could happen if there are no
1241 // stat values that are considered to be free.
1242 //
1243 if (getPurchaseScoreMin() == minVal)
1244 {
1245 minVal -= 1;
1246 if (minVal < statMin)
1247 {
1248 minVal = statMin;
1249 }
1250 }
1251
1252 return minVal;
1253 }
1254
1255 /**
1256 * Get the purchase mode method name.

Callers 2

rollStatsMethod · 0.80

Calls 3

getPurchaseScoreMinMethod · 0.95
getPurchaseScoreMaxMethod · 0.95
getAbilityScoreCostMethod · 0.95

Tested by

no test coverage detected