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

Method getPreSizingCostForHead

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

Calculate the parts of the cost for the equipment's head that are affected by size. @param aPC The character who owns the equipment. @param primaryHead Are we calculating for the primary or alternate head. @return The cost of the head

(final PlayerCharacter aPC, boolean primaryHead)

Source from the content-addressed store, hash-verified

764 * @return The cost of the head
765 */
766 private BigDecimal getPreSizingCostForHead(final PlayerCharacter aPC, boolean primaryHead)
767 {
768 BigDecimal c = BigDecimal.ZERO;
769 EquipmentHead head = getEquipmentHeadReference(primaryHead ? 1 : 2);
770 if (head != null)
771 {
772 bonusPrimary = primaryHead;
773 for (EquipmentModifier eqMod : head.getSafeListFor(ListKey.EQMOD))
774 {
775 int iCount = getSelectCorrectedAssociationCount(eqMod);
776
777 if (iCount < 1)
778 {
779 iCount = 1;
780 }
781
782 Formula baseCost = eqMod.getSafe(FormulaKey.BASECOST);
783 Number bc = baseCost.resolve(this, primaryHead, aPC, "");
784 final BigDecimal eqModCost = new BigDecimal(bc.toString());
785 c = c.add(
786 eqModCost.multiply(new BigDecimal(Integer.toString(getSafe(IntegerKey.BASE_QUANTITY) * iCount))));
787 c = c.add(
788 EqModCost.addItemCosts(eqMod, aPC, "ITEMCOST", getSafe(IntegerKey.BASE_QUANTITY) * iCount, this));
789 }
790 }
791 return c;
792 }
793
794 /**
795 * Calculate the parts of the cost for the equipment's head that are not

Callers 1

getCostMethod · 0.95

Calls 9

resolveMethod · 0.95
addItemCostsMethod · 0.95
getSafeMethod · 0.80
getSafeListForMethod · 0.65
toStringMethod · 0.65
addMethod · 0.65
multiplyMethod · 0.45

Tested by

no test coverage detected