MCPcopy Create free account
hub / github.com/PCGen/pcgen / getBenefits

Method getBenefits

code/src/java/pcgen/core/BenefitFormatting.java:34–76  ·  view source on GitHub ↗
(PlayerCharacter aPC, List<? extends Object> objList)

Source from the content-addressed store, hash-verified

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}

Callers 2

getHTMLInfoMethod · 0.95
getRetStringMethod · 0.95

Calls 9

errorPrintMethod · 0.95
isEmptyMethod · 0.65
getMethod · 0.65
getNameMethod · 0.65
getListForMethod · 0.65
getDescriptionMethod · 0.65
toStringMethod · 0.65
getAbilityMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected