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

Method getBaseCheck

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

Returns the "Base" check value for the check at the index specified. @param check The index of the check to get @return The base check value.

(final PCCheck check)

Source from the content-addressed store, hash-verified

2734 * @return The base check value.
2735 */
2736 public int getBaseCheck(final PCCheck check)
2737 {
2738 String checkVar = ControlUtilities.getControlToken(Globals.getContext(), CControl.BASESAVE);
2739 if (checkVar != null)
2740 {
2741 return ((Number) this.getLocal(check, checkVar)).intValue();
2742 }
2743
2744 final String cacheLookup = "getBaseCheck:" + check.getKeyName(); //$NON-NLS-1$
2745
2746 Float total = variableProcessor.getCachedVariable(cacheLookup);
2747
2748 if (total != null)
2749 {
2750 return total.intValue();
2751 }
2752
2753 double bonus = 0;
2754
2755 final String checkName = check.getKeyName();
2756
2757 //Apply non-magical bonuses
2758 bonus += getTotalBonusTo("SAVE", "BASE." + checkName);
2759
2760 //
2761 // now we see if this PC is a Familiar/Mount
2762 final PlayerCharacter nPC = getMasterPC();
2763 if ((nPC != null) && (!masterFacet.getCopyMasterCheck(id).isEmpty()))
2764 {
2765 int masterBonus = nPC.getBaseCheck(check);
2766
2767 final String copyMasterCheck = replaceMasterString(masterFacet.getCopyMasterCheck(id), masterBonus);
2768 masterBonus = getVariableValue(copyMasterCheck, Constants.EMPTY_STRING).intValue();
2769
2770 // use masters save if better
2771 bonus = Math.max(bonus, masterBonus);
2772 }
2773
2774 variableProcessor.addCachedVariable(cacheLookup, (float) bonus);
2775 return (int) bonus;
2776 }
2777
2778 /**
2779 * Returns the total check value for the check specified for the character.

Callers 3

getTotalCheckMethod · 0.95
calculateSaveBonusMethod · 0.95
passesMethod · 0.80

Calls 14

getControlTokenMethod · 0.95
getContextMethod · 0.95
getLocalMethod · 0.95
getTotalBonusToMethod · 0.95
getMasterPCMethod · 0.95
replaceMasterStringMethod · 0.95
getVariableValueMethod · 0.95
intValueMethod · 0.80
getCachedVariableMethod · 0.80
getCopyMasterCheckMethod · 0.80
addCachedVariableMethod · 0.80
getKeyNameMethod · 0.65

Tested by 1

passesMethod · 0.64