| 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 | { |