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

Method getCost

code/src/java/pcgen/core/analysis/EqModCost.java:129–162  ·  view source on GitHub ↗
(EquipmentModifier eqMod, final String listEntry)

Source from the content-addressed store, hash-verified

127 }
128
129 public static String getCost(EquipmentModifier eqMod, final String listEntry)
130 {
131 String costFormula = eqMod.getSafe(FormulaKey.COST).toString();
132 String modChoice = "";
133
134 while (costFormula.contains("%SPELLLEVEL"))
135 {
136 final int idx = costFormula.indexOf("%SPELLLEVEL");
137
138 if (modChoice.isEmpty())
139 {
140 final int iLevel = EqModSpellInfo.getSpellInfo(listEntry, "SPELLLEVEL");
141
142 if (iLevel == 0)
143 {
144 modChoice = "0.5";
145 }
146 else
147 {
148 modChoice = Integer.toString(iLevel);
149 }
150 }
151
152 costFormula = costFormula.substring(0, idx) + modChoice + costFormula.substring(idx + 11);
153 }
154
155 costFormula = replaceCostSpellCost(costFormula, listEntry);
156 costFormula = replaceCostSpellXPCost(costFormula, listEntry);
157 costFormula = replaceCostCasterLevel(costFormula, listEntry);
158 costFormula = replaceCostCharges(costFormula, listEntry);
159 costFormula = replaceCostChoice(costFormula, listEntry);
160
161 return costFormula;
162 }
163
164 private static String replaceCostCasterLevel(String costFormula, final String listEntry)
165 {

Callers 1

Calls 11

getSpellInfoMethod · 0.95
replaceCostSpellCostMethod · 0.95
replaceCostChargesMethod · 0.95
replaceCostChoiceMethod · 0.95
getSafeMethod · 0.80
toStringMethod · 0.65
containsMethod · 0.65
indexOfMethod · 0.65
isEmptyMethod · 0.65

Tested by

no test coverage detected