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

Method processOldMaxDex

code/src/java/pcgen/core/PlayerCharacter.java:5359–5404  ·  view source on GitHub ↗

Calculate the MAXDEX bonus taking account of equipped items. Extracted from modToFromEquipment. @return MAXDEX bonus @deprecated due to PCMAXDEX code control

()

Source from the content-addressed store, hash-verified

5357 * @deprecated due to PCMAXDEX code control
5358 */
5359 @Deprecated
5360 public int processOldMaxDex()
5361 {
5362 final int statBonus = (int) getStatBonusTo("MISC", "MAXDEX");
5363 final Load load = getHouseRuledLoadType();
5364 int bonus = switch (load)
5365 {
5366 case MEDIUM -> 3;
5367 case HEAVY -> 1;
5368 case OVERLOAD -> 0;
5369 default -> statBonus;
5370 };
5371
5372 // If this is still true after all the equipment has been
5373 // examined, then we should use the Maximum - Maximum Dex modifier.
5374 boolean useMax = (load == Load.LIGHT);
5375
5376 for (Equipment eq : getEquippedEquipmentSet())
5377 {
5378 final int potentialMax = EqToken.getMaxDexTokenInt(this, eq);
5379 if (potentialMax != Constants.MAX_MAXDEX)
5380 {
5381 if (useMax || bonus > potentialMax)
5382 {
5383 bonus = potentialMax;
5384 }
5385 useMax = false;
5386 }
5387 }
5388
5389 if (useMax)
5390 {
5391 bonus = Constants.MAX_MAXDEX;
5392 }
5393
5394 bonus += ((int) getTotalBonusTo("MISC", "MAXDEX") - statBonus);
5395
5396 if (bonus < 0)
5397 {
5398 bonus = 0;
5399 } else if (bonus > Constants.MAX_MAXDEX)
5400 {
5401 bonus = Constants.MAX_MAXDEX;
5402 }
5403 return bonus;
5404 }
5405
5406 /**
5407 * Takes a String and a Class name and computes spell based variable such as

Callers 2

processMethod · 0.80
processMethod · 0.80

Calls 5

getStatBonusToMethod · 0.95
getHouseRuledLoadTypeMethod · 0.95
getMaxDexTokenIntMethod · 0.95
getTotalBonusToMethod · 0.95

Tested by

no test coverage detected