(LoadContext context, CDOMObject obj, String value)
| 55 | } |
| 56 | |
| 57 | @Override |
| 58 | protected ParseResult parseNonEmptyToken(LoadContext context, CDOMObject obj, String value) |
| 59 | { |
| 60 | if (obj instanceof Ungranted) |
| 61 | { |
| 62 | return new ParseResult.Fail( |
| 63 | "Cannot use " + getTokenName() + " on an Ungranted object type: " + obj.getClass().getSimpleName()); |
| 64 | } |
| 65 | if (obj instanceof NonInteractive) |
| 66 | { |
| 67 | return new ParseResult.Fail("Cannot use " + getTokenName() + " on an Non-Interactive object type: " |
| 68 | + obj.getClass().getSimpleName()); |
| 69 | } |
| 70 | String key; |
| 71 | String val; |
| 72 | int pipeLoc = value.indexOf(Constants.PIPE); |
| 73 | if (value.startsWith("FEAT=")) |
| 74 | { |
| 75 | key = "FEATEQ"; |
| 76 | val = value.substring(5); |
| 77 | } |
| 78 | else if (value.startsWith("LANGAUTO:")) |
| 79 | { |
| 80 | key = "LANGAUTO"; |
| 81 | val = value.substring(9); |
| 82 | } |
| 83 | else if (pipeLoc == -1) |
| 84 | { |
| 85 | key = value; |
| 86 | val = null; |
| 87 | } |
| 88 | else |
| 89 | { |
| 90 | key = value.substring(0, pipeLoc); |
| 91 | val = value.substring(pipeLoc + 1); |
| 92 | } |
| 93 | if (!((obj instanceof Ability) || (obj instanceof Domain) || (obj instanceof Race) |
| 94 | || (obj instanceof PCTemplate) || (obj instanceof Skill) || (obj instanceof EquipmentModifier))) |
| 95 | { |
| 96 | //Allow TEMPBONUS related choose |
| 97 | if (!"NUMBER".equals(key)) |
| 98 | { |
| 99 | return new ParseResult.Fail(getTokenName() + " is not supported for " + obj.getClass().getSimpleName()); |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | if (key.startsWith("NUMCHOICES=")) |
| 104 | { |
| 105 | String maxCount = key.substring(11); |
| 106 | if (maxCount.isEmpty()) |
| 107 | { |
| 108 | return new ParseResult.Fail("NUMCHOICES in CHOOSE must be a formula: " + value); |
| 109 | } |
| 110 | Formula f = FormulaFactory.getFormulaFor(maxCount); |
| 111 | if (!f.isValid()) |
| 112 | { |
| 113 | return new ParseResult.Fail( |
| 114 | "Number of Choices in " + getTokenName() + " was not valid: " + f.toString()); |
nothing calls this directly
no test coverage detected