(final String line)
| 2582 | * ############################################################### |
| 2583 | */ |
| 2584 | private void parseFeatLine(final String line) |
| 2585 | { |
| 2586 | final PCGTokenizer tokens; |
| 2587 | |
| 2588 | try |
| 2589 | { |
| 2590 | tokens = new PCGTokenizer(line); |
| 2591 | } |
| 2592 | catch (PCGParseException pcgpex) |
| 2593 | { |
| 2594 | final String msg = LanguageBundle.getFormattedString("Warnings.PCGenParser.IllegalFeat", //$NON-NLS-1$ |
| 2595 | line, pcgpex.getMessage()); |
| 2596 | warnings.add(msg); |
| 2597 | |
| 2598 | return; |
| 2599 | } |
| 2600 | |
| 2601 | final Iterator<PCGElement> it = tokens.getElements().iterator(); |
| 2602 | |
| 2603 | // the first element defines the Ability key name |
| 2604 | if (it.hasNext()) |
| 2605 | { |
| 2606 | final PCGElement element = it.next(); |
| 2607 | |
| 2608 | final String abilityKey = EntityEncoder.decode(element.getText()); |
| 2609 | |
| 2610 | /* First, check to see if the PC already has this ability. If so, |
| 2611 | * then we just need to mod it. Otherwise we need to create a new |
| 2612 | * one and add it using non-aggregate (when using aggregate, we |
| 2613 | * get clones of the PCs actual feats, which don't get saved or |
| 2614 | * preserved) */ |
| 2615 | Ability anAbility = Globals.getContext().getReferenceContext().getManufacturerId(AbilityCategory.FEAT) |
| 2616 | .getActiveObject(abilityKey); |
| 2617 | if (anAbility == null) |
| 2618 | { |
| 2619 | final String msg = |
| 2620 | LanguageBundle.getFormattedString( |
| 2621 | "Warnings.PCGenParser.CouldntAddAbility", //$NON-NLS-1$ |
| 2622 | abilityKey); |
| 2623 | warnings.add(msg); |
| 2624 | |
| 2625 | return; |
| 2626 | } |
| 2627 | |
| 2628 | CNAbility pcAbility = CNAbilityFactory.getCNAbility(AbilityCategory.FEAT, Nature.NORMAL, anAbility); |
| 2629 | if (!anAbility.getSafe(ObjectKey.MULTIPLE_ALLOWED)) |
| 2630 | { |
| 2631 | thePC.addAbility(new CNAbilitySelection(pcAbility), UserSelection.getInstance(), |
| 2632 | UserSelection.getInstance()); |
| 2633 | } |
| 2634 | parseFeatsHandleAppliedToAndSaveTags(it, pcAbility); |
| 2635 | featsPresent = true; |
| 2636 | } |
| 2637 | } |
| 2638 | |
| 2639 | private void parseFeatPoolLine(final String line) |
| 2640 | { |
no test coverage detected