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

Method suppressMasterwork

code/src/java/pcgen/core/Equipment.java:1202–1218  ·  view source on GitHub ↗

Where a magic eqmod is present, remove the masterwork eqmod from the list. @param commonList The list of eqmods on both heads (or only head)

(Collection<EquipmentModifier> commonList)

Source from the content-addressed store, hash-verified

1200 * The list of eqmods on both heads (or only head)
1201 */
1202 private void suppressMasterwork(Collection<EquipmentModifier> commonList)
1203 {
1204 // Look for a modifier named "masterwork" (assumption: this is marked as
1205 // "assigntoall")
1206 EquipmentModifier eqMaster = commonList.stream()
1207 .filter(eqMod -> "MASTERWORK".equalsIgnoreCase(eqMod.getDisplayName()) || eqMod.isIType(Type.MASTERWORK))
1208 .findFirst().orElse(null);
1209
1210 if (eqMaster == null)
1211 {
1212 return;
1213 }
1214 if (heads.stream().anyMatch(head -> getMagicBonus(head.getListFor(ListKey.EQMOD)) != null))
1215 {
1216 commonList.remove(eqMaster);
1217 }
1218 }
1219 /**
1220 * Build up the description of the listed equipmods for this equipment item.
1221 * Takes into account if the item is a double weapon or not.

Callers 1

Calls 8

getMagicBonusMethod · 0.95
streamMethod · 0.80
equalsIgnoreCaseMethod · 0.80
isITypeMethod · 0.80
orElseMethod · 0.65
getDisplayNameMethod · 0.65
getListForMethod · 0.65
removeMethod · 0.65

Tested by

no test coverage detected