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

Method replaceCostChoice

code/src/java/pcgen/core/analysis/EqModCost.java:280–309  ·  view source on GitHub ↗
(String costFormula, final String listEntry)

Source from the content-addressed store, hash-verified

278 }
279
280 private static String replaceCostChoice(String costFormula, final String listEntry)
281 {
282 String modChoice = "";
283
284 while (costFormula.contains("%CHOICE"))
285 {
286 final int idx = costFormula.indexOf("%CHOICE");
287
288 if (modChoice.isEmpty())
289 {
290 final int offs = listEntry.lastIndexOf('|');
291 int modValue = 0;
292
293 try
294 {
295 modValue = Delta.parseInt(listEntry.substring(offs + 1));
296 }
297 catch (NumberFormatException exc)
298 {
299 // TODO: Should this really be ignored?
300 }
301
302 modChoice = Integer.toString(modValue);
303 }
304
305 costFormula = costFormula.substring(0, idx) + modChoice + costFormula.substring(idx + 7);
306 }
307
308 return costFormula;
309 }
310
311 private static String replaceCostSpellXPCost(String costFormula, final String listEntry)
312 {

Callers 1

getCostMethod · 0.95

Calls 6

parseIntMethod · 0.95
containsMethod · 0.65
indexOfMethod · 0.65
isEmptyMethod · 0.65
lastIndexOfMethod · 0.65
toStringMethod · 0.65

Tested by

no test coverage detected