(final String line)
| 2364 | */ |
| 2365 | |
| 2366 | private void parseAbilityLine(final String line) |
| 2367 | { |
| 2368 | final PCGTokenizer tokens; |
| 2369 | |
| 2370 | try |
| 2371 | { |
| 2372 | tokens = new PCGTokenizer(line); |
| 2373 | } |
| 2374 | catch (PCGParseException pcgpex) |
| 2375 | { |
| 2376 | final String msg = LanguageBundle.getFormattedString("Warnings.PCGenParser.IllegalAbility", //$NON-NLS-1$ |
| 2377 | line, pcgpex.getMessage()); |
| 2378 | warnings.add(msg); |
| 2379 | |
| 2380 | return; |
| 2381 | } |
| 2382 | |
| 2383 | AbilityCategory category = null; |
| 2384 | Nature nature = Nature.NORMAL; |
| 2385 | String abilityCat = null; |
| 2386 | Ability ability = null; |
| 2387 | String missingCat = null; |
| 2388 | |
| 2389 | final Iterator<PCGElement> it = tokens.getElements().iterator(); |
| 2390 | |
| 2391 | // the first element defines the AbilityCategory key name |
| 2392 | if (it.hasNext()) |
| 2393 | { |
| 2394 | final PCGElement element = it.next(); |
| 2395 | |
| 2396 | final String categoryKey = EntityEncoder.decode(element.getText()); |
| 2397 | category = SettingsHandler.getGameAsProperty().get().getAbilityCategory(categoryKey); |
| 2398 | if (category == null) |
| 2399 | { |
| 2400 | missingCat = categoryKey; |
| 2401 | } |
| 2402 | } |
| 2403 | |
| 2404 | // The next element will be the nature |
| 2405 | if (it.hasNext()) |
| 2406 | { |
| 2407 | final PCGElement element = it.next(); |
| 2408 | |
| 2409 | final String natureKey = EntityEncoder.decode(element.getText()); |
| 2410 | nature = Nature.valueOf(natureKey); |
| 2411 | } |
| 2412 | |
| 2413 | // The next element will be the ability's innate category |
| 2414 | if (it.hasNext()) |
| 2415 | { |
| 2416 | final PCGElement element = it.next(); |
| 2417 | |
| 2418 | abilityCat = EntityEncoder.decode(element.getText()); |
| 2419 | } |
| 2420 | |
| 2421 | // The next element will be the ability key |
| 2422 | if (it.hasNext()) |
| 2423 | { |
no test coverage detected