|
From: <boo...@us...> - 2006-04-04 04:46:36
|
Revision: 597 Author: boomer70 Date: 2006-04-03 21:46:19 -0700 (Mon, 03 Apr 2006) ViewCVS: http://svn.sourceforge.net/pcgen/?rev=597&view=rev Log Message: ----------- [ 1460794 ] Remove token parsing from core CRITMULT and ALTCRITMULT fully parsed by plugin. Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/Equipment.java Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java Trunk/pcgen/code/src/java/pcgen/core/VariableProcessorEq.java Trunk/pcgen/code/src/java/pcgen/gui/tabs/InfoEquipping.java Trunk/pcgen/code/src/java/pcgen/gui/tabs/InfoGear.java Trunk/pcgen/code/src/java/pcgen/io/exporttoken/WeaponToken.java Trunk/pcgen/code/src/java/pcgen/io/exporttoken/WeaponhToken.java Trunk/pcgen/code/src/java/plugin/lsttokens/NaturalattacksLst.java Trunk/pcgen/code/src/java/plugin/lsttokens/equipment/AltcriticalToken.java Trunk/pcgen/code/src/java/plugin/lsttokens/equipment/AltcritmultToken.java Trunk/pcgen/code/src/java/plugin/lsttokens/equipment/CritmultToken.java Trunk/pcgen/code/src/test/pcgen/io/exporttoken/WeaponTokenTest.java Modified: Trunk/pcgen/code/src/java/pcgen/core/Equipment.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/Equipment.java 2006-04-04 03:18:51 UTC (rev 596) +++ Trunk/pcgen/code/src/java/pcgen/core/Equipment.java 2006-04-04 04:46:19 UTC (rev 597) @@ -205,8 +205,8 @@ private List typeListCacheSecondary=null; private boolean dirty; - private String cachedNameWithoutCharges; - private String cachedNameWithCharges; + private String cachedNameWithoutCharges; + private String cachedNameWithCharges; private boolean virtualItem = false; { @@ -260,13 +260,13 @@ acCheck = new Integer(0); } } - + /** * Get ACCheck * @return AC Check */ public Integer getAcCheck() { - return acCheck; + return acCheck; } /** @@ -316,48 +316,6 @@ } /** - * Sets the altCritMult attribute of the Equipment object - * - * @param aString The new altCritMult value - */ - public void setAltCritMult(final String aString) - { - altCritMult = parseCritMult(aString); - } - - /** - * Gets the altCritMult attribute of the Equipment object - * - * @return The altCritMult value - */ - public String getAltCritMult() - { - // Use primary if none defined - if (altCritMult == 0) - { - return getCritMult(); - } - - return multAsString(getCritMultiplier(false)); - } - - /** - * Gets the altCritMultiplier attribute of the Equipment object - * - * @return The altCritMultiplier value - */ - public int getAltCritMultiplier() - { - // Use primary if none defined - if (altCritMult == 0) - { - return getCritMultiplier(); - } - - return multAsInt(getCritMultiplier(false)); - } - - /** * Sets the altCritRange attribute of the Equipment object * * @param aString The new altCritRange value @@ -537,7 +495,7 @@ * bsmeister - 10/22/2002 * For now, this just gets the BigDecimal version, and then converts * it to a Purse object. - * + * * @return Purse (Base coin cost) */ public Purse getBaseCoinCost() @@ -743,13 +701,13 @@ d_childTypes.put(parameter, childType); } - /** + /** * bsmeister - 10/22/2002 - * + * * For now, this just gets the BigDecimal version, and then converts * it to a Purse object. At some future time, it should actually * do the things that the BigDecimal version is doing. - * + * * @param aPC * @return Purse (Coin cost) */ @@ -883,12 +841,12 @@ if (anEquip.getContainedEquipmentCount() > 0) { total = new Float(total.floatValue() + anEquip.getBaseWeightAsDouble() - + anEquip.getBaseContainedWeight().floatValue()); + + anEquip.getBaseContainedWeight().floatValue()); } else { total = new Float(total.floatValue() - + (anEquip.getBaseWeightAsDouble() * anEquip.getCarried().floatValue())); + + (anEquip.getBaseWeightAsDouble() * anEquip.getCarried().floatValue())); } } @@ -923,12 +881,12 @@ if (anEquip.getContainedEquipmentCount() > 0) { total = new Float(total.floatValue() + anEquip.getWeightAsDouble(aPC) - + anEquip.getContainedWeight(aPC).floatValue()); + + anEquip.getContainedWeight(aPC).floatValue()); } else { total = new Float(total.floatValue() - + (anEquip.getWeightAsDouble(aPC) * anEquip.getCarried().floatValue())); + + (anEquip.getWeightAsDouble(aPC) * anEquip.getCarried().floatValue())); } } @@ -1216,7 +1174,7 @@ public BigDecimal getCost(final PlayerCharacter aPC) { BigDecimal c = BigDecimalHelper.ZERO; - + if (this.isVirtual()) { return c; @@ -1302,7 +1260,7 @@ if ((aEqMod.getAssociatedCount() > 0) && !costFormula.equals(aEqMod.getCost(0))) { eqModCost = BigDecimalHelper.ZERO; - + for (int idx = 0; idx < aEqMod.getAssociatedCount(); ++idx) { mat = pat.matcher(aEqMod.getCost(idx)); @@ -1430,26 +1388,6 @@ } /** - * Sets the critMult attribute of the Equipment object - * - * @param aString The new critMult value - */ - public void setCritMult(final String aString) - { - critMult = parseCritMult(aString); - } - - /** - * Gets the critMult attribute of the Equipment object - * - * @return The critMult value - */ - public String getCritMult() - { - return multAsString(getCritMultiplier(true)); - } - - /** * Sets the critRange attribute of the Equipment object * * @param aString The new critRange value @@ -1803,20 +1741,20 @@ /* for (Iterator e = eqModifierList.iterator(); e.hasNext();) { - EquipmentModifier eqMod = (EquipmentModifier) e.next(); - for (Iterator mI = eqMod.getBonusList().iterator(); mI.hasNext();) - { - BonusObj aBonus = (BonusObj) mI.next(); - String eqModBonus = aBonus.toString(); - if ((eqModBonus.length() != 0) && !eqModBonus.startsWith("EQM")) - { - if (s.length() != 0) - { - s.append(", "); - } - s.append(eqModBonus); - } - } + EquipmentModifier eqMod = (EquipmentModifier) e.next(); + for (Iterator mI = eqMod.getBonusList().iterator(); mI.hasNext();) + { + BonusObj aBonus = (BonusObj) mI.next(); + String eqModBonus = aBonus.toString(); + if ((eqModBonus.length() != 0) && !eqModBonus.startsWith("EQM")) + { + if (s.length() != 0) + { + s.append(", "); + } + s.append(eqModBonus); + } + } } */ if (t.length() != 0) @@ -2272,7 +2210,7 @@ /** * Get minimum charges - * @return minimum charges + * @return minimum charges */ public int getMinCharges() { @@ -2290,15 +2228,15 @@ return 0; } - /* (non-Javadoc) - * @see pcgen.core.PObject#setName(java.lang.String) - */ - public void setName(final String aString) { - super.setName(aString); - setDirty(true); - } + /* (non-Javadoc) + * @see pcgen.core.PObject#setName(java.lang.String) + */ + public void setName(final String aString) { + super.setName(aString); + setDirty(true); + } - /** + /** * Sets the modifiedName attribute of the Equipment object * * @param nameString The new modifiedName value @@ -2669,7 +2607,7 @@ { return profName; } - + /** * Sets the qty attribute of the Equipment object * @@ -2901,7 +2839,7 @@ } /** - * Get the raw special properties + * Get the raw special properties * @return raw special propertie */ public String getRawSpecialProperties() @@ -3094,7 +3032,7 @@ /** * Returns special properties of an Equipment. - * + * * @param aPC * @return special properties of an Equipment. */ @@ -3337,8 +3275,8 @@ final boolean bPrimary, final PlayerCharacter aPC) { - VariableProcessor vp = new VariableProcessorEq(this, aPC, bPrimary); - return vp.getVariableValue(null, varName, src, 0); + VariableProcessor vp = new VariableProcessorEq(this, aPC, bPrimary); + return vp.getVariableValue(null, varName, src, 0); } /** @@ -3931,7 +3869,7 @@ } /** - * Add bonuses + * Add bonuses * @param aPC * @param aType * @param aName @@ -4018,7 +3956,7 @@ /** * Calculates the plusForCosting attribute of the Equipment object - * + * * @return The plusForCosting value */ public int calcPlusForCosting() @@ -4368,8 +4306,8 @@ } /** - * Returns TRUE true if it is weildable - * @return true if it is weildable + * Returns TRUE true if it is weildable + * @return true if it is weildable */ public boolean hasWield() { @@ -4404,9 +4342,9 @@ /** * Adds a child to this Equipment - * + * * TODO Why does it accept an Object - * + * * @param aPC * @param child The child to add */ @@ -5029,37 +4967,37 @@ */ public String toString(final boolean addCharges) { - if (isDirty() || (cachedNameWithCharges == null && cachedNameWithoutCharges == null)) { - // If we have modified the equipment details with - // respect to the name then rebuid the names + if (isDirty() || (cachedNameWithCharges == null && cachedNameWithoutCharges == null)) { + // If we have modified the equipment details with + // respect to the name then rebuid the names final StringBuffer buffer = new StringBuffer(name); if (modifiedName.length() > 0) { buffer.append(" (").append(modifiedName).append(")"); } - cachedNameWithoutCharges = buffer.toString(); + cachedNameWithoutCharges = buffer.toString(); if (addCharges && (getRemainingCharges() > getMinCharges()) && (getRemainingCharges() < getMaxCharges())) { buffer.append("(").append(getRemainingCharges()).append(")"); } - cachedNameWithCharges = buffer.toString(); + cachedNameWithCharges = buffer.toString(); setDirty(false); } - // Return the cached names. + // Return the cached names. if (addCharges) { - return cachedNameWithCharges; + return cachedNameWithCharges; } return cachedNameWithoutCharges; } private boolean isDirty() { - return dirty; + return dirty; } private void setDirty(final boolean dirty) { - this.dirty = dirty; + this.dirty = dirty; } /** @@ -5171,10 +5109,10 @@ } /** - * @param aPC - */ - private void setDefaultCrit(final PlayerCharacter aPC) { - if (isWeapon()) + * @param aPC + */ + private void setDefaultCrit(final PlayerCharacter aPC) { + if (isWeapon()) { if (getCritRange(aPC).length() == 0) { @@ -5183,12 +5121,12 @@ if (getCritMult().length() == 0) { - setCritMult("x2"); + setCritMult(2); } } - } + } - /** + /** * Gets the masterwork attribute of the Equipment object * * @return The masterwork value @@ -5577,7 +5515,7 @@ } return Integer.toString((getRawCritRange(bPrimary) * (getCritRangeDouble(aPC, bPrimary) + 1)) - + getCritRangeAdd(aPC, bPrimary)); + + getCritRangeAdd(aPC, bPrimary)); } private String getDamage(final PlayerCharacter aPC, final boolean bPrimary) @@ -5839,7 +5777,7 @@ if (((iPlus != 0) || (altPlus != 0)) && (JEPResourceChecker.getMissingResourceCount() == 0)) { PJEP myParser=null; - try { + try { myParser = PjepPool.getInstance().aquire(); myParser.addVariable("PLUS", iPlus); myParser.addVariable("ALTPLUS", altPlus); @@ -5889,11 +5827,11 @@ { return evaluateCost(myParser, costExpr); } - } - finally - { - PjepPool.getInstance().release(myParser); - } + } + finally + { + PjepPool.getInstance().release(myParser); + } } return BigDecimalHelper.ZERO; @@ -5909,8 +5847,8 @@ boolean limited = false; if (isType("HEADGEAR") || isType("EYEGEAR") || isType("CAPE") || isType("AMULET") || isSuit() || isType("ROBE") - || isType("SHIRT") || isType("BRACER") || isType("GLOVE") || isType("RING") || isType("BELT") - || isType("BOOT")) + || isType("SHIRT") || isType("BRACER") || isType("GLOVE") || isType("RING") || isType("BELT") + || isType("BOOT")) { limited = true; } @@ -6005,7 +5943,7 @@ } final double mult = newSA.getBonusTo(aPC, "ITEMWEIGHT", typeList(), 1.0) / currSA.getBonusTo(aPC, "ITEMWEIGHT", - typeList(), 1.0); + typeList(), 1.0); return new Float(getBaseWeightAsDouble() * mult); } @@ -6094,7 +6032,7 @@ if ((newSA != null) && (currSA != null)) { mult = newSA.getBonusTo(aPC, "ACVALUE", baseEq.typeList(), 1.0) / currSA.getBonusTo(aPC, "ACVALUE", - baseEq.typeList(), 1.0); + baseEq.typeList(), 1.0); } final List baseEqBonusList = baseEq.getBonusList(); @@ -6225,69 +6163,6 @@ /** * Description of the Method * - * @param mult Description of the Parameter - * @return Description of the Return Value - */ - private static int multAsInt(final int mult) - { - if (mult < 0) - { - return 0; - } - - return mult; - } - - /** - * Description of the Method - * - * @param mult Description of the Parameter - * @return Description of the Return Value - */ - private static String multAsString(final int mult) - { - if (mult == 0) - { - return ""; - } - else if (mult < 0) - { - return "-"; - } - - return "x" + Integer.toString(mult); - } - - private int getCritMultiplier(final boolean bPrimary) - { - int mult = bPrimary ? critMult : altCritMult; - - if (mult == 0) - { - final String cm = getWeaponInfo("CRITMULT", bPrimary); - - if (cm.length() != 0) - { - mult = Integer.parseInt(cm); - } - } - - return mult; - } - - /** - * Gets the critMultiplier attribute of the Equipment object - * - * @return The critMultiplier value - */ - int getCritMultiplier() - { - return multAsInt(getCritMultiplier(true)); - } - - /** - * Description of the Method - * * @return Description of the Return Value */ private SortedSet eqTypeList() @@ -6411,7 +6286,7 @@ boolean noDouble = false; if (isType("MANTLE") // Mantle of Spell Resistance doesn't double cost - || isType("POTION") || isType("SCROLL") || isType("STAFF") || isType("WAND")) + || isType("POTION") || isType("SCROLL") || isType("STAFF") || isType("WAND")) { noDouble = true; } @@ -6422,29 +6297,6 @@ /** * Description of the Method * - * @param aString Description of the Parameter - * @return Description of the Return Value - */ - private int parseCritMult(final String aString) - { - if ((aString.length() > 0) && (aString.charAt(0) == 'x')) - { - try - { - return Integer.parseInt(aString.substring(1)); - } - catch (NumberFormatException nfe) - { - Logging.errorPrint("parseCritMult:" + getName() + ":" + aString); - } - } - - return -1; - } - - /** - * Description of the Method - * * @param aTypeList Description of the Parameter * @param aQuant Description of the Parameter * @return Description of the Return Value @@ -6479,8 +6331,8 @@ if (acceptsType(aString)) { if (containsChildType(aString) - && ((getChildType(aString).floatValue() + aQuant.floatValue()) <= getAcceptsType(aString) - .floatValue())) + && ((getChildType(aString).floatValue() + aQuant.floatValue()) <= getAcceptsType(aString) + .floatValue())) { canContain = aString; } @@ -6602,22 +6454,22 @@ { final List eqModList = getEqModifierList(bPrimary); - for (int i = eqModList.size() - 1; i >= 0; --i) { - final EquipmentModifier eqMod = (EquipmentModifier) eqModList.get(i); + for (int i = eqModList.size() - 1; i >= 0; --i) { + final EquipmentModifier eqMod = (EquipmentModifier) eqModList.get(i); - // The problem is that you have entries - // like the following for Adamantine: - // PRETYPE:Weapon,Metal !PRETYPE:Masterwork - // Which have nothing to do with the eqMod, so - // they are always going to fail and be removed - // The entries in equip_enhancing are used by - // the GUI to know what to display, not for - // actual passesPreReq checks + // The problem is that you have entries + // like the following for Adamantine: + // PRETYPE:Weapon,Metal !PRETYPE:Masterwork + // Which have nothing to do with the eqMod, so + // they are always going to fail and be removed + // The entries in equip_enhancing are used by + // the GUI to know what to display, not for + // actual passesPreReq checks - if (!eqMod.passesPreReqToGain(this, null)) { - Logging.errorPrint("reUnq:Removing: " + eqMod.getName()); - Logging.errorPrint("reUnq:preReqs: " + eqMod.preReqStrings()); - } + if (!eqMod.passesPreReqToGain(this, null)) { + Logging.errorPrint("reUnq:Removing: " + eqMod.getName()); + Logging.errorPrint("reUnq:preReqs: " + eqMod.preReqStrings()); + } } } @@ -6744,7 +6596,7 @@ // If it's BOTH & MELEE, we cannot add RANGED or THROWN to it // BOTH is only used after the split of a Thrown weapon in 2 (melee and ranged) if (calculatedTypeList.contains("BOTH") && calculatedTypeList.contains("MELEE") - && ("RANGED".equals(aType) || "THROWN".equals(aType))) + && ("RANGED".equals(aType) || "THROWN".equals(aType))) { continue; } @@ -7004,11 +6856,11 @@ public String createKeyForAutoResize(String newSize) { - // Make sure newSize has at least one letter - if (newSize.length() < 1) - { - return getKeyName(); - } + // Make sure newSize has at least one letter + if (newSize.length() < 1) + { + return getKeyName(); + } // Make sure the new size is a configured sizeAdjustment SizeAdjustment sa = SettingsHandler.getGame().getSizeAdjustmentNamed(newSize); @@ -7056,11 +6908,11 @@ public String createNameForAutoResize(String newSize) { - // Make sure newSize has at least one letter - if (newSize.length() < 1) - { - return getName(); - } + // Make sure newSize has at least one letter + if (newSize.length() < 1) + { + return getName(); + } // Make sure the new size is a configured sizeAdjustment SizeAdjustment sa = SettingsHandler.getGame().getSizeAdjustmentNamed(newSize); @@ -7090,14 +6942,14 @@ (upName.substring(start - 1).startsWith("(") || upName.substring(start - 1).startsWith("/")) && (upName.substring(end).startsWith(")") || - upName.substring(end).startsWith("/"))) + upName.substring(end).startsWith("/"))) { return thisName.substring(0, start) + newSize + thisName.substring(end); } return thisName + " (" + newSize + ")"; } - + /** * Set QUALITY * @param key @@ -7106,7 +6958,7 @@ public void setQuality(String key, String value) { qualityMap.put(key, value); } - + /** * Get QUALITY * @param key @@ -7131,7 +6983,7 @@ } return ""; } - + /** * Get quality map * @return quality map @@ -7139,7 +6991,7 @@ public Map getQualityMap() { return qualityMap; } - + /** * Get quality string * @return quality string @@ -7170,10 +7022,155 @@ /** * Does this item really exist, or is it a phantom created to hold a bonus - * + * * @return Returns the virtualItem. */ private boolean isVirtual() { return virtualItem; } + + /** + * Sets the critMult attribute of the Equipment object + * + * @param aString The new critMult value + */ + public void setCritMult(final int aMult) + { + critMult = aMult; + } + + /** + * Gets the critMult attribute of the Equipment object + * + * @return The critMult value + */ + public String getCritMult() + { + return multAsString(getCritMultiplier(true)); + } + + /** + * Gets the unmodified crit multiplier for the weapon. + * + * @return the crit multiplier + */ + public int getRawCritMult() + { + return critMult; + } + + /** + * Sets the altCritMult attribute of the Equipment object + * + * @param aString The new altCritMult value + */ + public void setAltCritMult(final int aMult) + { + altCritMult = aMult; + } + + /** + * Gets the altCritMult attribute of the Equipment object + * + * @return The altCritMult value + */ + public String getAltCritMult() + { + // Use primary if none defined + if (altCritMult == 0) + { + return getCritMult(); + } + + return multAsString(getCritMultiplier(false)); + } + + /** + * Gets the unmodified alt crit multiplier for the weapon. + * + * @return the alt crit multiplier + */ + public int getRawAltCritMult() + { + return altCritMult; + } + + /** + * Gets the critMultiplier attribute of the Equipment object + * + * @return The critMultiplier value + */ + public int getCritMultiplier() + { + return multAsInt(getCritMultiplier(true)); + } + + /** + * Gets the altCritMultiplier attribute of the Equipment object + * + * @return The altCritMultiplier value + */ + public int getAltCritMultiplier() + { + // Use primary if none defined + if (altCritMult == 0) + { + return getCritMultiplier(); + } + + return multAsInt(getCritMultiplier(false)); + } + + /** + * Description of the Method + * + * @param mult Description of the Parameter + * @return Description of the Return Value + */ + private static int multAsInt(final int mult) + { + if (mult < 0) + { + return 0; + } + + return mult; + } + + /** + * Description of the Method + * + * @param mult Description of the Parameter + * @return Description of the Return Value + */ + private static String multAsString(final int mult) + { + if (mult == 0) + { + return ""; + } + else if (mult < 0) + { + return "-"; + } + + return "x" + Integer.toString(mult); + } + + private int getCritMultiplier(final boolean bPrimary) + { + int mult = bPrimary ? critMult : altCritMult; + + if (mult == 0) + { + final String cm = getWeaponInfo("CRITMULT", bPrimary); + + if (cm.length() != 0) + { + mult = Integer.parseInt(cm); + } + } + + return mult; + } } Modified: Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2006-04-04 03:18:51 UTC (rev 596) +++ Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2006-04-04 04:46:19 UTC (rev 597) @@ -174,7 +174,7 @@ // wether higher level spell slots should be used for lower levels private boolean useHigherKnownSlots = SettingsHandler.isUseHigherLevelSlotsDefault(); private boolean useHigherPreppedSlots = SettingsHandler.isUseHigherLevelSlotsDefault(); - + // should we also load companions on master load? private boolean autoLoadCompanion = false; @@ -4440,10 +4440,10 @@ } /** - * Determine whether higher level known spell slots can be - * used for lower level spells, or if known spells + * Determine whether higher level known spell slots can be + * used for lower level spells, or if known spells * are restricted to their own level only. - * + * * @return Returns the useHigherKnownSlots. */ public final boolean getUseHigherKnownSlots() @@ -4452,10 +4452,10 @@ } /** - * Set whether higher level known spell slots can be - * used for lower level spells, or if known spells + * Set whether higher level known spell slots can be + * used for lower level spells, or if known spells * are restricted to their own level only. - * + * * @param useHigher Can higher level known spell slots be used? */ public final void setUseHigherKnownSlots(boolean useHigher) @@ -4464,10 +4464,10 @@ } /** - * Determine whether higher level prepared spell slots can be - * used for lower level spells, or if prepared spells + * Determine whether higher level prepared spell slots can be + * used for lower level spells, or if prepared spells * are restricted to their own level only. - * + * * @return Returns the useHigherPreppedSlots. */ public final boolean getUseHigherPreppedSlots() @@ -4476,10 +4476,10 @@ } /** - * Set whether higher level prepared spell slots can be - * used for lower level spells, or if prepared spells + * Set whether higher level prepared spell slots can be + * used for lower level spells, or if prepared spells * are restricted to their own level only. - * + * * @param useHigher Can higher level prepared spell slots be used? */ public final void setUseHigherPreppedSlots(boolean useHigher) @@ -5076,7 +5076,7 @@ eqm.removeType("Double"); eqm.setTypeInfo("Head2"); eqm.setDamage(eqm.getAltDamage(this)); - eqm.setCritMult(eqm.getAltCritMult()); + eqm.setCritMult(eqm.getRawAltCritMult()); eqm.setCritRange(Integer.toString(eqm.getRawCritRange(false))); eqm.getEqModifierList(true).clear(); eqm.getEqModifierList(true).addAll(eqm.getEqModifierList(false)); @@ -9600,7 +9600,7 @@ * prerequisties with this method, also this method does not print * warning messages * see: incrementClassLevel(int, PCClass, boolean, boolean); - * + * * @param mod the number of levels to add/remove * @param aClass the class to adjust */ @@ -13126,8 +13126,8 @@ // At the level currently being looped through, if the number of casts // is zero, that means we have reached a level beyond which no higher-level // casts are possible. Therefore, it's time to break. - // Likewise if we aren't allowed to use higher level slots, no sense in - // going higher than the spell's level. + // Likewise if we aren't allowed to use higher level slots, no sense in + // going higher than the spell's level. // if (knownTot == 0 || (!canUseHigher && i > level)) { @@ -14174,8 +14174,8 @@ * a previously saved character. there is no way to bypass the * prerequisties with this method, * see: incrementClassLevel(int, PCClass, boolean, boolean); - * * + * * @param numberOfLevels number of levels to add * @param globalClass the class to add the levels to * @param bSilent whether or not to dispaly warning messages Modified: Trunk/pcgen/code/src/java/pcgen/core/VariableProcessorEq.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/VariableProcessorEq.java 2006-04-04 03:18:51 UTC (rev 596) +++ Trunk/pcgen/code/src/java/pcgen/core/VariableProcessorEq.java 2006-04-04 04:46:19 UTC (rev 597) @@ -24,9 +24,9 @@ import pcgen.util.Logging; /** - * <code>VariableProcessorEq</code> is a processor for variables - * associated with a character's equipment. This class converts - * formulas or variables into values and is used extensively + * <code>VariableProcessorEq</code> is a processor for variables + * associated with a character's equipment. This class converts + * formulas or variables into values and is used extensively * both in defintions of objects and for output to output sheets. * * Last Editor: $Author$ @@ -35,41 +35,41 @@ * @author Chris Ward <fr...@pu...> * @version $Revision$ */ -public class VariableProcessorEq extends VariableProcessor +public class VariableProcessorEq extends VariableProcessor { - private Equipment eq; - private boolean primaryHead; + private Equipment eq; + private boolean primaryHead; - /** - * Create a new VariableProcessorEq instance for an equipment item, and pc. It - * also allows splitting of the processing of the heads of double weapons. - * - * @param eq The item of equipment being processed. - * @param pc The player character being processed. - * @param primaryHead Is this the primary head of a double weapon? - */ - public VariableProcessorEq(Equipment eq, PlayerCharacter pc, boolean primaryHead) { - super(pc); - this.eq = eq; - this.primaryHead = primaryHead; - } - - /** - * @see pcgen.core.VariableProcessor#lookupVariable(java.lang.String, java.lang.String, pcgen.core.spell.Spell) - */ - Float lookupVariable(String element, String src, Spell spell) - { + /** + * Create a new VariableProcessorEq instance for an equipment item, and pc. It + * also allows splitting of the processing of the heads of double weapons. + * + * @param eq The item of equipment being processed. + * @param pc The player character being processed. + * @param primaryHead Is this the primary head of a double weapon? + */ + public VariableProcessorEq(Equipment eq, PlayerCharacter pc, boolean primaryHead) { + super(pc); + this.eq = eq; + this.primaryHead = primaryHead; + } + + /** + * @see pcgen.core.VariableProcessor#lookupVariable(java.lang.String, java.lang.String, pcgen.core.spell.Spell) + */ + Float lookupVariable(String element, String src, Spell spell) + { Float retVal = null; - if (getPc().hasVariable(element)) + if (getPc().hasVariable(element)) { final Float value = getPc().getVariable(element, true, true, src, "", decrement); Logging.debugPrint(jepIndent + "variable for: '" + element + "' = " + value); retVal = new Float(value.doubleValue()); } - - if (retVal==null) { + + if (retVal==null) { final String foo = getInternalVariable(spell, element, src); if (foo != null) { @@ -80,19 +80,19 @@ } catch (NumberFormatException nfe) { - // What we got back was not a number + // What we got back was not a number } if (d != null) { if (!d.isNaN()) { - retVal = d; + retVal = d; Logging.debugPrint(jepIndent + "internal variable for: '" + element + "' = " + d); } } } } - - if (retVal==null) { + + if (retVal==null) { final String foo = getExportVariable(element); if (foo != null) { @@ -103,55 +103,55 @@ } catch (NumberFormatException nfe) { - // What we got back was not a number + // What we got back was not a number } if (d != null) { if (!d.isNaN()) { - retVal = d; + retVal = d; Logging.debugPrint(jepIndent + "export variable for: '" + element + "' = " + d); } } } - } - - return retVal; - } + } - - /** - * Retrieve a pre-coded variable for a piece of equipment. These are known properties of - * all equipment items. If a value is not found for the equipment item, a search will be - * made of the character. - * + return retVal; + } + + + /** + * Retrieve a pre-coded variable for a piece of equipment. These are known properties of + * all equipment items. If a value is not found for the equipment item, a search will be + * made of the character. + * * @param aSpell This is specifically to compute bonuses to CASTERLEVEL for a specific spell. - * @param valString The variable to be evaluated - * @param src The source within which the variable is evaluated - * @return The value of the variable - */ - public String getInternalVariable(final Spell aSpell, String valString, final String src) - { - String retVal = null; + * @param valString The variable to be evaluated + * @param src The source within which the variable is evaluated + * @return The value of the variable + */ + public String getInternalVariable(final Spell aSpell, String valString, final String src) + { + String retVal = null; if ("SIZE".equals(valString)) { - retVal = String.valueOf(eq.sizeInt()); + retVal = String.valueOf(eq.sizeInt()); } else if (valString.startsWith("EQUIP.SIZE")) { if (valString.equals("EQUIP.SIZE")) { - retVal = eq.getSize(); + retVal = eq.getSize(); } else if (valString.substring(11).equals("INT")) { - retVal = String.valueOf(eq.sizeInt()); + retVal = String.valueOf(eq.sizeInt()); } } else if ("WT".equals(valString)) { if (eq.isCalculatingCost() && eq.isWeightAlreadyUsed()) { - retVal = "0"; + retVal = "0"; } else { @@ -162,7 +162,7 @@ } else { - retVal = String.valueOf(eq.getWeightInPounds()); + retVal = String.valueOf(eq.getWeightInPounds()); } eq.setWeightAlreadyUsed( true ); @@ -170,7 +170,7 @@ } else if ("BASECOST".equals(valString)) { - retVal = eq.getBaseCost().toString(); + retVal = eq.getBaseCost().toString(); } else if ("DMGDIE".equals(valString)) { @@ -184,29 +184,29 @@ } else if ("EQACCHECK".equals(valString)) { - retVal = eq.getAcCheck().toString(); + retVal = eq.getAcCheck().toString(); } else if ("EQHANDS".equals(valString)) { - retVal = Integer.toString(eq.getSlots()); + retVal = Integer.toString(eq.getSlots()); } else if ("EQSPELLFAIL".equals(valString)) { - retVal = eq.getSpellFailure().toString(); + retVal = eq.getSpellFailure().toString(); } else if ("RANGE".equals(valString)) { - retVal = eq.getRange().toString(); + retVal = eq.getRange().toString(); } else if ("CRITMULT".equals(valString)) { if (primaryHead) { - retVal = String.valueOf(eq.getCritMultiplier()); + retVal = eq.getCritMult(); } else { - retVal = String.valueOf(eq.getAltCritMultiplier()); + retVal = eq.getAltCritMult(); } } else @@ -215,19 +215,19 @@ { if (valString.equals(SettingsHandler.getGame().s_ATTRIBSHORT[j])) { - retVal = String.valueOf(getPc().getStatList().getStatModFor(SettingsHandler.getGame().s_ATTRIBSHORT[j])); + retVal = String.valueOf(getPc().getStatList().getStatModFor(SettingsHandler.getGame().s_ATTRIBSHORT[j])); break; } } } - if (retVal==null) + if (retVal==null) { - // we have not managed to find an internal variable for the equipment, so try to find - // one for the character. - VariableProcessorPC vpc = new VariableProcessorPC(getPc()); - retVal = vpc.getInternalVariable(aSpell, valString, src); + // we have not managed to find an internal variable for the equipment, so try to find + // one for the character. + VariableProcessorPC vpc = new VariableProcessorPC(getPc()); + retVal = vpc.getInternalVariable(aSpell, valString, src); } return retVal; - } + } } Modified: Trunk/pcgen/code/src/java/pcgen/gui/tabs/InfoEquipping.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/gui/tabs/InfoEquipping.java 2006-04-04 03:18:51 UTC (rev 596) +++ Trunk/pcgen/code/src/java/pcgen/gui/tabs/InfoEquipping.java 2006-04-04 04:46:19 UTC (rev 597) @@ -732,7 +732,7 @@ { b.append(" <b>Crit Mult</b>:").append(bString); - if (eqI.isDouble() && !eqI.getCritMult().equals(eqI.getAltCritMult())) + if (eqI.isDouble() && !(eqI.getCritMultiplier() == eqI.getAltCritMultiplier())) { b.append('/').append(eqI.getAltCritMult()); } @@ -1263,7 +1263,7 @@ public void singleClickEvent() { // Do Nothing } - + public void doubleClickEvent() { addEquipButton(new Float(1)); @@ -1279,7 +1279,7 @@ public void singleClickEvent() { // Do Nothing } - + public void doubleClickEvent() { // We run this after the event has been processed so that @@ -3210,10 +3210,10 @@ } buildTopPanel(); - + buildBottomPanel(); } - + private void buildTopPanel() { // build topPane which will contain leftPane and rightPane // leftPane will have two panels and a scrollregion @@ -3266,7 +3266,7 @@ new TableColumnManager(selectedTable, columnButton2, selectedModel); rightPane.add(scrollPane2, BorderLayout.CENTER); - + JPanel bottomRightPane = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 1)); Utility.setDescription(setNoteButton, "Add additional info to this item"); setNoteButton.setEnabled(false); @@ -3280,7 +3280,7 @@ delEquipButton.setEnabled(false); bottomRightPane.add(delEquipButton); rightPane.add(bottomRightPane, BorderLayout.SOUTH); - + // add the sorter tables to that clicking on the TableHeader // actualy does something (gawd damn it's slow!) availableSort = new JTreeTableSorter(availableTable, (MyPONode) availableModel.getRoot(), availableModel); @@ -3390,9 +3390,9 @@ // now add the entire mess (centered of course) this.setLayout(new BorderLayout()); - this.add(bsplit, BorderLayout.CENTER); + this.add(bsplit, BorderLayout.CENTER); } - + private final List locationChoices(Equipment eqI, List containers) { // Some Equipment locations are based on the number of hands @@ -4776,7 +4776,7 @@ for (Iterator fI = pc.getEquipmentMasterList().iterator(); fI.hasNext();) { final Equipment aEq = (Equipment) fI.next(); - if (qFilter == null || + if (qFilter == null || ( aEq.getName().toLowerCase().indexOf(qFilter) >= 0 || aEq.getType().toLowerCase().indexOf(qFilter) >= 0 )) { @@ -4892,7 +4892,7 @@ } return colNameList; } - + private int[] getWidthList() { int[] colWidthList = null; if(modelType == MODEL_AVAIL) { @@ -4937,7 +4937,7 @@ String[] colNameList = getNameList(); SettingsHandler.setPCGenOption("InfoEquipping.sizecol." + modelType + "." + colNameList[col], width); } - + public void resetMColumn(int num, TableColumn column) { if(modelType == MODEL_AVAIL) { // TODO Do Nothing? @@ -4960,11 +4960,11 @@ } } } - + private boolean getColumnViewOption(String colName, boolean defaultVal) { return SettingsHandler.getPCGenOption("InfoEquipping.viewcol." + modelType + "." + colName, defaultVal); } - + private void setColumnViewOption(String colName, boolean val) { SettingsHandler.setPCGenOption("InfoEquipping.viewcol." + modelType + "." + colName, val); } Modified: Trunk/pcgen/code/src/java/pcgen/gui/tabs/InfoGear.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/gui/tabs/InfoGear.java 2006-04-04 03:18:51 UTC (rev 596) +++ Trunk/pcgen/code/src/java/pcgen/gui/tabs/InfoGear.java 2006-04-04 04:46:19 UTC (rev 597) @@ -229,7 +229,7 @@ // private static final int EQUIPMENT_EQUIPPED = 2; // private static final int EQUIPMENT_CONTAINED = 3; // Right-click inventory item - + private PlayerCharacter pc; private int serial = 0; @@ -711,7 +711,7 @@ { b.append(" <b>Crit Mult</b>:").append(bString); - if (aEq.isDouble() && !aEq.getCritMult().equals(aEq.getAltCritMult())) + if (aEq.isDouble() && !(aEq.getCritMultiplier() == aEq.getAltCritMultiplier())) { b.append('/').append(aEq.getAltCritMult()); } @@ -747,8 +747,8 @@ { b.append(" <b>Charges</b>:").append(charges); } - - bString = aEq.getQualityString(); + + bString = aEq.getQualityString(); if (bString.length() > 0) { b.append(" <b>QUALITIES</b>:").append(bString); @@ -772,9 +772,9 @@ /** * This method performs the actual adjustment of the character's * equipment - * + * * Do NOT modify the equipment set directly or from any method other than this one - * + * * Method overhauled March, 2003 by sage_sam as part of FREQ 606205 * * @param equipItemToAdjust Equipment item selected to update @@ -1174,11 +1174,11 @@ } /** - * Build the panel with the controls to add an item to the + * Build the panel with the controls to add an item to the * selected list. * @param button - * @param title - * + * @param title + * * @return The panel. */ private JPanel buildModPanel(JButton button, String title) @@ -1194,11 +1194,11 @@ } /** - * Build the panel with the controls to add an item to the + * Build the panel with the controls to add an item to the * selected list. - * @param button - * @param title - * + * @param button + * @param title + * * @return The panel. */ private JPanel buildDelPanel(JButton button, String title) @@ -1225,7 +1225,7 @@ autoSort.setSelected(pc.getAutoSpells()); riPanel.add(autoSort); - + Utility.setDescription(autoSort, PropertyFactory.getString("InfoSpells.add.selected")); //$NON-NLS-1$ autoSort.setEnabled(true); autoSort.setMargin(new Insets(1, 14, 1, 14)); @@ -1265,7 +1265,7 @@ public void singleClickEvent() { // Do Nothing } - + public void doubleClickEvent() { buyOneListener.actionPerformed(null); @@ -1281,7 +1281,7 @@ public void singleClickEvent() { // Do Nothing } - + public void doubleClickEvent() { SwingUtilities.invokeLater(sellOneRunnable); @@ -2002,7 +2002,7 @@ JLabel avaLabel = new JLabel("Available: "); leftPane.add(InfoTabUtils.createFilterPane(avaLabel, viewComboBox, lblAvailableQFilter, textAvailableQFilter, clearAvailableQFilterButton), BorderLayout.NORTH); - + JScrollPane scrollPane = new JScrollPane(availableTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); leftPane.add(scrollPane, BorderLayout.CENTER); @@ -2383,7 +2383,7 @@ clearAvailableQFilterButton.setEnabled(true); viewComboBox.setEnabled(false); forceRefresh(); - + } private void setSelectedQFilter() @@ -3199,10 +3199,10 @@ /** * OutputOrderRenderer is a small extension of the standard JLabel based * table cell renderer that allows it to interpret a few special values - * + * * -1 shows as Hidden, and 0 is shown as blank. Any other value is * displayed as is. - * + * * @deperecated Check with Zaister before removing this class */ private static final class OutputOrderRenderer extends DefaultTableCellRenderer @@ -3296,7 +3296,7 @@ displayList.add(new Boolean(getColumnViewOption(modelType + "." + names[i++], true))); displayList.add(new Boolean(getColumnViewOption(modelType + "." + names[i++], true))); displayList.add(new Boolean(getColumnViewOption(modelType + "." + names[i++], false))); - } + } } public boolean isCellEditable(Object node, int column) { @@ -3320,7 +3320,7 @@ case COL_WEIGHT: return Float.class; - + case COL_QTY: return Float.class; @@ -3357,7 +3357,7 @@ * @param column * @return column name */ - public String getColumnName(int column) + public String getColumnName(int column) { return names[column]; } @@ -3388,21 +3388,21 @@ case COL_NAME: retVal = fn.toString(); break; - + case COL_COST: if (eq != null) { retVal = eq.getCost(pc); } break; - + case COL_WEIGHT: if (eq != null) { retVal = eq.getWeight(pc); } break; - + case COL_QTY: if (eq != null) { @@ -3432,10 +3432,10 @@ return retVal; } - /** + /** * "There can be only one" There must be a root object, though it can be hidden * to make it's existence basically a convenient way to keep track of the objects - * + * * @param aNode */ private void setRoot(PObjectNode aNode) { @@ -3788,8 +3788,8 @@ while (fI.hasNext()) { final Equipment aEq = (Equipment) fI.next(); - if (qFilter == null || - ( aEq.getName().toLowerCase().indexOf(qFilter) >= 0 || + if (qFilter == null || + ( aEq.getName().toLowerCase().indexOf(qFilter) >= 0 || aEq.getType().toLowerCase().indexOf(qFilter) >= 0 )) { addItemToModel(aEq, false); @@ -3829,7 +3829,7 @@ /** * Get the column align list - * @return the column align list + * @return the column align list */ public List getMColumnAlignList() { @@ -3868,14 +3868,14 @@ private boolean getColumnViewOption(String colName, boolean defaultVal) { return SettingsHandler.getPCGenOption("InfoGear.viewcol." + colName, defaultVal); } - + private void setColumnViewOption(String colName, boolean val) { SettingsHandler.setPCGenOption("InfoGear.viewcol." + colName, val); } public void resetMColumn(int col, TableColumn column) { // TODO Auto-generated method stub - + } } Modified: Trunk/pcgen/code/src/java/pcgen/io/exporttoken/WeaponToken.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/io/exporttoken/WeaponToken.java 2006-04-04 03:18:51 UTC (rev 596) +++ Trunk/pcgen/code/src/java/pcgen/io/exporttoken/WeaponToken.java 2006-04-04 04:46:19 UTC (rev 597) @@ -490,7 +490,7 @@ } else if (token.equals("ISLIGHT")) { - return getIsLightToken(pc, eq); + return getIsLightToken(pc, eq); } return ""; } @@ -503,7 +503,7 @@ */ public static String getIsLightToken(PlayerCharacter pc, Equipment eq) { - return Globals.isWeaponLightForPC(pc, eq) ? "TRUE" : "FALSE"; + return Globals.isWeaponLightForPC(pc, eq) ? "TRUE" : "FALSE"; } /** @@ -707,17 +707,8 @@ int mult = (int) pc.getTotalBonusTo("WEAPONPROF=" + eq.profName(pc), "CRITMULTADD") + getWeaponProfTypeBonuses(pc, eq, "CRITMULTADD", WPTYPEBONUS_PC); - int critMult; + int critMult = eq.getCritMultiplier(); - try - { - critMult = Integer.parseInt(eq.getCritMult().substring(1)); - } - catch (Exception e) - { - critMult = 0; - } - sb.append((critMult + mult) + ""); int altCrit = eq.getAltCritMultiplier(); @@ -1635,15 +1626,15 @@ private static String getToHit(PlayerCharacter pc, - Equipment eq, - String profName, - int range, - int content, - int ammo, - int hands, - int hitMode, - int attackNum, - boolean totalHit) + Equipment eq, + String profName, + int range, + int content, + int ammo, + int hands, + int hitMode, + int attackNum, + boolean totalHit) { boolean isDouble = (eq.isDouble() && (eq.getLocation() == Equipment.EQUIPPED_TWO_HANDS)); boolean isDoubleSplit = (eq.isType("Head1") || eq.isType("Head2")); @@ -1736,7 +1727,7 @@ baseBonus = 0; } else if ( hitMode == HITMODE_TWPHITH || - hitMode == HITMODE_TWPHITL) + hitMode == HITMODE_TWPHITL) { // TWF Primary hand baseBonus = -6; @@ -1901,7 +1892,7 @@ if (range < rangeSize) { // at short range, add SHORTRANGE bonus - if (thisRange <= shortRange) + if (thisRange <= shortRange) { baseBonus += (int) pc.getTotalBonusTo("COMBAT", "TOHIT-SHORTRANGE"); baseBonus += (int) pc.getTotalBonusTo("TOHIT", "SHORTRANGE"); @@ -2036,7 +2027,7 @@ int secondariesToadd = 1 + (int) pc.getTotalBonusTo("COMBAT", "ATTACKS-SECONDARY"); - /* + /* * The data team wishes to keep the old syntax for secondary attacks. * The docs have been updated to reflect this. The new syntax (with * the hyphen, see above) is not used in the repository. This comment @@ -2438,8 +2429,8 @@ /* This modifies damage (by size) from the default when the race is * not the default size and the character is the default size for * their race */ - boolean applySize = (eqSize == iMod); - String uDamString = pc.getUnarmedDamageString(false, false, applySize); + boolean applySize = (eqSize == iMod); + String uDamString = pc.getUnarmedDamageString(false, false, applySize); StringTokenizer bTok = new StringTokenizer(damString, " d+-", false); bTok.nextToken(); @@ -2463,21 +2454,21 @@ iMod += (int) pc.getTotalBonusTo("WEAPONPROF=Unarmed Strike", "DAMAGESIZE"); iMod += (int) pc.getTotalBonusTo("COMBAT", "DAMAGESIZE"); - /* If not applying the race size modifier, then damString will - * represent the damage as if this Character were the default - * size. Set eqSize to adjust from damage for the default size, - * not the race's actual size. - */ - if (!applySize) - { + /* If not applying the race size modifier, then damString will + * represent the damage as if this Character were the default + * size. Set eqSize to adjust from damage for the default size, + * not the race's actual size. + */ + if (!applySize) + { final SizeAdjustment defAdj = SettingsHandler.getGame().getDefaultSizeAdjustment(); if (defAdj != null) { - eqSize = Globals.sizeInt(defAdj.getAbbreviation()); - } - } + eqSize = Globals.sizeInt(defAdj.getAbbreviation()); + } + } - damString = Globals.adjustDamage(damString, eqSize, iMod); + damString = Globals.adjustDamage(damString, eqSize, iMod); } return damString; } Modified: Trunk/pcgen/code/src/java/pcgen/io/exporttoken/WeaponhToken.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/io/exporttoken/WeaponhToken.java 2006-04-04 03:18:51 UTC (rev 596) +++ Trunk/pcgen/code/src/java/pcgen/io/exporttoken/WeaponhToken.java 2006-04-04 04:46:19 UTC (rev 597) @@ -33,7 +33,7 @@ /** * <code>WeaponhToken</code>. - * + * * @author binkley * @version $Revision$ */ @@ -41,10 +41,10 @@ { /** Weaponh token */ public static final String TOKEN_NAME = "WEAPONH"; - + /** * Gets the token name - * + * * @return The token name. * @see pcgen.io.exporttoken.Token#getTokenName() */ @@ -87,11 +87,11 @@ /** * Create a fake Unarmed Strike equipment so we don't need it in the .lst files anymore - * + * * @param pc The character used to generate the size. * @return The Unarmed Strike equipment. */ - public static Equipment getWeaponEquipment(PlayerCharacter pc) + public static Equipment getWeaponEquipment(PlayerCharacter pc) { // Creating a fake Unarmed Strike equipment so we // don't need it in the .lst files anymore @@ -103,7 +103,7 @@ eq.setCost("0", true); eq.setWeight("0"); eq.setDamage("1d1"); - eq.setCritMult("x2"); + eq.setCritMult(2); eq.setCritRange("1"); eq.setModifiersAllowed(false); eq.setModifiersRequired(false); Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/NaturalattacksLst.java =================================================================== --- Trunk/pcgen/code/src/java/plugin/lsttokens/NaturalattacksLst.java 2006-04-04 03:18:51 UTC (rev 596) +++ Trunk/pcgen/code/src/java/plugin/lsttokens/NaturalattacksLst.java 2006-04-04 04:46:19 UTC (rev 597) @@ -151,7 +151,7 @@ anEquip.setDamage(aTok.nextToken()); anEquip.setCritRange("1"); - anEquip.setCritMult("x2"); + anEquip.setCritMult(2); anEquip.setProfName(attackName); // sage_sam 02 Dec 2002 for Bug #586332 Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/equipment/AltcriticalToken.java =================================================================== --- Trunk/pcgen/code/src/java/plugin/lsttokens/equipment/AltcriticalToken.java 2006-04-04 03:18:51 UTC (rev 596) +++ Trunk/pcgen/code/src/java/plugin/lsttokens/equipment/AltcriticalToken.java 2006-04-04 04:46:19 UTC (rev 597) @@ -4,7 +4,7 @@ import pcgen.persistence.lst.EquipmentLstToken; /** - * Deals with ALTCRITICAL token + * Deals with ALTCRITICAL token */ public class AltcriticalToken implements EquipmentLstToken { @@ -12,8 +12,26 @@ return "ALTCRITICAL"; } - public boolean parse(Equipment eq, String value) { - eq.setAltCritMult(value); - return true; + public boolean parse(Equipment eq, String value) + { + if ((value.length() > 0) && (value.charAt(0) == 'x')) + { + try + { + eq.setAltCritMult(Integer.parseInt(value.substring(1))); + } + catch (NumberFormatException nfe) + { + return false; + } + return true; + } + else if (value.equals("-")) + { + eq.setAltCritMult(-1); + return true; + } + return false; } + } Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/equipment/AltcritmultToken.java =================================================================== --- Trunk/pcgen/code/src/java/plugin/lsttokens/equipment/AltcritmultToken.java 2006-04-04 03:18:51 UTC (rev 596) +++ Trunk/pcgen/code/src/java/plugin/lsttokens/equipment/AltcritmultToken.java 2006-04-04 04:46:19 UTC (rev 597) @@ -4,7 +4,7 @@ import pcgen.persistence.lst.EquipmentLstToken; /** - * Deals with ALTCRITMULT token + * Deals with ALTCRITMULT token */ public class AltcritmultToken implements EquipmentLstToken { @@ -12,8 +12,25 @@ return "ALTCRITMULT"; } - public boolean parse(Equipment eq, String value) { - eq.setAltCritMult(value); - return true; + public boolean parse(Equipment eq, String value) + { + if ((value.length() > 0) && (value.charAt(0) == 'x')) + { + try + { + eq.setAltCritMult(Integer.parseInt(value.substring(1))); + } + catch (NumberFormatException nfe) + { + return false; + } + return true; + } + else if (value.equals("-")) + { + eq.setAltCritMult(-1); + return true; + } + return false; } } Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/equipment/CritmultToken.java =================================================================== --- Trunk/pcgen/code/src/java/plugin/lsttokens/equipment/CritmultToken.java 2006-04-04 03:18:51 UTC (rev 596) +++ Trunk/pcgen/code/src/java/plugin/lsttokens/equipment/CritmultToken.java 2006-04-04 04:46:19 UTC (rev 597) @@ -4,7 +4,7 @@ import pcgen.persistence.lst.EquipmentLstToken; /** - * Deals with CRITMULT token + * Deals with CRITMULT token */ public class CritmultToken implements EquipmentLstToken { @@ -12,8 +12,25 @@ return "CRITMULT"; } - public boolean parse(Equipment eq, String value) { - eq.setCritMult(value); - return true; + public boolean parse(Equipment eq, String value) + { + if ((value.length() > 0) && (value.charAt(0) == 'x')) + { + try + { + eq.setCritMult(Integer.parseInt(value.substring(1))); + } + catch (NumberFormatException nfe) + { + return false; + } + return true; + } + else if (value.equals("-")) + { + eq.setCritMult(-1); + return true; + } + return false; } } Modified: Trunk/pcgen/code/src/test/pcgen/io/exporttoken/WeaponTokenTest.java =================================================================== --- Trunk/pcgen/code/src/test/pcgen/io/exporttoken/WeaponTokenTest.java 2006-04-04 03:18:51 UTC (rev 596) +++ Trunk/pcgen/code/src/test/pcgen/io/exporttoken/WeaponTokenTest.java 2006-04-04 04:46:19 UTC (rev 597) @@ -116,11 +116,11 @@ // Class PCClass myClass = new PCClass(); myClass.setName("My Class"); - myClass.setAbbrev("Myc"); + myClass.setAbbrev("Myc"); myClass.setSkillPointFormula("3"); - final BonusObj babClassBonus = Bonus.newBonus("1|COMBAT|BAB|CL+15"); - myClass.addBonusList(babClassBonus); - Globals.getClassList().add(myClass); + final BonusObj babClassBonus = Bonus.newBonus("1|COMBAT|BAB|CL+15"); + myClass.addBonusList(babClassBonus); + Globals.getClassList().add(myClass); character.incrementClassLevel(1, myClass, true); @@ -131,8 +131,8 @@ dblWpn.setTypeInfo("Weapon.Melee.Martial.Double.Standard.Bludgeoning.Flail"); dblWpn.setDamage("1d10"); dblWpn.setAltDamage("1d6"); - dblWpn.setCritMult("x2"); - dblWpn.setAltCritMult("x2"); + dblWpn.setCritMult(2); + dblWpn.setAltCritMult(2); dblWpn.setCritRange("1"); dblWpn.setAltCritRange("1"); dblWpn.setSlots(2); @@ -151,7 +151,7 @@ bastardSword.setProfName("Sword (Bastard/[Hands])"); bastardSword.setTypeInfo("Weapon.Melee.Martial.Exotic.Standard.Slashing.Sword"); bastardSword.setDamage("1d10"); - bastardSword.setCritMult("x2"); + bastardSword.setCritMult(2); bastardSword.setCritRange("2"); bastardSword.setWield("TwoHanded"); bastardSword.setSize("M", true); @@ -179,7 +179,7 @@ largeSword.setProfName("Longsword"); largeSword.setTypeInfo("Weapon.Melee.Martial.Standard.Slashing.Sword"); largeSword.setDamage("1d10"); - largeSword.setCritMult("x2"); + largeSword.setCritMult(2); largeSword.setCritRange("2"); largeSword.setWield("OneHanded"); largeSword.setSize("L", true); @@ -196,7 +196,7 @@ fineSword.setProfName("Longsword"); fineSword.setTypeInfo("Weapon.Melee.Martial.Standard.Slashing.Sword.Finesseable"); fineSword.setDamage("1d10"); - fineSword.setCritMult("x2"); + fineSword.setCritMult(2); fineSword.setCritRange("2"); fineSword.setWield("OneHanded"); fineSword.setSize("M", true); @@ -222,7 +222,7 @@ bite.setNumberCarried(new Float(1)); bite.setAttacksProgress(false); bite.setDamage("1d10"); - bite.setCritMult("x2"); + bite.setCritMult(2); bite.setCritRange("2"); bite.setWield("OneHanded"); bite.setProfName("SillyBite"); @@ -542,8 +542,8 @@ } /** - * Test the processing of a finesseable weapon both with and without weapon finesse - * and temporary bonuses. + * Test the processing of a finesseable weapon both with and without weapon finesse + * and temporary bonuses. */ public void testWpnFinesse() { @@ -574,7 +574,7 @@ character.addFeat(wpnFinesse, null); assertEquals("Fine sword", "+19/+14/+9/+4", token .getToken("WEAPON.3.BASEHIT", character, null)); - + // Add a temp penalty to dex and check that it is applied character.setUseTempMods(true); Spell spell2 = new Spell(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |