Get the short version of the HITDICE token @param display @return the short version of the HITDICE token
(CharacterDisplay display)
| 166 | * @return the short version of the HITDICE token |
| 167 | */ |
| 168 | public static String getShortToken(CharacterDisplay display) |
| 169 | { |
| 170 | int dice = display.getClassSet().stream() |
| 171 | .map(pcClass -> |
| 172 | IntStream.range(0, display.getLevel(pcClass)) |
| 173 | .map(i -> display.getLevelHitDie(pcClass, i + 1).getDie()) |
| 174 | .boxed() |
| 175 | .collect(Collectors.toMap(Function.identity(), |
| 176 | hitDie -> 1, |
| 177 | Integer::sum, |
| 178 | LinkedHashMap::new))) |
| 179 | .mapToInt(hdMap -> hdMap.entrySet().stream().mapToInt(Map.Entry::getValue).sum()) |
| 180 | .sum(); |
| 181 | |
| 182 | return String.valueOf(dice); |
| 183 | } |
| 184 | } |
no test coverage detected