@param aPC The PC with the equipment @param saSize The size to adjust for @return The costAdjustedForSize value
(final PlayerCharacter aPC, final SizeAdjustment saSize)
| 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 |
no test coverage detected