|
From: <nu...@us...> - 2006-03-30 20:03:51
|
Revision: 530 Author: nuance Date: 2006-03-30 12:03:40 -0800 (Thu, 30 Mar 2006) ViewCVS: http://svn.sourceforge.net/pcgen/?rev=530&view=rev Log Message: ----------- [ pcgen-Bugs-1407451 ] Rapid Shot temp bonus weight error Fix bug. Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/Equipment.java Trunk/pcgen/code/src/java/pcgen/gui/tabs/InfoTempMod.java Modified: Trunk/pcgen/code/src/java/pcgen/core/Equipment.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/Equipment.java 2006-03-30 19:55:01 UTC (rev 529) +++ Trunk/pcgen/code/src/java/pcgen/core/Equipment.java 2006-03-30 20:03:40 UTC (rev 530) @@ -207,6 +207,7 @@ private boolean dirty; private String cachedNameWithoutCharges; private String cachedNameWithCharges; + private boolean virtualItem = false; { final DenominationList dl = Globals.getDenominationList(); @@ -1215,6 +1216,11 @@ public BigDecimal getCost(final PlayerCharacter aPC) { BigDecimal c = BigDecimalHelper.ZERO; + + if (this.isVirtual()) + { + return c; + } // // Do pre-sizing cost increment. @@ -3416,6 +3422,10 @@ */ public Float getWeight(final PlayerCharacter aPC) { + if (this.isVirtual()) + { + return new Float(0.0); + } return new Float(getWeightAsDouble(aPC)); } @@ -3425,6 +3435,11 @@ */ public double getBaseWeightAsDouble() { + if (this.isVirtual()) + { + return 0.0; + } + double aWeight = weightInPounds; aWeight += weightMod.doubleValue(); @@ -3438,6 +3453,11 @@ */ public double getWeightAsDouble(final PlayerCharacter aPC) { + if (this.isVirtual()) + { + return 0.0; + } + double f = bonusTo(aPC, "EQM", "WEIGHTMULT", true); if (CoreUtility.doublesEqual(f, 0.0)) @@ -5971,6 +5991,11 @@ */ private Float getWeightAdjustedForSize(final PlayerCharacter aPC, final String aSize) { + if (this.isVirtual()) + { + return new Float(0.0); + } + final SizeAdjustment newSA = SettingsHandler.getGame().getSizeAdjustmentNamed(aSize); final SizeAdjustment currSA = SettingsHandler.getGame().getSizeAdjustmentNamed(getSize()); @@ -6869,6 +6894,11 @@ double getWeightInPounds() { + if (this.isVirtual()) + { + return 0.0; + } + return weightInPounds; } @@ -7129,4 +7159,21 @@ } return sb.toString(); } + + /** + * Make this item virtual i.e. one that doesn't really exist and is only + * used to hold temporary bonuses + */ + public void makeVirtual() { + this.virtualItem = true; + } + + /** + * Does this item really exist, or is it a phantom created to hold a bonus + * + * @return Returns the virtualItem. + */ + private boolean isVirtual() { + return virtualItem; + } } Modified: Trunk/pcgen/code/src/java/pcgen/gui/tabs/InfoTempMod.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/gui/tabs/InfoTempMod.java 2006-03-30 19:55:01 UTC (rev 529) +++ Trunk/pcgen/code/src/java/pcgen/gui/tabs/InfoTempMod.java 2006-03-30 20:03:40 UTC (rev 530) @@ -952,6 +952,7 @@ { // Create new Item aEq = (Equipment) ((Equipment) aTarget).clone(); + aEq.makeVirtual(); String currAppName = aEq.getAppliedName(); if (currAppName != null && currAppName.length() > 2) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |