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

Method getCostAdjustedForSize

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

@param aPC The PC with the equipment @param saSize The size to adjust for @return The costAdjustedForSize value

(final PlayerCharacter aPC, final SizeAdjustment saSize)

Source from the content-addressed store, hash-verified

3755 * @return The costAdjustedForSize value
3756 */
3757 private BigDecimal getCostAdjustedForSize(final PlayerCharacter aPC, final SizeAdjustment saSize)
3758 {
3759 BigDecimal c = getSafe(ObjectKey.COST);
3760
3761 //
3762 // Scale everything to medium before conversion
3763 //
3764 SizeAdjustment saBase = getSafe(ObjectKey.BASESIZE).get();
3765
3766 if (saSize == null)
3767 {
3768 return c;
3769 }
3770
3771 if (aPC != null)
3772 {
3773 String costMultiplierVar = aPC.getControl(CControl.COSTMULTIPLIER);
3774 if (costMultiplierVar == null)
3775 {
3776 final double saDbl = aPC.getSizeBonusTo(saSize, "ITEMCOST", typeList(), 1.0);
3777 final double saBaseDbl = aPC.getSizeBonusTo(saBase, "ITEMCOST", typeList(), 1.0);
3778 final double mult = saDbl / saBaseDbl;
3779 c = c.multiply(BigDecimal.valueOf(mult));
3780 }
3781 else
3782 {
3783 final double mult = ((Number) getLocalVariable(aPC.getCharID(), costMultiplierVar)).doubleValue();
3784 c = c.multiply(BigDecimal.valueOf(mult));
3785
3786 }
3787 }
3788
3789 //
3790 // TODO:Non-humanoid races can also double the cost (armor)
3791 //
3792 return c;
3793 }
3794
3795 /**
3796 * return the list of modifier keys as a period-delimeted string

Callers 1

resizeItemMethod · 0.95

Calls 10

typeListMethod · 0.95
getLocalVariableMethod · 0.95
getSafeMethod · 0.80
getControlMethod · 0.80
getSizeBonusToMethod · 0.80
doubleValueMethod · 0.80
getMethod · 0.65
getCharIDMethod · 0.65
multiplyMethod · 0.45
valueOfMethod · 0.45

Tested by

no test coverage detected