(PlayerCharacter aPC, List<? extends Object> objList)
| 32 | } |
| 33 | |
| 34 | public static String getBenefits(PlayerCharacter aPC, List<? extends Object> objList) |
| 35 | { |
| 36 | if (objList.isEmpty()) |
| 37 | { |
| 38 | return ""; |
| 39 | } |
| 40 | PObject sampleObject; |
| 41 | Object b = objList.get(0); |
| 42 | if (b instanceof PObject) |
| 43 | { |
| 44 | sampleObject = (PObject) b; |
| 45 | } |
| 46 | else if (b instanceof CNAbility) |
| 47 | { |
| 48 | sampleObject = ((CNAbility) b).getAbility(); |
| 49 | } |
| 50 | else |
| 51 | { |
| 52 | Logging.errorPrint("Unable to resolve Description with object of type: " + b.getClass().getName()); |
| 53 | return ""; |
| 54 | } |
| 55 | List<Description> theBenefits = sampleObject.getListFor(ListKey.BENEFIT); |
| 56 | if (theBenefits == null) |
| 57 | { |
| 58 | return Constants.EMPTY_STRING; |
| 59 | } |
| 60 | final StringBuilder buf = new StringBuilder(250); |
| 61 | boolean needSpace = false; |
| 62 | for (final Description desc : theBenefits) |
| 63 | { |
| 64 | final String str = desc.getDescription(aPC, objList); |
| 65 | if (!str.isEmpty()) |
| 66 | { |
| 67 | if (needSpace) |
| 68 | { |
| 69 | buf.append(' '); |
| 70 | } |
| 71 | buf.append(str); |
| 72 | needSpace = true; |
| 73 | } |
| 74 | } |
| 75 | return buf.toString(); |
| 76 | } |
| 77 | |
| 78 | } |
no test coverage detected