Calculates the value of a formula. Does some preprocesing for variables that cannot be properly evaluated with just the equipment context that is held by the variable processor. @param aPC The character we are calculating the cost for. @param costFormula The formula to be evaluated. @param primaryHe
(final PlayerCharacter aPC, String costFormula, boolean primaryHead)
| 881 | * @return The value of the formula |
| 882 | */ |
| 883 | private String calcEqModCost(final PlayerCharacter aPC, String costFormula, boolean primaryHead) |
| 884 | { |
| 885 | Pattern pat = Pattern.compile("BASECOST"); |
| 886 | Matcher mat = pat.matcher(costFormula); |
| 887 | |
| 888 | // make string (BASECOST/X) which will be substituted into |
| 889 | // the cost string which is then converted to a number |
| 890 | String sB = "(BASECOST/" + getSafe(IntegerKey.BASE_QUANTITY) |
| 891 | + ")"; |
| 892 | String s = mat.replaceAll(sB); |
| 893 | |
| 894 | return getVariableValue(s, "", primaryHead, aPC).toString(); |
| 895 | } |
| 896 | |
| 897 | /** |
| 898 | * Set cost mod |
no test coverage detected