From: <jde...@us...> - 2007-03-31 01:08:03
|
Revision: 2620 http://svn.sourceforge.net/pcgen/?rev=2620&view=rev Author: jdempsey Date: 2007-03-30 18:08:04 -0700 (Fri, 30 Mar 2007) Log Message: ----------- Fix bug: KIT Ability Token Does Not Add Ability Issue#: 1690345 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java Trunk/pcgen/code/src/java/pcgen/core/kit/KitAbilities.java Modified: Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java 2007-03-30 02:32:53 UTC (rev 2619) +++ Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java 2007-03-31 01:08:04 UTC (rev 2620) @@ -635,6 +635,12 @@ aPC.addAbility(category, pcAbility, levelInfo); pcAbility.getTemplates(aPC.isImporting(), aPC); } + if (pcAbility == null) + { + Logging.errorPrint("Can't process ability " + argAbility + " not present in character."); + return create ? 1 : 0; + } + return finaliseAbility(pcAbility, choice, aPC, create, true, category); } Modified: Trunk/pcgen/code/src/java/pcgen/core/kit/KitAbilities.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/kit/KitAbilities.java 2007-03-30 02:32:53 UTC (rev 2619) +++ Trunk/pcgen/code/src/java/pcgen/core/kit/KitAbilities.java 2007-03-31 01:08:04 UTC (rev 2620) @@ -23,11 +23,14 @@ package pcgen.core.kit; import java.io.Serializable; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; + import pcgen.core.Ability; +import pcgen.core.AbilityCategory; import pcgen.core.AbilityInfo; import pcgen.core.AbilityStore; import pcgen.core.AbilityUtilities; @@ -35,6 +38,7 @@ import pcgen.core.Globals; import pcgen.core.Kit; import pcgen.core.PlayerCharacter; +import pcgen.core.SettingsHandler; /** * <code>KitAbiltiies</code>. @@ -152,6 +156,7 @@ final HashMap<String, AbilityInfo> nameMap = new HashMap<String, AbilityInfo>(); final HashMap<String, AbilityInfo> catMap = new HashMap<String, AbilityInfo>(); boolean useNameMap = true; + AbilityCategory abilityCat = AbilityCategory.FEAT; for (Iterator<Categorisable> kAbInnerIt = getIterator(); kAbInnerIt.hasNext();) { @@ -166,6 +171,9 @@ { AbilityInfo abI = nameMap.put(Info.toString(), Info); catMap.put(Info.getCategory() + " " + Info.toString(), Info); + abilityCat = + SettingsHandler.getGame().getAbilityCategory( + Info.getCategory()); if (abI != null) { @@ -194,10 +202,14 @@ boolean tooManyAbilities = false; int abilitiesChosen = 0; - // Don't allow choosing of more than allotted number of feats - if (!free && (numberOfChoices > ((int) aPC.getFeats() - abilitiesChosen))) + // Don't allow choosing of more than allotted number of abilities + if (!free + && (numberOfChoices > (aPC.getAvailableAbilityPool(abilityCat) + .intValue() - abilitiesChosen))) { - numberOfChoices = (int) aPC.getFeats() - abilitiesChosen; + numberOfChoices = + aPC.getAvailableAbilityPool(abilityCat).intValue() + - abilitiesChosen; tooManyAbilities = true; } @@ -247,12 +259,29 @@ { abilitiesToAdd.add(ability); ++abilitiesChosen; + final AbilityCategory abilityCategory = + SettingsHandler.getGame().getAbilityCategory( + ability.getCategory()); if (free) { // Need to pay for it first - aPC.adjustFeats(1); + if (free) + { + aPC.adjustAbilities(abilityCategory, new BigDecimal(1)); + } } - AbilityUtilities.modFeat(aPC, null, ability.toString(), true, false); + Iterator<String> choicesIter = ability.getChoicesIterator(); + String abChoice = ""; + do + { + if (choicesIter.hasNext()) + { + abChoice = choicesIter.next(); + } + AbilityUtilities.modAbility(aPC, null, + ability.getAbility(), abChoice, true, abilityCategory); + } + while (choicesIter.hasNext()); } else { @@ -273,11 +302,25 @@ { for ( AbilityInfo ability : abilitiesToAdd ) { - AbilityUtilities.modFeat(aPC, null, ability.toString(), true, false); + final AbilityCategory abilityCategory = + SettingsHandler.getGame().getAbilityCategory( + ability.getCategory()); + Iterator<String> choicesIter = ability.getChoicesIterator(); + String choice = ""; + do + { + if (choicesIter.hasNext()) + { + choice = choicesIter.next(); + } + AbilityUtilities.modAbility(aPC, null, ability.getAbility(), + choice, true, abilityCategory); + } + while (choicesIter.hasNext()); if (free) { - aPC.adjustFeats(1); + aPC.adjustAbilities(abilityCategory, new BigDecimal(1)); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jde...@us...> - 2007-05-08 09:31:17
|
Revision: 2880 http://svn.sourceforge.net/pcgen/?rev=2880&view=rev Author: jdempsey Date: 2007-05-08 02:31:18 -0700 (Tue, 08 May 2007) Log Message: ----------- Fix bug: PCGen does not save Character Stat Generation Issue#: 1706387 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/SettingsHandler.java Trunk/pcgen/code/src/java/pcgen/core/utils/SortedProperties.java Modified: Trunk/pcgen/code/src/java/pcgen/core/SettingsHandler.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/SettingsHandler.java 2007-05-08 05:04:32 UTC (rev 2879) +++ Trunk/pcgen/code/src/java/pcgen/core/SettingsHandler.java 2007-05-08 09:31:18 UTC (rev 2880) @@ -696,7 +696,7 @@ { game = newMode; } - String key = convertStringToKey(g); + String key = g; // new key for game mode specific options are pcgen.options.gameMode.X.optionName // but offer downward compatible support to read in old version for unitSet from 5.8.0 String unitSetName = getOptions().getProperty("pcgen.options.gameMode." + key + ".unitSetName", @@ -714,20 +714,6 @@ game.setRollMethod(getPCGenOption("gameMode." + key + ".rollMethod", 0)); //$NON-NLS-1$ } - /** - * Convert the supplied string into a property key, escaping any - * terminator characters within the string. - * @param rawKey The text to be converted - * @return The valid properties key - */ - private static String convertStringToKey(String rawKey) - { - String key = rawKey.replaceAll(" ", "\\\\ "); - key = key.replaceAll(":", "\\\\:"); - key = key.replaceAll("=", "\\\\="); - return key; - } - public static GameMode getGame() { return game; @@ -1490,7 +1476,7 @@ for (int idx = 0; idx < SystemCollections.getUnmodifiableGameModeList().size(); idx++) { final GameMode gameMode = SystemCollections.getUnmodifiableGameModeList().get(idx); - String gameModeKey = convertStringToKey(gameMode.getName()); + String gameModeKey = gameMode.getName(); if (gameMode.getUnitSet() != null && gameMode.getUnitSet().getName() != null) { setPCGenOption("gameMode." + gameModeKey + ".unitSetName", gameMode.getUnitSet().getName()); Modified: Trunk/pcgen/code/src/java/pcgen/core/utils/SortedProperties.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/utils/SortedProperties.java 2007-05-08 05:04:32 UTC (rev 2879) +++ Trunk/pcgen/code/src/java/pcgen/core/utils/SortedProperties.java 2007-05-08 09:31:18 UTC (rev 2880) @@ -70,7 +70,7 @@ // The following characters must be escaped: // #, !, = and : final String aString = fixUp((String) entry.getValue()); - bw.write(entry.getKey() + "=" + aString); + bw.write(convertStringToKey((String) entry.getKey()) + "=" + aString); bw.newLine(); } @@ -123,4 +123,19 @@ return ab.toString(); } + + /** + * Convert the supplied string into a property key, escaping any + * terminator characters within the string. + * @param rawKey The text to be converted + * @return The valid properties key + */ + private static String convertStringToKey(String rawKey) + { + String key = rawKey.replaceAll(" ", "\\\\ "); + key = key.replaceAll(":", "\\\\:"); + key = key.replaceAll("=", "\\\\="); + return key; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jde...@us...> - 2007-09-03 21:36:54
|
Revision: 3982 http://pcgen.svn.sourceforge.net/pcgen/?rev=3982&view=rev Author: jdempsey Date: 2007-09-03 14:36:51 -0700 (Mon, 03 Sep 2007) Log Message: ----------- Fix bug: Skill Mod Breakdown Incorrect Issue#: 1787102 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/Skill.java Trunk/pcgen/code/src/java/pcgen/core/bonus/BonusObj.java Modified: Trunk/pcgen/code/src/java/pcgen/core/Skill.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/Skill.java 2007-09-03 21:30:36 UTC (rev 3981) +++ Trunk/pcgen/code/src/java/pcgen/core/Skill.java 2007-09-03 21:36:51 UTC (rev 3982) @@ -1596,16 +1596,18 @@ * * @param aPC The character associated with this skill. * @param shortForm True if the abbreviated form should be used. - * @return The explaination fo the misc modifier's make-up. + * @return The explanation of the misc modifier's make-up. */ public String getModifierExplanation(final PlayerCharacter aPC, final boolean shortForm) { double bonusObjTotal = 0.0; final StringBuffer bonusDetails = new StringBuffer(); - for ( BonusObj bonus : getBonusList() ) + for ( BonusObj bonus : aPC.getActiveBonusList() ) { final double bonusVal = bonus.getCalculatedValue(aPC); - if (bonus.isApplied() && !CoreUtility.doublesEqual(bonusVal,0.0) && !"VAR".equals(bonus.getBonusName())) + if (bonus.isApplied() && !CoreUtility.doublesEqual(bonusVal, 0.0) + && "SKILL".equals(bonus.getBonusName()) + && bonus.getBonusInfoList().contains(getKeyName().toUpperCase())) { if (bonusDetails.length() > 0) { Modified: Trunk/pcgen/code/src/java/pcgen/core/bonus/BonusObj.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/bonus/BonusObj.java 2007-09-03 21:30:36 UTC (rev 3981) +++ Trunk/pcgen/code/src/java/pcgen/core/bonus/BonusObj.java 2007-09-03 21:36:51 UTC (rev 3982) @@ -677,7 +677,7 @@ // if (bEmpty) { - sb.append(getTypeOfBonus()); + sb.append(String.valueOf(getCreatorObject())); } sb.append(']'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jde...@us...> - 2007-10-14 04:31:54
|
Revision: 4266 http://pcgen.svn.sourceforge.net/pcgen/?rev=4266&view=rev Author: jdempsey Date: 2007-10-13 21:31:54 -0700 (Sat, 13 Oct 2007) Log Message: ----------- Fix bug: Template Bug - incrementClassLevel() not passing bypass flag Issue#: 1811224 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/PCClass.java Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java Modified: Trunk/pcgen/code/src/java/pcgen/core/PCClass.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PCClass.java 2007-10-14 01:19:10 UTC (rev 4265) +++ Trunk/pcgen/code/src/java/pcgen/core/PCClass.java 2007-10-14 04:31:54 UTC (rev 4266) @@ -4868,14 +4868,8 @@ } /** - * Adds a level of this class to the current Global PC. + * Adds a level of this class to the character. * - * This method is deeply evil. This instance of the PCClass has been - * assigned to a PlayerCharacter, but the only way we can get from this - * class back to the PlayerCharacter is to get the current global character - * and hope that the caller is only calling this method on a PCClass - * embedded within the current global PC. - * * TODO: Split the PlayerCharacter code out of PCClass (i.e. the level * property). Then have a joining class assigned to PlayerCharacter that * maps PCClass and number of levels in the class. @@ -4892,9 +4886,9 @@ * questions. * @param aPC * The character we are adding the level to. - * @param isLoading - * True if the character is being loaded and prereqs for the - * level should be ignored. + * @param ignorePrereqs + * True if prereqs for the level should be ignored. Used in + * situations such as when the character is being loaded. * @return true or false */ /* @@ -4905,7 +4899,7 @@ */ boolean addLevel(final PCLevelInfo pcLevelInfo, final boolean argLevelMax, final boolean bSilent, final PlayerCharacter aPC, - final boolean isLoading) { + final boolean ignorePrereqs) { // Check to see if we can add a level of this class to the // current character @@ -4913,7 +4907,7 @@ boolean levelMax = argLevelMax; level += 1; - if (!isLoading) { + if (!ignorePrereqs) { // When loading a character, classes are added before feats, so // this test would always fail on loading if feats are required boolean doReturn = false; Modified: Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2007-10-14 01:19:10 UTC (rev 4265) +++ Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2007-10-14 04:31:54 UTC (rev 4266) @@ -14020,7 +14020,7 @@ .getKeyName()); // if we fail to add the level, remove and return if (!pcClassClone.addLevel(playerCharacterLevelInfo, false, - bSilent, this, false)) + bSilent, this, bypassPrereqs)) { removeLevelInfo(pcClassClone.getKeyName()); return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jde...@us...> - 2007-10-14 05:18:18
|
Revision: 4268 http://pcgen.svn.sourceforge.net/pcgen/?rev=4268&view=rev Author: jdempsey Date: 2007-10-13 22:18:20 -0700 (Sat, 13 Oct 2007) Log Message: ----------- Fix Bug: USEUNTRAINED not working >Exclusive to Cross-Class Issue#: 1810564 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java Trunk/pcgen/code/src/java/pcgen/core/Skill.java Modified: Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2007-10-14 04:58:05 UTC (rev 4267) +++ Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2007-10-14 05:18:20 UTC (rev 4268) @@ -13843,7 +13843,8 @@ if (skill.isUntrained() && skill.isExclusive()) { - if (skill.isClassSkill(classList, this)) + if (skill.isClassSkill(classList, this) + || skill.isCrossClassSkill(classList, this)) { UntrainedExclusiveClass = true; } Modified: Trunk/pcgen/code/src/java/pcgen/core/Skill.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/Skill.java 2007-10-14 04:58:05 UTC (rev 4267) +++ Trunk/pcgen/code/src/java/pcgen/core/Skill.java 2007-10-14 05:18:20 UTC (rev 4268) @@ -1484,6 +1484,26 @@ return false; } + /** + * Check if this skill is cross class for any of the list of classes. + * + * @param aList List of classes to be checked + * @param aPC The character we are checking for. + * @return true if it is a cross-class skill for any of the classes. + */ + boolean isCrossClassSkill(final List<PCClass> aList, final PlayerCharacter aPC) + { + for ( PCClass pcClass : aList ) + { + if (isCrossClassSkill(pcClass, aPC)) + { + return true; + } + } + + return false; + } + /** returns the adjustments to rank * @param currentPC TODO * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jde...@us...> - 2007-11-06 21:58:04
|
Revision: 4483 http://pcgen.svn.sourceforge.net/pcgen/?rev=4483&view=rev Author: jdempsey Date: 2007-11-06 13:58:07 -0800 (Tue, 06 Nov 2007) Log Message: ----------- Fix bug: Gear in Kits not correctly added to containers Issue#: 1827149 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java Trunk/pcgen/code/src/java/pcgen/core/kit/KitGear.java Modified: Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2007-11-04 12:20:59 UTC (rev 4482) +++ Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2007-11-06 21:58:07 UTC (rev 4483) @@ -15440,7 +15440,7 @@ * @param eqI * @return EquipSet */ - private EquipSet getEquipSetForItem(EquipSet eSet, Equipment eqI) + public EquipSet getEquipSetForItem(EquipSet eSet, Equipment eqI) { final String rPath = eSet.getIdPath(); Modified: Trunk/pcgen/code/src/java/pcgen/core/kit/KitGear.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/kit/KitGear.java 2007-11-04 12:20:59 UTC (rev 4482) +++ Trunk/pcgen/code/src/java/pcgen/core/kit/KitGear.java 2007-11-06 21:58:07 UTC (rev 4483) @@ -439,7 +439,7 @@ { theTarget = aPC.getEquipmentNamed(theLocation); } - else + else if (theLocation.equalsIgnoreCase("DEFAULT")) { theLocation = ""; } @@ -473,10 +473,28 @@ existing.setQty(existing.qty() + theQty); } + // If the target is null, try and grab it incase it is there now + if (theTarget == null + && !(theLocation.equalsIgnoreCase("DEFAULT") || theLocation + .equalsIgnoreCase("Equipped"))) + { + theTarget = aPC.getEquipmentNamed(theLocation); + //TODO (JD 7Nov07) Resized items get missed by the above call as their name has changed + } + EquipSet eSet = null; + if (theTarget != null) + { + eSet = aPC.getEquipSetForItem(aPC.getEquipSetByIdPath("0.1"), theTarget); + } + if (eSet == null) + { + eSet = aPC.getEquipSetByIdPath("0.1"); + } + // // Equip the item to the default EquipSet. // - aPC.addEquipToTarget(aPC.getEquipSetByIdPath("0.1"), theTarget, + aPC.addEquipToTarget(eSet, theTarget, theLocation, theEquipment, new Float(theQty)); aPC.setGold(aPC.getGold().subtract(theCost).toString()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jde...@us...> - 2007-11-26 11:44:07
|
Revision: 4594 http://pcgen.svn.sourceforge.net/pcgen/?rev=4594&view=rev Author: jdempsey Date: 2007-11-26 03:44:11 -0800 (Mon, 26 Nov 2007) Log Message: ----------- [5.13] ADD:ABILITY doesn't support TYPE Issue#: 1783780 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/PCClass.java Trunk/pcgen/code/src/java/pcgen/core/PObject.java Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java Modified: Trunk/pcgen/code/src/java/pcgen/core/PCClass.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PCClass.java 2007-11-26 08:47:12 UTC (rev 4593) +++ Trunk/pcgen/code/src/java/pcgen/core/PCClass.java 2007-11-26 11:44:11 UTC (rev 4594) @@ -4973,6 +4973,7 @@ aPC.setAutomaticAbilitiesStable(null, false); // aPC.setAutomaticFeatsStable(false); doPlusLevelMods(newLevel, aPC, pcLevelInfo); + aPC.addAddsFromAllObjForLevel(); // Don't roll the hit points if the gui is not being used. // This is so GMGen can add classes to a person without pcgen flipping Modified: Trunk/pcgen/code/src/java/pcgen/core/PObject.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PObject.java 2007-11-26 08:47:12 UTC (rev 4593) +++ Trunk/pcgen/code/src/java/pcgen/core/PObject.java 2007-11-26 11:44:11 UTC (rev 4594) @@ -2999,9 +2999,7 @@ { levAbility.setOwner(this); - if ( - !(this instanceof PCClass) || - ((levAbility.level() == aLevel) && levAbility.canProcess())) + if ((levAbility.level() == aLevel) && levAbility.canProcess()) { boolean canProcess = true; Modified: Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2007-11-26 08:47:12 UTC (rev 4593) +++ Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2007-11-26 11:44:11 UTC (rev 4594) @@ -17644,6 +17644,22 @@ return reach; } + /** + * Fire any adds for any objects other than classes that + * should be received at the character's current level. + */ + public void addAddsFromAllObjForLevel() + { + for (PObject pobj : getPObjectList()) + { + if (!(pobj instanceof PCClass)) + { + pobj.addAddsForLevel(this.getTotalCharacterLevel(), this, null); + } + } + + } + // public double getBonusValue(final String aBonusType, final String // aBonusName ) // { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jfr...@us...> - 2008-03-02 04:20:46
|
Revision: 5421 http://pcgen.svn.sourceforge.net/pcgen/?rev=5421&view=rev Author: jfrazierjr Date: 2008-03-01 20:20:50 -0800 (Sat, 01 Mar 2008) Log Message: ----------- 5.13.1 Substitution Level broken Issue#: 1786946 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/PCClass.java Trunk/pcgen/code/src/java/pcgen/core/PObject.java Trunk/pcgen/code/src/java/pcgen/core/SubstitutionClass.java Modified: Trunk/pcgen/code/src/java/pcgen/core/PCClass.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PCClass.java 2008-03-02 03:56:03 UTC (rev 5420) +++ Trunk/pcgen/code/src/java/pcgen/core/PCClass.java 2008-03-02 04:20:50 UTC (rev 5421) @@ -33,6 +33,7 @@ import java.util.Set; import java.util.StringTokenizer; +import pcgen.core.Ability.Nature; import pcgen.core.bonus.Bonus; import pcgen.core.bonus.BonusObj; import pcgen.core.character.CharacterSpell; @@ -6788,11 +6789,13 @@ /** * Remove all auto feats gained via a level * @param aLevel + * @deprecated */ /* * FINALPCCLASSONLY I think (heh) that committing this to the PCClassLevel really should * be part of the PCClass Factory, and thus part of the creation of the PCClassLevel * and thus only in PCClass + * */ public void removeAllAutoFeats(final int aLevel) { @@ -6934,6 +6937,48 @@ { this.allowBaseClass = allowBaseClass; } + + public void removeAllAbilites(final int alevel) + { + DoubleKeyMap<AbilityCategory, Nature, QualifiedObject<String>> abilityCategories = new DoubleKeyMap<AbilityCategory, Nature, QualifiedObject<String>>(); + final List<AbilityCategory> theCategories = getAbilityCategories(); + final Map<QualifiedObject<String>,AbilityCategory> QOs = new HashMap<QualifiedObject<String>,AbilityCategory>(); + + for (AbilityCategory category: theCategories) + { + final List<QualifiedObject<String>> theQOs = getRawAbilityObjects(category, Nature.AUTOMATIC); + for (QualifiedObject<String> qo: theQOs) + { + List<Prerequisite> thePreReqs = qo.getPrereqs(); +PREREQS: for (Prerequisite pre : thePreReqs) + { + int prelevel; + try + { + prelevel = Integer.parseInt(pre.getOperand()); + } + catch (NumberFormatException e) + { + continue PREREQS; + } + + if ( pre.getKey().equalsIgnoreCase(this.getDisplayName()) + && pre.getKind().equalsIgnoreCase("class") + && pre.getOperator().toString().startsWith("gt") + && prelevel == alevel ) + { + QOs.put(qo, category); + } + } + } + } + for (QualifiedObject<String> qo : QOs.keySet()) + { + AbilityCategory cat = QOs.get(qo); + removeAbility(cat, Nature.AUTOMATIC, qo); + System.out.println(qo); + } + } // public void removeAutoAbilities(final AbilityCategory aCategory, final int aLevel) Modified: Trunk/pcgen/code/src/java/pcgen/core/PObject.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PObject.java 2008-03-02 03:56:03 UTC (rev 5420) +++ Trunk/pcgen/code/src/java/pcgen/core/PObject.java 2008-03-02 04:20:50 UTC (rev 5421) @@ -4277,6 +4277,13 @@ abilities.add(anAbility); } + /** + * @param aCategory + * @param aNature + * @return List<QualifiedObject<String>> + * + * Returns a list of abilities for specific a specific category and nature + */ public List<QualifiedObject<String>> getRawAbilityObjects( final AbilityCategory aCategory, final Ability.Nature aNature) { Modified: Trunk/pcgen/code/src/java/pcgen/core/SubstitutionClass.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/SubstitutionClass.java 2008-03-02 03:56:03 UTC (rev 5420) +++ Trunk/pcgen/code/src/java/pcgen/core/SubstitutionClass.java 2008-03-02 04:20:50 UTC (rev 5421) @@ -87,7 +87,8 @@ // remove all stuff from the original level aClass.removeAllBonuses(aLevel); - aClass.removeAllAutoFeats(aLevel); + //aClass.removeAllAutoFeats(aLevel); + aClass.removeAllAbilites(aLevel); aClass.removeAllLevelAbilities(aLevel); aClass.clearSABList(aLevel); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2008-04-11 22:57:46
|
Revision: 5899 http://pcgen.svn.sourceforge.net/pcgen/?rev=5899&view=rev Author: thpr Date: 2008-04-11 15:57:47 -0700 (Fri, 11 Apr 2008) Log Message: ----------- [ 1931945 ] BONUSFEATLEVELSTARTINTERVAL broken includes some dead code removal Issue#: 1931945 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/Globals.java Trunk/pcgen/code/src/java/pcgen/core/PCClass.java Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java Modified: Trunk/pcgen/code/src/java/pcgen/core/Globals.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/Globals.java 2008-04-11 22:36:10 UTC (rev 5898) +++ Trunk/pcgen/code/src/java/pcgen/core/Globals.java 2008-04-11 22:57:47 UTC (rev 5899) @@ -2969,18 +2969,6 @@ return SettingsHandler.getGame().getBonusFeatLevels().get(0); } - static int getBonusFeatsForLevel(final int level) - { - int num = 0; - - for (String s : SettingsHandler.getGame().getBonusFeatLevels()) - { - num = bonusParsing(s, level, num); - } - - return num; - } - static int getBonusStatsForLevel(final int level) { int num = 0; Modified: Trunk/pcgen/code/src/java/pcgen/core/PCClass.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PCClass.java 2008-04-11 22:36:10 UTC (rev 5898) +++ Trunk/pcgen/code/src/java/pcgen/core/PCClass.java 2008-04-11 22:57:47 UTC (rev 5899) @@ -3166,7 +3166,7 @@ final String aString = Globals.getBonusFeatString(); final StringTokenizer aTok = new StringTokenizer(aString, "|", false); - final int startLevel = Integer.parseInt(aTok.nextToken()); + int startLevel = Integer.parseInt(aTok.nextToken()); final int rangeLevel = Integer.parseInt(aTok.nextToken()); int divisor = 1; final boolean isMonsterClass = @@ -3174,7 +3174,15 @@ && aPC.getRace().getMonsterClass(aPC, false) .equalsIgnoreCase(this.getKeyName()); Integer mLevPerFeat = getLevelsPerFeat(); - divisor = (mLevPerFeat != null) ? mLevPerFeat : rangeLevel; + if (mLevPerFeat == null) + { + divisor = rangeLevel; + } + else + { + divisor = mLevPerFeat; + startLevel = 0; + } if (divisor > 0) { if (SettingsHandler.isMonsterDefault() && isMonsterClass) @@ -3185,12 +3193,14 @@ formula = new StringBuffer("max(0,floor((CL-"); formula.append(monLev); + formula.append("-"); + formula.append(startLevel); formula.append(")/"); formula.append(divisor); formula.append("))"); StringBuffer aBuf = - new StringBuffer("0|FEAT|MONSTERPOOL|"); + new StringBuffer(startLevel + "|FEAT|MONSTERPOOL|"); aBuf.append(formula); BonusObj bon = Bonus.newBonus(aBuf.toString()); bon.setCreatorObject(this); @@ -3199,7 +3209,8 @@ else { StringBuffer aBuf = - new StringBuffer("0|FEAT|PCPOOL|CL/"); + new StringBuffer(startLevel + + "|FEAT|PCPOOL|(CL-" + startLevel + "+" + rangeLevel + ")/"); aBuf.append(divisor); BonusObj bon = Bonus.newBonus(aBuf.toString()); bon.setCreatorObject(this); Modified: Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2008-04-11 22:36:10 UTC (rev 5898) +++ Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2008-04-11 22:57:47 UTC (rev 5899) @@ -5137,87 +5137,7 @@ return sumActiveBonusMap(typeString); } - // public List<TypedBonus> getBonusesOfType(final String aBonusName, final - // String aBonusType, final String aType ) - // { - // final List<TypedBonus> bonuses = this.getBonusesTo(aBonusName, - // aBonusType); - // final List<TypedBonus> ret = new ArrayList<TypedBonus>(bonuses.size()); - // for ( final TypedBonus bonus : bonuses ) - // { - // if ( bonus.getType().equals(aType) ) - // { - // ret.add( bonus ); - // } - // } - // return ret; - // } /** - * If the class passed in has the Levels - * - * @param newLevelClass - * The class the new level has been taken in. - * @return bonus feats for new level - * @deprecated - */ - @Deprecated - public double getBonusFeatsForNewLevel(final PCClass newLevelClass) - { - double bonusFeats = 0.0; - final Integer lpf = newLevelClass.getLevelsPerFeat(); - - if (lpf != null && lpf.intValue() >= 0) - { - // If the class has levelsPerFeat set then the calculated - // level for determining bonus feats = RacialHD+levels in this class - int calculatedLevel = 0; - if (getRace() != null && isMonsterDefault()) - { - // If we are a default monster then we will need to add the - // MonsterClassLevels - // if we are not a default monster then these will be explicit - // class levels - // and we do not want to add them twice. - calculatedLevel += getRace().getMonsterClassLevels(this); - } - - calculatedLevel += newLevelClass.getLevel(); - - final int levelsPerFeat = lpf.intValue(); - if (levelsPerFeat > 0) - { - bonusFeats = (calculatedLevel % levelsPerFeat == 0) ? 1 : 0; - } - } - else - { - // If the class does not have levelsPerFeat set then the calculated - // level - // for determining bonus feats is RacialHD + sum of levels in all - // classes - // that do not have levelsPerFeat set - int nonSpecificLevels = 0; - if (getRace() != null && isMonsterDefault()) - { - nonSpecificLevels += getRace().getMonsterClassLevels(this); - } - - for (PCClass pcClass : classList) - { - final Integer levelsPerFeatForClass = - pcClass.getLevelsPerFeat(); - if (levelsPerFeatForClass == null - || levelsPerFeatForClass.intValue() < 0) - { - nonSpecificLevels += pcClass.getLevel(); - } - } - bonusFeats = Globals.getBonusFeatsForLevel(nonSpecificLevels); - } - return bonusFeats; - } - - /** * Get the list of WeaponName and Proficiency types from the changeProfMap * of each granting object * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jfr...@us...> - 2008-04-23 17:57:01
|
Revision: 6091 http://pcgen.svn.sourceforge.net/pcgen/?rev=6091&view=rev Author: jfrazierjr Date: 2008-04-23 10:57:08 -0700 (Wed, 23 Apr 2008) Log Message: ----------- 5.13.1 Substitution Level broken for DR Changed Method name to clear up ambiguity Issue#: 1929424 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/PCClass.java Trunk/pcgen/code/src/java/pcgen/core/SubstitutionClass.java Modified: Trunk/pcgen/code/src/java/pcgen/core/PCClass.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PCClass.java 2008-04-23 17:45:04 UTC (rev 6090) +++ Trunk/pcgen/code/src/java/pcgen/core/PCClass.java 2008-04-23 17:57:08 UTC (rev 6091) @@ -7903,9 +7903,10 @@ } /** - * @param level2 + * Remove the level based DR. Used by Substitution class levels + * @param level */ - public void removeDR(int level) + public void removeLevelDR(int level) { List<DamageReduction> newDR = new ArrayList<DamageReduction>(); for (DamageReduction reduction : getDRList()) Modified: Trunk/pcgen/code/src/java/pcgen/core/SubstitutionClass.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/SubstitutionClass.java 2008-04-23 17:45:04 UTC (rev 6090) +++ Trunk/pcgen/code/src/java/pcgen/core/SubstitutionClass.java 2008-04-23 17:57:08 UTC (rev 6091) @@ -109,7 +109,7 @@ aClass.removeAllAutoAbilites(aLevel); aClass.removeAllLevelAbilities(aLevel); aClass.clearSABList(aLevel); - aClass.removeDR(aLevel); + aClass.removeLevelDR(aLevel); // Now add in each new level line in turn. for (String theLine: newLevels) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2008-06-18 21:21:21
|
Revision: 6709 http://pcgen.svn.sourceforge.net/pcgen/?rev=6709&view=rev Author: thpr Date: 2008-06-18 14:21:24 -0700 (Wed, 18 Jun 2008) Log Message: ----------- fix error inlining getPCCText from ConcretePrereqObject Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/Description.java Trunk/pcgen/code/src/java/pcgen/core/bonus/BonusObj.java Modified: Trunk/pcgen/code/src/java/pcgen/core/Description.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/Description.java 2008-06-18 19:57:12 UTC (rev 6708) +++ Trunk/pcgen/code/src/java/pcgen/core/Description.java 2008-06-18 21:21:24 UTC (rev 6709) @@ -299,6 +299,7 @@ .getPrerequisiteString(getPrerequisiteList()); if (prerequisiteString != null) { + buf.append(Constants.PIPE); buf.append(prerequisiteString); } } Modified: Trunk/pcgen/code/src/java/pcgen/core/bonus/BonusObj.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/bonus/BonusObj.java 2008-06-18 19:57:12 UTC (rev 6708) +++ Trunk/pcgen/code/src/java/pcgen/core/bonus/BonusObj.java 2008-06-18 21:21:24 UTC (rev 6709) @@ -589,6 +589,7 @@ .getPrerequisiteString(getPrerequisiteList()); if (prerequisiteString != null) { + sb.append(Constants.PIPE); sb.append(prerequisiteString); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2008-06-29 20:01:59
|
Revision: 6950 http://pcgen.svn.sourceforge.net/pcgen/?rev=6950&view=rev Author: thpr Date: 2008-06-29 13:02:08 -0700 (Sun, 29 Jun 2008) Log Message: ----------- more small refactoring Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/PCClass.java Trunk/pcgen/code/src/java/pcgen/core/PObject.java Modified: Trunk/pcgen/code/src/java/pcgen/core/PCClass.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PCClass.java 2008-06-29 19:31:00 UTC (rev 6949) +++ Trunk/pcgen/code/src/java/pcgen/core/PCClass.java 2008-06-29 20:02:08 UTC (rev 6950) @@ -3141,7 +3141,7 @@ final String xString = new StringBuffer().append(firstPart).append( getAssociated(i)).append(secondPart).toString(); - retVal += calcPartialBonus(xString, iTimes, aBonus, aPC); + retVal += iTimes * calcPartialBonus(xString, aBonus, aPC); } bString = @@ -3150,7 +3150,7 @@ } } - retVal += calcPartialBonus(bString, iTimes, aBonus, aPC); + retVal += iTimes * calcPartialBonus(bString, aBonus, aPC); return retVal; } @@ -5032,14 +5032,12 @@ * @param bString * Either the entire BONUS:COMBAT|AC|2 string or part of a %LIST * or %VAR bonus section - * @param iTimes - * multiply bonus * iTimes * @param aBonus * The bonuse Object used for calcs * @param anObj * @return partial bonus */ - private double calcPartialBonus(final String bString, final int iTimes, + private double calcPartialBonus(final String bString, final BonusObj aBonus, final PlayerCharacter aPC) { final StringTokenizer aTok = new StringTokenizer(bString, "|", false); @@ -5053,17 +5051,13 @@ aTok.nextToken(); // Is this intended to be thrown away? Why? final String aList = aTok.nextToken(); - final String aVal = aTok.nextToken(); - double iBonus = 0; - if (aList.equals("ALL")) { return 0; } - - iBonus = aPC.getVariableValue(aVal, classKey).doubleValue(); - return iBonus * iTimes; + final String aVal = aTok.nextToken(); + return aPC.getVariableValue(aVal, classKey).doubleValue(); } /* Modified: Trunk/pcgen/code/src/java/pcgen/core/PObject.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PObject.java 2008-06-29 19:31:00 UTC (rev 6949) +++ Trunk/pcgen/code/src/java/pcgen/core/PObject.java 2008-06-29 20:02:08 UTC (rev 6950) @@ -4115,9 +4115,7 @@ int iTimes = 1; - final String aType = aBonus.getTypeOfBonus(); - - if ("VAR".equals(aType)) + if ("VAR".equals(aBonus.getTypeOfBonus())) { iTimes = Math.max(1, getAssociatedCount()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jde...@us...> - 2008-07-05 04:46:52
|
Revision: 7011 http://pcgen.svn.sourceforge.net/pcgen/?rev=7011&view=rev Author: jdempsey Date: 2008-07-04 21:47:01 -0700 (Fri, 04 Jul 2008) Log Message: ----------- Fix bug: NPE with loading companion - Merged from 5.14 r7010 Issue#: 2009246 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java Trunk/pcgen/code/src/java/pcgen/core/kit/KitStat.java Modified: Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2008-07-05 04:43:05 UTC (rev 7010) +++ Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2008-07-05 04:47:01 UTC (rev 7011) @@ -2341,6 +2341,14 @@ } } + // Setup the default EquipSet if not already present + if (getEquipSet().size() == 0) + { + String id = getNewIdPath(null); + EquipSet eSet = new EquipSet(id, PropertyFactory.getString("in_ieDefault")); + addEquipSet(eSet); + } + oldCompanionMods.removeAll(companionModList); for (CompanionMod cMod : oldCompanionMods) { Modified: Trunk/pcgen/code/src/java/pcgen/core/kit/KitStat.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/kit/KitStat.java 2008-07-05 04:43:05 UTC (rev 7010) +++ Trunk/pcgen/code/src/java/pcgen/core/kit/KitStat.java 2008-07-05 04:47:01 UTC (rev 7011) @@ -111,6 +111,12 @@ public void apply(PlayerCharacter aPC) { + // Non abilities will be null, so skip those. + if (theStat == null) + { + return; + } + final StatList aStatList = aPC.getStatList(); for (Iterator<PCStat> stat = aStatList.iterator(); stat.hasNext();) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |