From: <th...@us...> - 2010-12-18 02:37:17
|
Revision: 14179 http://pcgen.svn.sourceforge.net/pcgen/?rev=14179&view=rev Author: thpr Date: 2010-12-18 02:37:07 +0000 (Sat, 18 Dec 2010) Log Message: ----------- eliminate unused return codes Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java Modified: Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java 2010-12-18 00:37:51 UTC (rev 14178) +++ Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java 2010-12-18 02:37:07 UTC (rev 14179) @@ -252,7 +252,7 @@ * @param category The AbilityCategory to add or remove the ability from. * @return 1 if adding the Ability, or 0 if removing it. */ - public static int finaliseAbility( + public static void finaliseAbility( final Ability ability, final String choice, final PlayerCharacter aPC, @@ -366,8 +366,6 @@ { AddObjectActions.globalChecks(ability, aPC); } - - return result ? 1 : 0; } @@ -485,7 +483,7 @@ * @return 1 if adding the Ability or 0 if removing it. */ - public static int modAbility( + public static void modAbility( final PlayerCharacter aPC, final PCLevelInfo levelInfo, final Ability argAbility, @@ -496,7 +494,7 @@ if (argAbility == null) { Logging.errorPrint("Can't process null Ability"); - return create ? 1 : 0; + return; } if (aPC.isNotImporting()) {aPC.getSpellList();} @@ -517,11 +515,11 @@ if (pcAbility == null) { Logging.errorPrint("Can't process ability " + argAbility + " not present in character."); - return create ? 1 : 0; + return; } - return finaliseAbility(pcAbility, choice, aPC, create, true, category); + finaliseAbility(pcAbility, choice, aPC, create, true, category); } /** @@ -542,7 +540,7 @@ * @return 1 if adding the Ability but it wasn't there or 0 if the PC does * not currently have the Ability. */ - public static int modFeat( + public static void modFeat( final PlayerCharacter aPC, final PCLevelInfo LevelInfo, final String aFeatKey, @@ -597,8 +595,7 @@ if (anAbility == null) { Logging.errorPrint("Feat not found: " + aFeatKey); - - return 1; + return; } anAbility = anAbility.clone(); @@ -613,10 +610,10 @@ */ if (anAbility == null) { - return addIt ? 1 : 0; + return; } - return finaliseAbility(anAbility, subKey, aPC, addIt, singleChoice1, AbilityCategory.FEAT); + finaliseAbility(anAbility, subKey, aPC, addIt, singleChoice1, AbilityCategory.FEAT); } /** Modified: Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2010-12-18 00:37:51 UTC (rev 14178) +++ Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2010-12-18 02:37:07 UTC (rev 14179) @@ -10863,7 +10863,7 @@ return null; } - public int addAbility(final PCLevelInfo LevelInfo, + public void addAbility(final PCLevelInfo LevelInfo, final AbilityCategory aCategory, final String aKey, final boolean addIt, final boolean singleChoice) { @@ -10920,8 +10920,7 @@ if (anAbility == null) { Logging.errorPrint("Ability not found: " + undoctoredKey); - - return addIt ? 1 : 0; + return; } anAbility = anAbility.clone(); @@ -10938,10 +10937,10 @@ */ if (anAbility == null) { - return addIt ? 1 : 0; + return; } - return AbilityUtilities.finaliseAbility(anAbility, subKey, this, addIt, + AbilityUtilities.finaliseAbility(anAbility, subKey, this, addIt, singleChoice1, aCategory); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2010-12-18 03:29:51
|
Revision: 14181 http://pcgen.svn.sourceforge.net/pcgen/?rev=14181&view=rev Author: thpr Date: 2010-12-18 03:29:44 +0000 (Sat, 18 Dec 2010) Log Message: ----------- inline constants Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java Modified: Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java 2010-12-18 03:25:16 UTC (rev 14180) +++ Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java 2010-12-18 03:29:44 UTC (rev 14181) @@ -626,10 +626,7 @@ */ static void modFeatsFromList( final PlayerCharacter aPC, - final PCLevelInfo LevelInfo, - final String aList, - final boolean addIt, - final boolean all) + final String aList) { final StringTokenizer aTok = new StringTokenizer(aList, ","); @@ -674,12 +671,8 @@ bTok = null; } aString = bString.replace('(', ' ').replace(')', ' ').trim(); - // if we still haven't found it, try a different string - if (!addIt) - { - return; - } + // if we still haven't found it, try a different string anAbility = Globals.getContext().ref .silentlyGetConstructedCDOMObject(Ability.class, AbilityCategory.FEAT, aString); @@ -692,13 +685,13 @@ } anAbility = anAbility.clone(); - aPC.addFeat(anAbility, LevelInfo); + aPC.addFeat(anAbility, null); } else { // add the Feat found, as a CharacterFeat anAbility = anAbility.clone(); - aPC.addFeat(anAbility, LevelInfo); + aPC.addFeat(anAbility, null); } if ((bTok != null) && bTok.hasMoreTokens()) @@ -717,46 +710,25 @@ { for (WeaponProf wp : ref.getContainedObjects()) { - if (addIt) - { - aPC.addAssociation(anAbility, wp.getKeyName()); - } - else - { - aPC.removeAssociation(anAbility, wp.getKeyName()); - } + aPC.addAssociation(anAbility, wp.getKeyName()); } } } } else { - if (addIt) - { - aPC.addAssociation(anAbility, aString); - } - else - { - aPC.removeAssociation(anAbility, aString); - } + aPC.addAssociation(anAbility, aString); } } } else { - if (!all && !anAbility.getSafe(ObjectKey.MULTIPLE_ALLOWED)) + if (!anAbility.getSafe(ObjectKey.MULTIPLE_ALLOWED)) { - if (addIt) - { - aPC.adjustFeats(anAbility.getSafe(ObjectKey.SELECTION_COST).doubleValue()); - } - else - { - aPC.adjustFeats(-anAbility.getSafe(ObjectKey.SELECTION_COST).doubleValue()); - } + aPC.adjustFeats(anAbility.getSafe(ObjectKey.SELECTION_COST).doubleValue()); } - modFeat(aPC, LevelInfo, aString, addIt, all); + modFeat(aPC, null, aString, true, false); } } } Modified: Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2010-12-18 03:25:16 UTC (rev 14180) +++ Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2010-12-18 03:29:44 UTC (rev 14181) @@ -9153,8 +9153,7 @@ for (int j = 0, y = templateFeats.size(); j < y; ++j) { - AbilityUtilities.modFeatsFromList(this, null, templateFeats - .get(j), true, false); + AbilityUtilities.modFeatsFromList(this, templateFeats.get(j)); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2010-12-18 15:46:32
|
Revision: 14188 http://pcgen.svn.sourceforge.net/pcgen/?rev=14188&view=rev Author: thpr Date: 2010-12-18 15:46:26 +0000 (Sat, 18 Dec 2010) Log Message: ----------- no more Categorisable Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/Ability.java Removed Paths: ------------- Trunk/pcgen/code/src/java/pcgen/core/Categorisable.java Modified: Trunk/pcgen/code/src/java/pcgen/core/Ability.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/Ability.java 2010-12-18 15:45:43 UTC (rev 14187) +++ Trunk/pcgen/code/src/java/pcgen/core/Ability.java 2010-12-18 15:46:26 UTC (rev 14188) @@ -38,7 +38,7 @@ * @author ??? * @version $Revision$ */ -public final class Ability extends PObject implements Categorisable, CategorizedCDOMObject<Ability> +public final class Ability extends PObject implements CategorizedCDOMObject<Ability> { public static final CDOMReference<AbilityList> FEATLIST; Deleted: Trunk/pcgen/code/src/java/pcgen/core/Categorisable.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/Categorisable.java 2010-12-18 15:45:43 UTC (rev 14187) +++ Trunk/pcgen/code/src/java/pcgen/core/Categorisable.java 2010-12-18 15:46:26 UTC (rev 14188) @@ -1,55 +0,0 @@ -/* - * Categorisable.java - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Current Version: $Revision$ - * Last Editor: $Author$ - * Last Edited: $Date$ - * Copyright 2005 Andrew Wilson <nu...@so...> - */ -package pcgen.core; - -/** - * This is the interface for objects that can be stored in a - * CategorisableStore - * - * @author Andrew Wilson <nu...@so...> - * @version $Revision$ - */ -public interface Categorisable -{ - /** - * Get the category of this ability - * - * @return The category of this Ability - */ - public abstract String getCategory(); - - /** - * Get the Key of this object. Note the key must be combined with the - * Category in order to be unique - * - * @return the key that identifies this object - */ - public abstract String getKeyName(); - - /** - * Get the name of the Object - * - * @return The name - */ - public abstract String getDisplayName(); -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2010-12-18 17:23:03
|
Revision: 14190 http://pcgen.svn.sourceforge.net/pcgen/?rev=14190&view=rev Author: thpr Date: 2010-12-18 16:37:09 +0000 (Sat, 18 Dec 2010) Log Message: ----------- inlining Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java Modified: Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java 2010-12-18 16:34:34 UTC (rev 14189) +++ Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java 2010-12-18 16:37:09 UTC (rev 14190) @@ -204,8 +204,8 @@ return false; } - final boolean multFirst = getIsMultiples(first); - final boolean multSecond = getIsMultiples(second); + final boolean multFirst = first.getSafe(ObjectKey.MULTIPLE_ALLOWED); + final boolean multSecond = second.getSafe(ObjectKey.MULTIPLE_ALLOWED); boolean nameCheck = false; if (multFirst && multSecond) { /* @@ -370,23 +370,6 @@ /** * Find an ability in a list that matches a given Ability or AbilityInfo - * Object. - * @param pc TODO - * @param anAbilityList - * @param abilityInfo - * - * @return the Ability if found, otherwise null - */ - private static Ability getAbilityFromList( - PlayerCharacter pc, - final Collection<Ability> anAbilityList, final Ability abilityInfo) - { - return getAbilityFromList(pc, anAbilityList, abilityInfo, Nature.ANY); - } - - - /** - * Find an ability in a list that matches a given Ability or AbilityInfo * Object. Also takes an integer representing a type, -1 always matches, * otherwise an ability will only be returned if its type is the same as * abilityType @@ -418,18 +401,6 @@ } /** - * Find out if this Categorisable Object can be applied to a character - * multiple times - * - * @param aCatObj - * @return true if can be applied multiple times - */ - private static boolean getIsMultiples(final Ability aCatObj) - { - return aCatObj.getSafe(ObjectKey.MULTIPLE_ALLOWED); - } - - /** * Add an Ability to a character, allowing sub-choices if necessary. Always adds * weapon proficiencies, either a single choice if addAll is false, or all * possible choices if addAll is true. @@ -463,7 +434,7 @@ if (aPC.isNotImporting()) {aPC.getSpellList();} final Set<Ability> realAbilities = aPC.getRealAbilitiesList(category); - Ability pcAbility = getAbilityFromList(aPC, realAbilities, argAbility); + Ability pcAbility = getAbilityFromList(aPC, realAbilities, argAbility, Nature.ANY); // (pcAbility == null) means we don't have this feat, // so we need to add it @@ -587,28 +558,6 @@ } } - /** - * This method attempts to get an Ability Object from the Global Store keyed - * by token. If this fails, it checks if token has info in parenthesis - * appended to it. If it does, it strips this and attempts to get an Ability - * Keyed by the stripped token. If this works, it passes back this Ability, - * if it does not work, it returns null. - * - * @param cat - * The category of Ability Object to retrieve - * @param token - * The name of the Ability Object - * - * @return The ability in category "cat" called "token" - */ - public static Ability retrieveAbilityKeyed( - final String cat, - final String token) - { - return retrieveAbilityKeyed(SettingsHandler.getGame() - .getAbilityCategory(cat), token); - } - static Ability retrieveAbilityKeyed(AbilityCategory aCat, final String token) { Modified: Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2010-12-18 16:34:34 UTC (rev 14189) +++ Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2010-12-18 16:37:09 UTC (rev 14190) @@ -4361,7 +4361,8 @@ { List<Ability> aggList = AbilityUtilities .getAggregateAbilitiesListForKey(Constants.FEAT_CATEGORY, this); - Ability abInfo = AbilityUtilities.retrieveAbilityKeyed(Constants.FEAT_CATEGORY, featName); + Ability abInfo = AbilityUtilities.retrieveAbilityKeyed(SettingsHandler.getGame() + .getAbilityCategory(Constants.FEAT_CATEGORY), featName); return AbilityUtilities.getAbilityFromList(this, aggList, abInfo, Nature.ANY); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2010-12-19 17:02:15
|
Revision: 14203 http://pcgen.svn.sourceforge.net/pcgen/?rev=14203&view=rev Author: thpr Date: 2010-12-19 17:02:08 +0000 (Sun, 19 Dec 2010) Log Message: ----------- minor refactoring Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java Modified: Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java 2010-12-19 15:21:55 UTC (rev 14202) +++ Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java 2010-12-19 17:02:08 UTC (rev 14203) @@ -35,6 +35,7 @@ import pcgen.cdom.enumeration.Nature; import pcgen.cdom.enumeration.ObjectKey; import pcgen.cdom.helper.AbilitySelection; +import pcgen.cdom.helper.CategorizedAbilitySelection; import pcgen.core.analysis.AddObjectActions; import pcgen.core.chooser.ChooserUtilities; import pcgen.core.utils.CoreUtility; @@ -75,15 +76,9 @@ if (needToAddVirtualAbility(pc, cat, anAbility)) { newAbility = anAbility.clone(); - - if (choice != null) - { - if (canAddAssociation(pc, newAbility, choice)) - { - pc.addAssociation(newAbility, choice); - } - } - pc.addUserVirtualAbility(cat, newAbility); + CategorizedAbilitySelection cas = new CategorizedAbilitySelection( + pc, cat, newAbility, Nature.VIRTUAL, choice); + pc.addUserAbility(cas); newAbility.clearPrerequisiteList(); } return newAbility; Modified: Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2010-12-19 15:21:55 UTC (rev 14202) +++ Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2010-12-19 17:02:08 UTC (rev 14203) @@ -10262,17 +10262,6 @@ // pool of feats remaining to distribute private double numberOfRemainingFeats = 0; - private boolean addRealAbility(final Category<Ability> aCategory, - final Ability anAbility) - { - if (anAbility == null) - { - return false; - } - abFacet.add(id, aCategory, Nature.NORMAL, anAbility); - return true; - } - public HashMap<Nature, Set<Ability>> getAbilitiesSet() { HashMap<Nature, Set<Ability>> st = @@ -10745,12 +10734,15 @@ + aFeat.getDisplayName()); } - if (!addRealAbility(AbilityCategory.FEAT, aFeat)) + if (aFeat == null) { - Logging - .errorPrint("Problem adding feat: " + aFeat.getDisplayName()); + Logging.errorPrint("Cannot add null feat"); } - calcActiveBonuses(); + else + { + abFacet.add(id, AbilityCategory.FEAT, Nature.NORMAL, aFeat); + calcActiveBonuses(); + } } public void addAbility(final Category<Ability> aCategory, @@ -10762,12 +10754,15 @@ + anAbility.getDisplayName()); } - if (!addRealAbility(aCategory, anAbility)) + if (anAbility == null) { - Logging.errorPrint("Problem adding ability: " - + anAbility.getDisplayName()); + Logging.errorPrint("Cannot add null Ability"); } - calcActiveBonuses(); + else + { + abFacet.add(id, aCategory, Nature.NORMAL, anAbility); + calcActiveBonuses(); + } } public Ability getAutomaticAbilityKeyed(final AbilityCategory aCategory, @@ -12269,9 +12264,18 @@ return abFacet.contains(id, cat, Nature.VIRTUAL, abilityInfo); } - public void addUserVirtualAbility(AbilityCategory cat, Ability newAbility) + public void addUserAbility(CategorizedAbilitySelection cas) { - abFacet.add(id, cat, Nature.VIRTUAL, newAbility); + Ability newAbility = cas.getAbility(); + abFacet.add(id, cas.getAbilityCategory(), cas.getNature(), newAbility); + String choice = cas.getSelection(); + if (choice != null) + { + if (AbilityUtilities.canAddAssociation(this, newAbility, choice)) + { + addAssociation(newAbility, choice); + } + } } public Set<Ability> getAbilityList(Category<Ability> cat, Nature nature) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2010-12-20 00:27:06
|
Revision: 14211 http://pcgen.svn.sourceforge.net/pcgen/?rev=14211&view=rev Author: thpr Date: 2010-12-20 00:26:59 +0000 (Mon, 20 Dec 2010) Log Message: ----------- back out part of 14203 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java Modified: Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java 2010-12-19 23:03:15 UTC (rev 14210) +++ Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java 2010-12-20 00:26:59 UTC (rev 14211) @@ -31,10 +31,8 @@ import pcgen.cdom.base.CDOMObjectUtilities; import pcgen.cdom.base.TransitionChoice; import pcgen.cdom.enumeration.ListKey; -import pcgen.cdom.enumeration.Nature; import pcgen.cdom.enumeration.ObjectKey; import pcgen.cdom.helper.AbilitySelection; -import pcgen.cdom.helper.CategorizedAbilitySelection; import pcgen.core.analysis.AddObjectActions; import pcgen.core.chooser.ChooserUtilities; import pcgen.core.utils.CoreUtility; @@ -74,9 +72,15 @@ if (needToAddVirtualAbility(pc, cat, anAbility)) { newAbility = anAbility.clone(); - CategorizedAbilitySelection cas = new CategorizedAbilitySelection( - pc, cat, newAbility, Nature.VIRTUAL, choice); - pc.addUserAbility(cas); + + if (choice != null) + { + if (canAddAssociation(pc, newAbility, choice)) + { + pc.addAssociation(newAbility, choice); + } + } + pc.addUserVirtualAbility(cat, newAbility); newAbility.clearPrerequisiteList(); } return newAbility; Modified: Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2010-12-19 23:03:15 UTC (rev 14210) +++ Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2010-12-20 00:26:59 UTC (rev 14211) @@ -12867,4 +12867,9 @@ CDOMObjectUtilities.restoreRemovals(anAbility, this); adjustMoveRates(); } + + public void addUserVirtualAbility(AbilityCategory cat, Ability newAbility) + { + abFacet.add(id, cat, Nature.VIRTUAL, newAbility); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <za...@us...> - 2011-04-12 09:57:58
|
Revision: 14785 http://pcgen.svn.sourceforge.net/pcgen/?rev=14785&view=rev Author: zaister Date: 2011-04-12 09:57:51 +0000 (Tue, 12 Apr 2011) Log Message: ----------- Fix average hp calculation for multiclass characters Issue#: CODE-549 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/Globals.java Trunk/pcgen/code/src/java/pcgen/core/PCClass.java Modified: Trunk/pcgen/code/src/java/pcgen/core/Globals.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/Globals.java 2011-04-12 05:25:03 UTC (rev 14784) +++ Trunk/pcgen/code/src/java/pcgen/core/Globals.java 2011-04-12 09:57:51 UTC (rev 14785) @@ -1810,7 +1810,7 @@ * @param level * @return HP */ - public static int rollHP(final int min, final int max, final String name, final int level) + public static int rollHP(final int min, final int max, final String name, final int level, final int totalLevel) { int roll; @@ -1828,7 +1828,7 @@ // average roll on a die with an even # of sides will have an extra 0.5 roll = max - min; - if (((level & 0x01) == 0) && ((roll & 0x01) != 0)) + if (((totalLevel & 0x01) == 0) && ((roll & 0x01) != 0)) { ++roll; } Modified: Trunk/pcgen/code/src/java/pcgen/core/PCClass.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PCClass.java 2011-04-12 05:25:03 UTC (rev 14784) +++ Trunk/pcgen/code/src/java/pcgen/core/PCClass.java 2011-04-12 09:57:51 UTC (rev 14785) @@ -1738,7 +1738,7 @@ { if (!aPC.isImporting()) { - roll = Globals.rollHP(min, max, getDisplayName(), aLevel); + roll = Globals.rollHP(min, max, getDisplayName(), aLevel, aPC.getTotalLevels()); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nu...@us...> - 2011-05-04 20:20:15
|
Revision: 14910 http://pcgen.svn.sourceforge.net/pcgen/?rev=14910&view=rev Author: nuance Date: 2011-05-04 20:20:07 +0000 (Wed, 04 May 2011) Log Message: ----------- Fix some CheckStyle errors. Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java Trunk/pcgen/code/src/java/pcgen/core/utils/CoreUtility.java Modified: Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2011-05-04 08:18:30 UTC (rev 14909) +++ Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2011-05-04 20:20:07 UTC (rev 14910) @@ -164,7 +164,8 @@ private DomainFacet domainFacet = FacetLibrary.getFacet(DomainFacet.class); private TemplateFacet templateFacet = FacetLibrary.getFacet(TemplateFacet.class); - private ConditionalTemplateFacet conditionalTemplateFacet = FacetLibrary.getFacet(ConditionalTemplateFacet.class); + private ConditionalTemplateFacet conditionalTemplateFacet = + FacetLibrary.getFacet(ConditionalTemplateFacet.class); private DeityFacet deityFacet = FacetLibrary.getFacet(DeityFacet.class); private AlignmentFacet alignmentFacet = FacetLibrary.getFacet(AlignmentFacet.class); private RaceFacet raceFacet = FacetLibrary.getFacet(RaceFacet.class); @@ -184,7 +185,8 @@ private EquippedEquipmentFacet equippedFacet = FacetLibrary.getFacet(EquippedEquipmentFacet.class); private SourcedEquipmentFacet activeEquipmentFacet = FacetLibrary.getFacet(SourcedEquipmentFacet.class); private ActiveAbilityFacet abFacet = FacetLibrary.getFacet(ActiveAbilityFacet.class); - private ConditionallyGrantedAbilityFacet cabFacet = FacetLibrary.getFacet(ConditionallyGrantedAbilityFacet.class); + private ConditionallyGrantedAbilityFacet cabFacet = + FacetLibrary.getFacet(ConditionallyGrantedAbilityFacet.class); private ConditionalAbilityFacet conditionalFacet = FacetLibrary.getFacet(ConditionalAbilityFacet.class); private GrantedAbilityFacet grantedAbilityFacet = FacetLibrary.getFacet(GrantedAbilityFacet.class); private DirectAbilityFacet directAbilityFacet = FacetLibrary.getFacet(DirectAbilityFacet.class); @@ -257,9 +259,11 @@ private LoadFacet loadFacet = FacetLibrary.getFacet(LoadFacet.class); private AppliedBonusFacet appliedBonusFacet = FacetLibrary.getFacet(AppliedBonusFacet.class); private AddedBonusFacet addedBonusFacet = FacetLibrary.getFacet(AddedBonusFacet.class); - private GlobalAddedSkillCostFacet globalAddedSkillCostFacet = FacetLibrary.getFacet(GlobalAddedSkillCostFacet.class); + private GlobalAddedSkillCostFacet globalAddedSkillCostFacet = + FacetLibrary.getFacet(GlobalAddedSkillCostFacet.class); private GlobalSkillCostFacet globalSkillCostFacet = FacetLibrary.getFacet(GlobalSkillCostFacet.class); - private LocalAddedSkillCostFacet localAddedSkillCostFacet = FacetLibrary.getFacet(LocalAddedSkillCostFacet.class); + private LocalAddedSkillCostFacet localAddedSkillCostFacet = + FacetLibrary.getFacet(LocalAddedSkillCostFacet.class); private LocalSkillCostFacet localSkillCostFacet = FacetLibrary.getFacet(LocalSkillCostFacet.class); private ListSkillCostFacet listSkillCostFacet = FacetLibrary.getFacet(ListSkillCostFacet.class); private SpellSupportFacet spellSupportFacet = FacetLibrary.getFacet(SpellSupportFacet.class); @@ -279,16 +283,12 @@ // List of Note objects private final ArrayList<NoteItem> notesList = new ArrayList<NoteItem>(); - // This may be different from file name - private final ArrayList<Equipment> primaryWeapons = - new ArrayList<Equipment>(); - private final ArrayList<Equipment> secondaryWeapons = - new ArrayList<Equipment>(); + private final ArrayList<Equipment> primaryWeapons = new ArrayList<Equipment>(); + private final ArrayList<Equipment> secondaryWeapons = new ArrayList<Equipment>(); private ClassSource defaultDomainSource = null; - private Map<String, Integer> autoEquipOutputOrderCache = - new HashMap<String, Integer>(); + private Map<String, Integer> autoEquipOutputOrderCache = new HashMap<String, Integer>(); private List<PCLevelInfo> pcLevelInfo = new ArrayList<PCLevelInfo>(); // Temporary Bonuses @@ -354,7 +354,7 @@ /** * This map stores any user bonuses (entered through the GUI) to the - * corrisponding ability pool. + * corresponding ability pool. */ private Map<Category<Ability>, BigDecimal> theUserPoolBonuses = null; @@ -364,8 +364,9 @@ // ///////////////////////////////////// // operations + /** - * Constructor + * Constructor. */ public PlayerCharacter() { @@ -411,6 +412,9 @@ } } + /** + * Adds a virtual ability that grants a bonus language to the character. + */ public void insertBonusLanguageAbility() { Ability a = Globals.getContext().ref.silentlyGetConstructedCDOMObject( @@ -420,9 +424,9 @@ } /** - * Set the age + * Set the age. * - * @param i The PC's age + * @param i The character's age */ public void setAge(final int i) { @@ -432,7 +436,7 @@ } /** - * Get the age + * Get the age. * * @return age */ @@ -442,7 +446,7 @@ } /** - * Alignment of this PC + * Alignment of this PC. * * @return alignment */ @@ -468,7 +472,7 @@ } /** - * Get the armor proficiency list + * Get the armor proficiency list. * * @return armor proficiency list */ @@ -478,9 +482,9 @@ } /** - * Returns the Spell Stat bonus for a class + * Returns the Spell Stat bonus for a class. * - * @param aClass + * @param aClass the class to calculate the bonus for * @return base spell stat bonus */ public int getBaseSpellStatBonus(final PCClass aClass) @@ -514,17 +518,17 @@ } /** - * Set BIO + * Set the character's BIO. * - * @param aString + * @param bio the biography */ - public void setBio(final String aString) + public void setBio(final String bio) { - setStringFor(StringKey.BIO, aString); + setStringFor(StringKey.BIO, bio); } /** - * Get the BIO + * Get the BIO. * * @return the BIO */ @@ -534,17 +538,17 @@ } /** - * Set the birthday + * Set the birthday. * - * @param aString + * @param birthday the birthday to be set */ - public void setBirthday(final String aString) + public void setBirthday(final String birthday) { - setStringFor(StringKey.BIRTHDAY, aString); + setStringFor(StringKey.BIRTHDAY, birthday); } /** - * Get the birthday + * Get the birthday. * * @return birthday */ @@ -554,17 +558,17 @@ } /** - * Set the birthplace + * Set the birthplace. * - * @param aString + * @param birthPlace the place of birth */ - public void setBirthplace(final String aString) + public void setBirthplace(final String birthPlace) { - setStringFor(StringKey.BIRTHPLACE, aString); + setStringFor(StringKey.BIRTHPLACE, birthPlace); } /** - * Get the birthplace + * Get the birthplace. * * @return birthplace */ @@ -574,9 +578,9 @@ } /** - * Set the current EquipSet that is used to Bonus/Equip calculations + * Set the current EquipSet that is used to Bonus/Equip calculations. * - * @param eqSetId + * @param eqSetId The equipSet to be used for Bonus Calculations and output */ public void setCalcEquipSetId(final String eqSetId) { @@ -585,7 +589,7 @@ } /** - * Get the id for the equipment set being used for calculation + * Get the id for the equipment set being used for calculation. * * @return id */ @@ -617,7 +621,7 @@ /** * Set's current equipmentList to selected output EquipSet then loops * through all the equipment and sets the correct status of each (equipped, - * carried, etc) + * carried, etc). */ public void setCalcEquipmentList() { @@ -627,9 +631,10 @@ /** * Set's current equipmentList to selected output EquipSet then loops * through all the equipment and sets the correct status of each (equipped, - * carried, etc) + * carried, etc). Boolean parameter useTempBonuses controls whether or + * not the temporary bonuses associated with equipment are applied. * - * @param useTempBonuses + * @param useTempBonuses whether to apply Temporary bonuses from equipment. */ public void setCalcEquipmentList(final boolean useTempBonuses) { @@ -718,7 +723,7 @@ { eq.setLocation(EquipmentLocation.NOT_CARRIED); eq.setIsEquipped(false, this); - eq.setNumberCarried(Float.valueOf(0)); + eq.setNumberCarried(0f); eq.setQty(num); } else if (eq.isWeapon()) @@ -851,7 +856,7 @@ removeLocalEquipment(anEquip); anEquip.setIsEquipped(false, this); anEquip.setLocation(EquipmentLocation.NOT_CARRIED); - anEquip.setNumberCarried(Float.valueOf(0)); + anEquip.setNumberCarried(0f); } eq.setIsEquipped(true, this); @@ -878,8 +883,13 @@ } /** - * - * @param aPC + * Apply the bonus from a follower to the master pc. + * + * TODO Although it's not obvious from this code, the aPC parameter passed here IS + * this pc, everywhere that this method is called. Refactor this to remove the aPC + * parameter. + * + * @param aPC the pc to apply the bonus to */ public void setCalcFollowerBonus(final PlayerCharacter aPC) { @@ -906,17 +916,17 @@ } /** - * Set the catchphrase + * Set the catchphrase. * - * @param aString + * @param phrase the catchphrase */ - public void setCatchPhrase(final String aString) + public void setCatchPhrase(final String phrase) { - setStringFor(StringKey.CATCH_PHRASE, aString); + setStringFor(StringKey.CATCH_PHRASE, phrase); } /** - * Get the catchphrase + * Get the catchphrase. * * @return catchphrase */ @@ -926,16 +936,16 @@ } /** - * Get the class given a key + * Get a class, represented by a given key, from among those possessed by this pc. * - * @param aString + * @param Key the class's key * @return PCClass */ - public PCClass getClassKeyed(final String aString) + public PCClass getClassKeyed(final String Key) { for (PCClass aClass : getClassSet()) { - if (aClass.getKeyName().equalsIgnoreCase(aString)) + if (aClass.getKeyName().equalsIgnoreCase(Key)) { return aClass; } @@ -945,7 +955,7 @@ } /** - * Get the class list + * Get the class list. * * @return classList */ @@ -957,6 +967,10 @@ return new ArrayList<PCClass>(getClassSet()); } + /** + * Gets the Set of PCClass objects for this Character. + * @return a set of PCClass objects + */ public Set<PCClass> getClassSet() { return classFacet.getClassSet(id); @@ -965,7 +979,7 @@ /** * Set the cost pool, which is the number of points the character has spent. * - * @param i + * @param i the number of points spent */ public void setCostPool(final int i) { @@ -983,7 +997,7 @@ } /** - * Get a list of types that apply to this character + * Get a list of types that apply to this character. * * @return a List of Strings where each String is a type that the character * has. The list returned will never be null @@ -1013,6 +1027,10 @@ return list; } + /** + * Get a pipe separated list of creature types for this PC (defaults to humanoid). + * @return the list of types + */ @Deprecated public String getCritterType() { @@ -1065,7 +1083,7 @@ } /** - * Set the current equipment set name + * Set the current equipment set name. * * @param aName the name of the new current equipment set */ @@ -1075,7 +1093,7 @@ } /** - * Get the current equipment set name + * Get the current equipment set name. * * @return equipment set name */ @@ -1085,7 +1103,7 @@ } /** - * Get the deity + * Get the deity. * * @return deity */ @@ -1095,9 +1113,9 @@ } /** - * Set the description + * Set the description. * - * @param aString + * @param aString the description to set */ public void setDescription(final String aString) { @@ -1105,7 +1123,7 @@ } /** - * Get the description + * Get the description. * * @return description */ @@ -1127,7 +1145,7 @@ /** * Sets the character changed since last save. * - * @param dirtyState + * @param dirtyState the new "dirty" value (may be false to indicate no change) */ public void setDirty(final boolean dirtyState) { @@ -1231,7 +1249,7 @@ } /** - * is display update + * is display update. * * @return True if display update */ @@ -1241,7 +1259,7 @@ } /** - * Get the list of equipment sets + * Get the list of equipment sets. * * @return List */ @@ -1251,9 +1269,9 @@ } /** - * Get the equipment set given id + * Get the equipment set indexed by path. * - * @param id + * @param path the "path" of the equipSet to return * @return EquipSet */ public EquipSet getEquipSetByIdPath(final String path) @@ -1262,10 +1280,10 @@ } /** - * Get the equipment set by name + * Get the equipment set by name. * - * @param aName - * @return Equip set + * @param aName the name of the equipSet to retrieve + * @return an Equip set */ public EquipSet getEquipSetByName(final String aName) { @@ -1273,9 +1291,9 @@ } /** - * Set the number of the current equipset when exporting + * Set the number of the current equipSet. * - * @param anInt + * @param anInt the new value for current equipSet index */ public void setEquipSetNumber(final int anInt) { @@ -1284,9 +1302,9 @@ } /** - * Get the equipment set number + * Get the current equipment set number. * - * @return equipset number + * @return equipSet number */ public int getEquipSetNumber() { @@ -1294,9 +1312,9 @@ } /** - * gets the total weight in an EquipSet + * gets the total weight in an EquipSet. * - * @param idPath + * @param idPath The root of the equipment set (or subset) * @return equipment set weight */ public double getEquipSetWeightDouble(final String idPath) @@ -1322,20 +1340,16 @@ if (eqI != null) { - if ((eqI.getCarried().floatValue() > 0.0f) - && (eqI.getParent() == null)) + if ((eqI.getCarried() > 0.0f) && (eqI.getParent() == null)) { if (eqI.getChildCount() > 0) { totalWeight += - (eqI.getWeightAsDouble(this) + eqI - .getContainedWeight(this).floatValue()); + (eqI.getWeightAsDouble(this) + eqI.getContainedWeight(this)); } else { - totalWeight += - (eqI.getWeightAsDouble(this) * eqI.getCarried() - .floatValue()); + totalWeight += (eqI.getWeightAsDouble(this) * eqI.getCarried()); } } } @@ -1347,8 +1361,8 @@ /** * Count the total number of items of aName within EquipSet idPath * - * @param idPath - * @param aName + * @param idPath The root of the equipment set (or subset) + * @param aName The equipment to count * @return equipment set count */ public Float getEquipSetCount(final String idPath, final String aName) @@ -1366,6 +1380,10 @@ return equipmentFacet.getSet(id); } + /** + * Get the character's "equipped" equipment + * @return a set of the "equipped" equipment + */ public Set<Equipment> getEquippedEquipmentSet() { return equippedFacet.getSet(id); @@ -1390,9 +1408,10 @@ * of equipment have the same outputIndex they will be ordered by name. Note * hidden items (outputIndex = -1) are not included in this list. * - * Deals with merge as well + * Deals with merge as well. See the Constants package for acceptable values + * of merge . * - * @param merge + * @param merge controls how much merging is done. * * @return An ArrayList of the equipment objects in output order. */ @@ -1402,7 +1421,7 @@ } /** - * Get equipment master list + * Get equipment master list. * * @return equipment master list */ @@ -1416,7 +1435,7 @@ } /** - * Get equipment master list in output order + * Get equipment master list in output order. * * @return equipment master list in output order */ @@ -1459,7 +1478,7 @@ } /** - * Set the characters eye colour + * Set the characters eye colour. * * @param aString * the colour of their eyes @@ -1470,7 +1489,7 @@ } /** - * Get the characters eye colour + * Get the characters eye colour. * * @return the colour of their eyes */ @@ -1512,13 +1531,16 @@ double startAdjust = rangeLevel == 0 ? 0 : startLevel / rangeLevel; - pool += - Math.floor((this.totalNonMonsterLevels() >= startLevel) ? 1.0d - + pcpool - startAdjust + 0.0001 : pcpool + 0.0001); - pool += Math.floor(mpool + 0.0001); - pool += Math.floor(bonus + 0.0001); - pool += Math.floor(classLvlBonus + 0.0001); + double nonMonsterAdjustment = + this.totalNonMonsterLevels() >= startLevel + ? 1.0d + pcpool - startAdjust + : pcpool; + pool += CoreUtility.epsilonFloor(nonMonsterAdjustment); + pool += CoreUtility.epsilonFloor(mpool); + pool += CoreUtility.epsilonFloor(bonus); + pool += CoreUtility.epsilonFloor(classLvlBonus); + Logging.debugPrint(""); //$NON-NLS-1$ Logging.debugPrint("Total Bonus: " + pool); //$NON-NLS-1$ Logging.debugPrint("=============="); //$NON-NLS-1$ @@ -1543,15 +1565,13 @@ if (lvlPerFeat != 0) { double bonus = (double) getLevel(pcClass) / lvlPerFeat; - Double existing = - featByLevelType.get(pcClass.get(StringKey.LEVEL_TYPE)); + Double existing = featByLevelType.get(pcClass.get(StringKey.LEVEL_TYPE)); if (existing == null) { existing = 0d; } existing += bonus; - featByLevelType - .put(pcClass.get(StringKey.LEVEL_TYPE), existing); + featByLevelType.put(pcClass.get(StringKey.LEVEL_TYPE), existing); } } @@ -1559,7 +1579,7 @@ for (String lvlType : featByLevelType.keySet()) { Double existing = featByLevelType.get(lvlType); - bonus += Math.floor(existing + 0.0001); + bonus += CoreUtility.epsilonFloor(existing); } return bonus; } @@ -1586,7 +1606,7 @@ /** * Sets the filename of the character. * - * @param newFileName + * @param newFileName the name of the file this character will be saved in */ public void setFileName(final String newFileName) { @@ -1616,7 +1636,6 @@ /** * Returns a very descriptive name for the character. * - * <p> * The format is [name] the [level]th level [race name] [classes] * * @return A descriptive string name for the character. @@ -1624,14 +1643,21 @@ public String getFullDisplayName() { final int levels = getTotalLevels(); + final String displayClass; // If you aren't multi-classed, don't display redundant class level // information in addition to the total PC level - return new StringBuffer().append(getName()).append(" the ").append( - levels).append(getOrdinal(levels)).append(" level ").append( - getDisplayRaceName()).append(' ').append( - (classFacet.getCount(id) < 2) ? getDisplayClassName() - : getFullDisplayClassName()).toString(); + displayClass = classFacet.getCount(id) < 2 ? getDisplayClassName() : getFullDisplayClassName(); + + return new StringBuffer() + .append(getName()) + .append(" the ") + .append(levels) + .append(getOrdinal(levels)) + .append(" level ") + .append(getDisplayRaceName()) + .append(' ') + .append(displayClass).toString(); } /** @@ -1863,6 +1889,11 @@ /* * TODO This is a discussion we have to have about where items are sorted */ + + /** + * Get a sorted list of the languages that this character knows + * @return a sorted list of language objects + */ public Set<Language> getSortedLanguageSet() { return new TreeSet<Language>(languageFacet.getSet(id)); @@ -1895,36 +1926,32 @@ * <p> * <b>Note</b>: This whole structure is kind of messed up since nothing * enforces that a companion mod of a given type always looks at the same - * variable (either Class or Variable). + * variable (either Class or Variable). Note it seems that this used to + * be driven off types but now it's driven from a list of companion mods + * but the java doc has not been updated. * - * @param compType - * A type of companion to get level for + * @param compList + * A list of companionMods to get level for * @return The effective level for this companion type */ - public int getEffectiveCompanionLevel(final CompanionList compType) + public int getEffectiveCompanionLevel(final CompanionList compList) { - final Collection<CompanionMod> mods = - Globals.getCompanionMods(compType); + final Collection<CompanionMod> mods = Globals.getCompanionMods(compList); + for (CompanionMod cMod : mods) { - Map<String, Integer> varmap = - cMod.getMapFor(MapKey.APPLIED_VARIABLE); - for (Iterator<String> iType = varmap.keySet().iterator(); iType - .hasNext();) - { - final String varName = iType.next(); - final int lvl = - this.getVariableValue(varName, Constants.EMPTY_STRING) - .intValue(); - if (lvl > 0) - { + Map<String, Integer> varmap = cMod.getMapFor(MapKey.APPLIED_VARIABLE); + + for (final String varName : varmap.keySet()) { + final int lvl = this.getVariableValue(varName, Constants.EMPTY_STRING).intValue(); + if (lvl > 0) { return lvl; } } - Map<CDOMSingleRef<? extends PCClass>, Integer> ac = - cMod.getMapFor(MapKey.APPLIED_CLASS); - for (Map.Entry<CDOMSingleRef<? extends PCClass>, Integer> me : ac - .entrySet()) + + Map<CDOMSingleRef<? extends PCClass>, Integer> ac = cMod.getMapFor(MapKey.APPLIED_CLASS); + + for (Map.Entry<CDOMSingleRef<? extends PCClass>, Integer> me : ac.entrySet()) { PCClass pcclass = me.getKey().resolvesTo(); String key = pcclass.getKeyName(); @@ -2127,9 +2154,9 @@ // Setup the default EquipSet if not already present if (!hasEquipSet()) { - String id = getNewIdPath(null); + String idPath = getNewIdPath(null); EquipSet eSet = - new EquipSet(id, PropertyFactory.getString("in_ieDefault")); + new EquipSet(idPath, PropertyFactory.getString("in_ieDefault")); addEquipSet(eSet); } @@ -2172,12 +2199,12 @@ } /** - * Returns the maximum number of followers of the specified type this - * character can have. This method does not adjust for any followers already - * selected by the character. + * Returns the maximum number of followers this character can have from + * the given companion list. This method does not adjust for any followers + * already selected by the character. * - * @param aType - * The follower type to check e.g. Familiar + * @param cList + * A list of potential follower races * @return The max number of followers -1 for any number */ public int getMaxFollowers(CompanionList cList) @@ -2228,7 +2255,9 @@ * * @param aType * Type of follower to retrieve list for e.g. Familiar - * @return A List of FollowerOption objects representing the possible list + * @param comp + * the comparator that will be used to order the returned map. + * @return A MAP of FollowerOption objects representing the possible list * of follower choices. */ public Map<FollowerOption, CDOMObject> getAvailableFollowers(final String aType, Comparator<FollowerOption> comp) @@ -2237,7 +2266,7 @@ } /** - * Get the Follower object that is the "master" for this object + * Get the Follower object that is the "master" for this object. * * @return follower master */ @@ -2247,7 +2276,7 @@ } /** - * Get the PlayerCharacter that is the "master" for this object + * Get the PlayerCharacter that is the "master" for this object. * * @return master PC */ @@ -2383,11 +2412,19 @@ return getSafeStringFor(StringKey.PLAYERS_NAME); } - public void setPoolAmount(final int anInt) + /** + * Set the value of the feat pool. + * @param pool value to set the feat pool to + */ + public void setPoolAmount(final int pool) { - poolAmount = anInt; + poolAmount = pool; } + /** + * Get the value of the feat pool. + * @return the feat pool amount + */ public int getPoolAmount() { return poolAmount; @@ -2415,7 +2452,7 @@ } /** - * Selector + * Selector gets the character's primary weapons. * * @return primary weapons */ @@ -2425,9 +2462,9 @@ } /** - * Get race + * Get the character's race. * - * @return race + * @return the character's race */ public Race getRace() { @@ -2435,20 +2472,20 @@ } /** - * Set region + * Set the character's region. * - * @param arg + * @param region the character's region */ - public void setRegion(final String arg) + public void setRegion(final String region) { - Region r = Region.getConstant(arg); + Region r = Region.getConstant(region); regionFacet.setRegion(id, r); } /** - * Set sub region + * Set the character's sub region. * - * @param aString + * @param aString the character's sub region */ public void setSubRegion(final String aString) { @@ -2457,7 +2494,7 @@ } /** - * Selector <p/> Build on-the-fly so removing templates won't mess up region + * Selector build on-the-fly so removing templates won't mess up region. * * @return character region */ @@ -2469,7 +2506,7 @@ /** * Get region set by setRegion (ignores Templates) * - * @return region + * @return the character's region */ public String getCharacterRegion() { @@ -2477,9 +2514,9 @@ } /** - * Set residence + * Set the character's residence. * - * @param aString + * @param aString the character's residence */ public void setResidence(final String aString) { @@ -2487,7 +2524,7 @@ } /** - * Get residence + * Get the character's residence. * * @return residence */ @@ -2497,7 +2534,7 @@ } /** - * Selector + * Get the character's secondary weapons. * * @return secondary weapons */ @@ -2507,9 +2544,9 @@ } /** - * Get HTML sheet for selected character + * Set the location of the HTML sheet for this character. * - * @param aString + * @param aString the location of the HTML sheet */ public void setSelectedCharacterHTMLOutputSheet(final String aString) { @@ -2517,7 +2554,7 @@ } /** - * Location of HTML Output Sheet + * Get the Location of HTML Output Sheet to be used for this character. * * @return HTML output sheet */ @@ -2527,9 +2564,9 @@ } /** - * Set selected PDF character sheet for character + * Set the location of the PDF Output Sheet for this character. * - * @param aString + * @param aString the location of the PDF Output Sheet */ public void setSelectedCharacterPDFOutputSheet(final String aString) { @@ -2537,7 +2574,7 @@ } /** - * Location of PDF Output Sheet + * Get the ocation of the PDF Output Sheet to be used for this character. * * @return pdf output sheet */ Modified: Trunk/pcgen/code/src/java/pcgen/core/utils/CoreUtility.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/utils/CoreUtility.java 2011-05-04 08:18:30 UTC (rev 14909) +++ Trunk/pcgen/code/src/java/pcgen/core/utils/CoreUtility.java 2011-05-04 20:20:07 UTC (rev 14910) @@ -51,6 +51,9 @@ */ public final class CoreUtility { + + static final private double epsilon = 0.0001d; + public static final Comparator<Equipment> equipmentComparator = new Comparator<Equipment>() { private int compareInts(final int obj1Index, final int obj2Index) @@ -233,10 +236,21 @@ public static boolean doublesEqual(final double a, final double b) { // If the difference is less than epsilon, treat as equal. - return compareDouble(a, b, 0.0001); + return compareDouble(a, b, epsilon); } /** + * protect the floor function from the vagaries of floating point precision. + * @param d the double that we would like the floor value for + * @return the floor after adding epsilon + */ + public static double epsilonFloor (double d) + { + return Math.floor(d + epsilon); + } + + + /** * Changes a path to make sure all instances of \ or / are replaced with * File.separatorChar. * @@ -422,7 +436,7 @@ /** * Merge the equipment list * - * @param aList + * @param equip * the collection of Equipment * @param merge * The type of merge to perform @@ -469,13 +483,12 @@ if (eq1.getName().equals(eq2.getName())) { // merge all like equipment together - if (merge == Constants.MERGE_ALL || + if (merge == Constants.MERGE_ALL // merge like equipment within same container - (merge == Constants.MERGE_LOCATION - && (eq1.getLocation() == eq2.getLocation()) && eq1 - .getParentName() - .equals(eq2.getParentName()))) + || (merge == Constants.MERGE_LOCATION + && (eq1.getLocation() == eq2.getLocation()) + && eq1.getParentName().equals(eq2.getParentName()))) { workingList.remove(eq2); eQty += eq2.qty(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nu...@us...> - 2011-05-14 23:52:09
|
Revision: 14988 http://pcgen.svn.sourceforge.net/pcgen/?rev=14988&view=rev Author: nuance Date: 2011-05-14 23:52:02 +0000 (Sat, 14 May 2011) Log Message: ----------- Oops, fix broken compile. Use 4 argument version of addEquipment. fix bug in addWeaponToLocation, wasn't handlinjg two anded properly. Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/Equipment.java Trunk/pcgen/code/src/java/pcgen/core/character/EquipSet.java Modified: Trunk/pcgen/code/src/java/pcgen/core/Equipment.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/Equipment.java 2011-05-14 23:00:55 UTC (rev 14987) +++ Trunk/pcgen/code/src/java/pcgen/core/Equipment.java 2011-05-14 23:52:02 UTC (rev 14988) @@ -6642,7 +6642,9 @@ */ public void addWeaponToLocation(Float num, EquipmentLocation eLoc, PlayerCharacter aPC) { - setNumberEquipped(num.intValue()); + Float numEquipped = (eLoc == EquipmentLocation.EQUIPPED_TWO_HANDS) ? 2f : num; + setNumberEquipped(numEquipped.intValue()); + setLocation(eLoc); if (eLoc != EquipmentLocation.EQUIPPED_NEITHER) Modified: Trunk/pcgen/code/src/java/pcgen/core/character/EquipSet.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/character/EquipSet.java 2011-05-14 23:00:55 UTC (rev 14987) +++ Trunk/pcgen/code/src/java/pcgen/core/character/EquipSet.java 2011-05-14 23:52:02 UTC (rev 14988) @@ -441,15 +441,15 @@ // it's inside a container, don't try to equip if (aTok.countTokens() > Constants.ID_PATH_LENGTH_FOR_NON_CONTAINED) { - eq_item.addEquipmentToLocation(qty, EquipmentLocation.CONTAINED, aPC); + eq_item.addEquipmentToLocation(qty, EquipmentLocation.CONTAINED, false, aPC); } else if (getName().startsWith(Constants.EQUIP_LOCATION_CARRIED)) { - eq_item.addEquipmentToLocation(qty, EquipmentLocation.CARRIED_NEITHER, aPC); + eq_item.addEquipmentToLocation(qty, EquipmentLocation.CARRIED_NEITHER, false, aPC); } else if (getName().startsWith(Constants.EQUIP_LOCATION_NOTCARRIED)) { - eq_item.addEquipmentToLocation(qty, EquipmentLocation.NOT_CARRIED, aPC); + eq_item.addEquipmentToLocation(qty, EquipmentLocation.NOT_CARRIED, false, aPC); } else if (eq_item.isWeapon()) { @@ -477,10 +477,10 @@ } else if (getName().equals(Constants.EQUIP_LOCATION_TWOWEAPONS)) { - Float foo = (qty.doubleValue() < 2.0) ? 2.0f : qty; + Float quantity = (qty.doubleValue() < 2.0) ? 2.0f : qty; - setQty(foo); - eq_item.addWeaponToLocation(foo, EquipmentLocation.EQUIPPED_TWO_HANDS, aPC); + setQty(quantity); + eq_item.addWeaponToLocation(quantity, EquipmentLocation.EQUIPPED_TWO_HANDS, aPC); } else if (getName().equals(Constants.EQUIP_LOCATION_SHIELD)) { @@ -489,7 +489,7 @@ } else { - eq_item.addEquipmentToLocation(qty, EquipmentLocation.EQUIPPED_NEITHER, aPC); + eq_item.addEquipmentToLocation(qty, EquipmentLocation.EQUIPPED_NEITHER, true, aPC); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nu...@us...> - 2011-05-15 01:20:35
|
Revision: 14989 http://pcgen.svn.sourceforge.net/pcgen/?rev=14989&view=rev Author: nuance Date: 2011-05-15 01:20:29 +0000 (Sun, 15 May 2011) Log Message: ----------- Finish refactor of PlayerCharacter method. I have moved the behaviour into Equipment and EquipSet where it belonged. Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java Trunk/pcgen/code/src/java/pcgen/core/character/EquipSet.java Modified: Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2011-05-14 23:52:02 UTC (rev 14988) +++ Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2011-05-15 01:20:29 UTC (rev 14989) @@ -782,132 +782,15 @@ // then set status to equipped and add to PC's equipment list for (EquipSet es : pcEquipSetList) { - final String abCalcId = calcId + Constants.EQUIP_SET_PATH_SEPARATOR; - final String abParentId = - es.getParentIdPath() + Constants.EQUIP_SET_PATH_SEPARATOR; - - // calcId = 0.1. - // parentIdPath = 0.10. - // OR - // calcId = 0.10. - // parentIdPath = 0.1. - if (!abParentId.startsWith(abCalcId)) + if (es.getItem() == null || !es.isPartOf(calcId)) { continue; } - final Equipment eqI = es.getItem(); + es.equipItem(this); + es.addNoteToItem(); - if (eqI == null) - { - continue; - } - - final Equipment eq = es.getItem(); - final String aLoc = es.getName(); - final String aNote = es.getNote(); - Float num = es.getQty(); - final StringTokenizer aTok = - new StringTokenizer(es.getIdPath(), Constants.EQUIP_SET_PATH_SEPARATOR); - - // if the eSet.getIdPath() is longer than 3 - // it's inside a container, don't try to equip - if (aTok.countTokens() > Constants.ID_PATH_LENGTH_FOR_NON_CONTAINED) - { - eq.setLocation(EquipmentLocation.CONTAINED); - eq.setIsEquipped(false, this); - eq.setNumberCarried(num); - eq.setQty(num); - } - else if (aLoc.startsWith(Constants.EQUIP_LOCATION_CARRIED)) - { - eq.setLocation(EquipmentLocation.CARRIED_NEITHER); - eq.setIsEquipped(false, this); - eq.setNumberCarried(num); - eq.setQty(num); - } - else if (aLoc.startsWith(Constants.EQUIP_LOCATION_NOTCARRIED)) - { - eq.setLocation(EquipmentLocation.NOT_CARRIED); - eq.setIsEquipped(false, this); - eq.setNumberCarried(0f); - eq.setQty(num); - } - else if (eq.isWeapon()) - { - if (aLoc.equals(Constants.EQUIP_LOCATION_PRIMARY) - || aLoc.equals(Constants.EQUIP_LOCATION_NATURAL_PRIMARY)) - { - eq.setQty(num); - eq.setNumberCarried(num); - eq.setNumberEquipped(num.intValue()); - eq.setLocation(EquipmentLocation.EQUIPPED_PRIMARY); - eq.setIsEquipped(true, this); - } - else if (aLoc.startsWith(Constants.EQUIP_LOCATION_SECONDARY) - || aLoc.equals(Constants.EQUIP_LOCATION_NATURAL_SECONDARY)) - { - eq.setQty(num); - eq.setNumberCarried(num); - eq.setNumberEquipped(num.intValue()); - eq.setLocation(EquipmentLocation.EQUIPPED_SECONDARY); - eq.setIsEquipped(true, this); - } - else if (aLoc.equals(Constants.EQUIP_LOCATION_BOTH)) - { - eq.setQty(num); - eq.setNumberCarried(num); - eq.setNumberEquipped(num.intValue()); - eq.setLocation(EquipmentLocation.EQUIPPED_BOTH); - eq.setIsEquipped(true, this); - } - else if (aLoc.equals(Constants.EQUIP_LOCATION_DOUBLE)) - { - eq.setQty(num); - eq.setNumberCarried(num); - eq.setNumberEquipped(2); - eq.setLocation(EquipmentLocation.EQUIPPED_TWO_HANDS); - eq.setIsEquipped(true, this); - } - else if (aLoc.equals(Constants.EQUIP_LOCATION_UNARMED)) - { - eq.setLocation(EquipmentLocation.EQUIPPED_NEITHER); - eq.setNumberEquipped(num.intValue()); - } - else if (aLoc.equals(Constants.EQUIP_LOCATION_TWOWEAPONS)) - { - if (num.doubleValue() < 2.0) - { - num = new Float(2.0); - } - - es.setQty(num); - eq.setQty(num); - eq.setNumberCarried(num); - eq.setNumberEquipped(2); - eq.setLocation(EquipmentLocation.EQUIPPED_TWO_HANDS); - eq.setIsEquipped(true, this); - } - else if (aLoc.equals(Constants.EQUIP_LOCATION_SHIELD)) - { - eq.setLocation(EquipmentLocation.EQUIPPED_NEITHER); - eq.setNumberEquipped(num.intValue()); - } - } - else - { - eq.setLocation(EquipmentLocation.EQUIPPED_NEITHER); - eq.setIsEquipped(true, this); - eq.setNumberCarried(num); - eq.setQty(num); - } - - if ((aNote != null) && (aNote.length() > 0)) - { - eq.setNote(aNote); - } - - addLocalEquipment(eq); + addLocalEquipment(es.getItem()); } // loop through all equipment and make sure that @@ -11463,7 +11346,6 @@ * * @param addNew * - * * @return */ public List<AbilitySelection> feats( Modified: Trunk/pcgen/code/src/java/pcgen/core/character/EquipSet.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/character/EquipSet.java 2011-05-14 23:52:02 UTC (rev 14988) +++ Trunk/pcgen/code/src/java/pcgen/core/character/EquipSet.java 2011-05-15 01:20:29 UTC (rev 14989) @@ -420,7 +420,7 @@ } /** - * true if temp bonus list is not empty + * true if temp bonus list is not empty. * @return true if temp bonus list is not empty */ public boolean useTempBonusList() @@ -430,8 +430,7 @@ /** * Apply this EquipSet to a PlayerCharacter object. - * @param aPC the PC to quip the item on - * + * @param aPC the PC to equip the item on */ public void equipItem(PlayerCharacter aPC) { @@ -443,46 +442,46 @@ { eq_item.addEquipmentToLocation(qty, EquipmentLocation.CONTAINED, false, aPC); } - else if (getName().startsWith(Constants.EQUIP_LOCATION_CARRIED)) + else if (name.startsWith(Constants.EQUIP_LOCATION_CARRIED)) { eq_item.addEquipmentToLocation(qty, EquipmentLocation.CARRIED_NEITHER, false, aPC); } - else if (getName().startsWith(Constants.EQUIP_LOCATION_NOTCARRIED)) + else if (name.startsWith(Constants.EQUIP_LOCATION_NOTCARRIED)) { eq_item.addEquipmentToLocation(qty, EquipmentLocation.NOT_CARRIED, false, aPC); } else if (eq_item.isWeapon()) { - if (getName().equals(Constants.EQUIP_LOCATION_PRIMARY) - || getName().equals(Constants.EQUIP_LOCATION_NATURAL_PRIMARY)) + if (name.equals(Constants.EQUIP_LOCATION_PRIMARY) + || name.equals(Constants.EQUIP_LOCATION_NATURAL_PRIMARY)) { eq_item.addWeaponToLocation(qty, EquipmentLocation.EQUIPPED_PRIMARY, aPC); } - else if (getName().startsWith(Constants.EQUIP_LOCATION_SECONDARY) - || getName().equals(Constants.EQUIP_LOCATION_NATURAL_SECONDARY)) + else if (name.startsWith(Constants.EQUIP_LOCATION_SECONDARY) + || name.equals(Constants.EQUIP_LOCATION_NATURAL_SECONDARY)) { eq_item.addWeaponToLocation(qty, EquipmentLocation.EQUIPPED_SECONDARY, aPC); } - else if (getName().equals(Constants.EQUIP_LOCATION_BOTH)) + else if (name.equals(Constants.EQUIP_LOCATION_BOTH)) { eq_item.addWeaponToLocation(qty, EquipmentLocation.EQUIPPED_BOTH, aPC); } - else if (getName().equals(Constants.EQUIP_LOCATION_DOUBLE)) + else if (name.equals(Constants.EQUIP_LOCATION_DOUBLE)) { eq_item.addWeaponToLocation(qty, EquipmentLocation.EQUIPPED_TWO_HANDS, aPC); } - else if (getName().equals(Constants.EQUIP_LOCATION_UNARMED)) + else if (name.equals(Constants.EQUIP_LOCATION_UNARMED)) { eq_item.addWeaponToLocation(qty, EquipmentLocation.EQUIPPED_NEITHER, aPC); } - else if (getName().equals(Constants.EQUIP_LOCATION_TWOWEAPONS)) + else if (name.equals(Constants.EQUIP_LOCATION_TWOWEAPONS)) { Float quantity = (qty.doubleValue() < 2.0) ? 2.0f : qty; setQty(quantity); eq_item.addWeaponToLocation(quantity, EquipmentLocation.EQUIPPED_TWO_HANDS, aPC); } - else if (getName().equals(Constants.EQUIP_LOCATION_SHIELD)) + else if (name.equals(Constants.EQUIP_LOCATION_SHIELD)) { eq_item.addWeaponToLocation(qty, EquipmentLocation.EQUIPPED_NEITHER, aPC); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2012-01-15 21:32:43
|
Revision: 15822 http://pcgen.svn.sourceforge.net/pcgen/?rev=15822&view=rev Author: thpr Date: 2012-01-15 21:32:37 +0000 (Sun, 15 Jan 2012) Log Message: ----------- First step in moving spell lists to facets Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/PCClass.java Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java Trunk/pcgen/code/src/java/pcgen/core/analysis/SubClassApplication.java Modified: Trunk/pcgen/code/src/java/pcgen/core/PCClass.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PCClass.java 2012-01-15 20:53:47 UTC (rev 15821) +++ Trunk/pcgen/code/src/java/pcgen/core/PCClass.java 2012-01-15 21:32:37 UTC (rev 15822) @@ -652,7 +652,7 @@ public void addClassSpellList(CDOMListObject<Spell> list, PlayerCharacter pc) { pc.addAssoc(this, AssociationListKey.CLASSSPELLLIST, list); - pc.removeAllAssocs(this, AssociationListKey.SPELL_LIST_CACHE); + pc.clearSpellCache(this); } /* @@ -1744,8 +1744,7 @@ @Override public List<? extends CDOMList<Spell>> getSpellLists(PlayerCharacter pc) { - List<CDOMList<Spell>> stableSpellList = pc.getAssocList(this, - AssociationListKey.SPELL_LIST_CACHE); + List<CDOMList<Spell>> stableSpellList = pc.getSpellCache(this); if (stableSpellList != null) { return stableSpellList; @@ -1763,14 +1762,14 @@ if (classSpellList == null) { ClassSpellList defaultList = get(ObjectKey.CLASS_SPELLLIST); - pc.addAssoc(this, AssociationListKey.SPELL_LIST_CACHE, defaultList); + pc.addToSpellCache(this, defaultList); return Collections.singletonList(defaultList); } } - for (CDOMListObject<Spell> keyStr : classSpellList) + for (CDOMListObject<Spell> list : classSpellList) { - pc.addAssoc(this, AssociationListKey.SPELL_LIST_CACHE, keyStr); + pc.addToSpellCache(this, list); } return classSpellList; } Modified: Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2012-01-15 20:53:47 UTC (rev 15821) +++ Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2012-01-15 21:32:37 UTC (rev 15822) @@ -56,6 +56,7 @@ import pcgen.cdom.base.AssociatedPrereqObject; import pcgen.cdom.base.BonusContainer; import pcgen.cdom.base.CDOMList; +import pcgen.cdom.base.CDOMListObject; import pcgen.cdom.base.CDOMObject; import pcgen.cdom.base.CDOMObjectUtilities; import pcgen.cdom.base.CDOMReference; @@ -12753,4 +12754,19 @@ hitPointFacet.remove(id, pcl); } + public void clearSpellCache(PCClass cl) + { + removeAllAssocs(cl, AssociationListKey.SPELL_LIST_CACHE); + } + + public void addToSpellCache(PCClass cl, CDOMListObject<Spell> list) + { + addAssoc(cl, AssociationListKey.SPELL_LIST_CACHE, list); + } + + public List<CDOMList<Spell>> getSpellCache(PCClass cl) + { + return getAssocList(cl, AssociationListKey.SPELL_LIST_CACHE); + } + } Modified: Trunk/pcgen/code/src/java/pcgen/core/analysis/SubClassApplication.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/analysis/SubClassApplication.java 2012-01-15 20:53:47 UTC (rev 15821) +++ Trunk/pcgen/code/src/java/pcgen/core/analysis/SubClassApplication.java 2012-01-15 21:32:37 UTC (rev 15822) @@ -27,7 +27,6 @@ import pcgen.cdom.base.Constants; import pcgen.cdom.enumeration.AssociationKey; -import pcgen.cdom.enumeration.AssociationListKey; import pcgen.cdom.enumeration.IntegerKey; import pcgen.cdom.enumeration.ListKey; import pcgen.cdom.enumeration.ObjectKey; @@ -271,7 +270,7 @@ } } - pc.removeAllAssocs(cl, AssociationListKey.SPELL_LIST_CACHE); + pc.clearSpellCache(cl); cl.getSpellLists(pc); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2012-01-17 00:52:48
|
Revision: 15835 http://pcgen.svn.sourceforge.net/pcgen/?rev=15835&view=rev Author: thpr Date: 2012-01-17 00:52:41 +0000 (Tue, 17 Jan 2012) Log Message: ----------- No more getPObjectList() - all CDOMObjects now Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java Trunk/pcgen/code/src/java/pcgen/core/analysis/SpellLevel.java Modified: Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2012-01-17 00:20:18 UTC (rev 15834) +++ Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2012-01-17 00:52:41 UTC (rev 15835) @@ -8173,133 +8173,100 @@ List<? extends CDOMObject> getCDOMObjectList() { List<CDOMObject> list = new ArrayList<CDOMObject>(); - for (CDOMObject po : getPObjectList()) - { - if (po != null) - { - list.add(po); - } - } - for (PCClass cl : getClassSet()) - { - for (int i = 1; i <= getLevel(cl); i++) - { - PCClassLevel classLevel = getActiveClassLevel(cl, i); - list.add(classLevel); - } - } - list.addAll(getConditionalTemplateObjects()); - return list; - } - private Collection<PCTemplate> getConditionalTemplateObjects() - { - return conditionalTemplateFacet.getSet(id); - } - - private List<? extends PObject> getPObjectList() - { - // Possible object types include: - // Campaigns - // Alignment (PCAlignment) - // BioSet (ageSet) - // Check (PObject) - // Class (PCClass) - // CompanionMod - // Deity - // Domain (CharacterDomain) - // Equipment (includes EqMods) - // Feat (virtual feats, auto feats) - // Race - // SizeAdjustment - // Skill - // Stat (PCStat) - // Template (PCTemplate) - // - - final ArrayList<PObject> results = new ArrayList<PObject>(); - // Loaded campaigns - results.addAll(expandedCampaignFacet.getSet(id)); - + list.addAll(expandedCampaignFacet.getSet(id)); + // Alignment PCAlignment align = alignmentFacet.get(id); if (align != null) { - results.add(align); + list.add(align); } - + // armorProfList is still just a list of Strings // results.addAll(getArmorProfList()); // BioSet - results.add(bioSetFacet.get(id)); - - results.addAll(checkFacet.getSet(id)); - + list.add(bioSetFacet.get(id)); + + list.addAll(checkFacet.getSet(id)); + // Class - results.addAll(classFacet.getClassSet(id)); - + list.addAll(classFacet.getClassSet(id)); + // CompanionMod - results.addAll(companionModFacet.getSet(id)); - + list.addAll(companionModFacet.getSet(id)); + // Deity Deity deity = deityFacet.get(id); if (deity != null) { - results.add(deity); + list.add(deity); } - + // Domain - results.addAll(domainFacet.getSet(id)); - + list.addAll(domainFacet.getSet(id)); + // Equipment for (Equipment eq : activeEquipmentFacet.getSet(id)) { - results.add(eq); - + list.add(eq); + for (EquipmentModifier eqMod : eq.getEqModifierList(true)) { - results.add(eqMod); + list.add(eqMod); } - + for (EquipmentModifier eqMod : eq.getEqModifierList(false)) { - results.add(eqMod); + list.add(eqMod); } } - + // Feats and abilities (virtual feats, auto feats) List<Ability> abilities = getFullAbilityList(); - results.addAll(abilities); - + list.addAll(abilities); + // Race Race race = raceFacet.get(id); if (race != null) { - results.add(race); + list.add(race); } - + // SizeAdjustment SizeAdjustment sa = sizeFacet.getSizeAdjustment(id); if (sa != null) { - results.add(sa); + list.add(sa); } - + // Skill - results.addAll(skillFacet.getSet(id)); - + list.addAll(skillFacet.getSet(id)); + // Stat (PCStat) - results.addAll(statFacet.getSet(id)); - + list.addAll(statFacet.getSet(id)); + // Template (PCTemplate) - results.addAll(templateFacet.getSet(id)); + list.addAll(templateFacet.getSet(id)); - // weaponProfList is still just a list of Strings - // results.addAll(getWeaponProfList()); - return results; + for (PCClass cl : getClassSet()) + { + for (int i = 1; i <= getLevel(cl); i++) + { + PCClassLevel classLevel = getActiveClassLevel(cl, i); + list.add(classLevel); + } + } + list.addAll(getConditionalTemplateObjects()); + return list; } + private Collection<PCTemplate> getConditionalTemplateObjects() + { + return conditionalTemplateFacet.getSet(id); + } + /** * @param level */ @@ -10977,7 +10944,7 @@ public boolean hasSpellInSpellbook(Spell spell, String spellbookname) { - for (PObject po : getPObjectList()) + for (CDOMObject po : getCDOMObjectList()) { List<CharacterSpell> csl = getCharacterSpells(po, spell, spellbookname, -1); @@ -11499,7 +11466,7 @@ * @return list of CharacterSpells from the character spell list */ public final List<CharacterSpell> getCharacterSpells( - PObject spellSource, + CDOMObject spellSource, final Spell aSpell, final String book, final int level) Modified: Trunk/pcgen/code/src/java/pcgen/core/analysis/SpellLevel.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/analysis/SpellLevel.java 2012-01-17 00:20:18 UTC (rev 15834) +++ Trunk/pcgen/code/src/java/pcgen/core/analysis/SpellLevel.java 2012-01-17 00:52:41 UTC (rev 15835) @@ -10,6 +10,7 @@ import pcgen.base.util.HashMapToList; import pcgen.cdom.base.AssociatedPrereqObject; import pcgen.cdom.base.CDOMList; +import pcgen.cdom.base.CDOMObject; import pcgen.cdom.base.CDOMReference; import pcgen.cdom.base.MasterListInterface; import pcgen.cdom.enumeration.AssociationKey; @@ -21,7 +22,6 @@ import pcgen.core.Domain; import pcgen.core.Globals; import pcgen.core.PCClass; -import pcgen.core.PObject; import pcgen.core.PlayerCharacter; import pcgen.core.character.CharacterSpell; import pcgen.core.prereq.PrereqHandler; @@ -226,7 +226,7 @@ * @param cSpells * The list to be populated with the spells */ - public static void addBonusKnowSpellsToList(PlayerCharacter pc, PObject aClass, + public static void addBonusKnowSpellsToList(PlayerCharacter pc, CDOMObject aClass, List<CharacterSpell> cSpells) { if (!(aClass instanceof PCClass)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2012-01-17 00:56:25
|
Revision: 15836 http://pcgen.svn.sourceforge.net/pcgen/?rev=15836&view=rev Author: thpr Date: 2012-01-17 00:56:18 +0000 (Tue, 17 Jan 2012) Log Message: ----------- Method move 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/SizeAdjustment.java Modified: Trunk/pcgen/code/src/java/pcgen/core/Equipment.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/Equipment.java 2012-01-17 00:52:41 UTC (rev 15835) +++ Trunk/pcgen/code/src/java/pcgen/core/Equipment.java 2012-01-17 00:56:18 UTC (rev 15836) @@ -3578,7 +3578,7 @@ if (newSize != null) { mult = - newSize.getBonusTo(pc, "ITEMCAPACITY", eq + pc.getSizeBonusTo(newSize, "ITEMCAPACITY", eq .typeList(), 1.0); } @@ -4010,9 +4010,9 @@ } final double saDbl = - saSize.getBonusTo(aPC, "ITEMCOST", typeList(), 1.0); + aPC.getSizeBonusTo(saSize, "ITEMCOST", typeList(), 1.0); final double saBaseDbl = - saBase.getBonusTo(aPC, "ITEMCOST", typeList(), 1.0); + aPC.getSizeBonusTo(saBase, "ITEMCOST", typeList(), 1.0); final double mult = saDbl / saBaseDbl; c = c.multiply(new BigDecimal(mult)); @@ -4357,8 +4357,8 @@ } final double mult = - newSA.getBonusTo(aPC, "ITEMWEIGHT", typeList(), 1.0) - / currSA.getBonusTo(aPC, "ITEMWEIGHT", typeList(), 1.0); + aPC.getSizeBonusTo(newSA, "ITEMWEIGHT", typeList(), 1.0) + / aPC.getSizeBonusTo(currSA, "ITEMWEIGHT", typeList(), 1.0); return getBaseWeight().multiply(new BigDecimal(mult)); } @@ -4391,9 +4391,9 @@ if ((newSA != null) && (currSA != null)) { mult = - newSA - .getBonusTo(aPC, "ACVALUE", baseEq.typeList(), 1.0) - / currSA.getBonusTo(aPC, "ACVALUE", baseEq + aPC + .getSizeBonusTo(newSA, "ACVALUE", baseEq.typeList(), 1.0) + / aPC.getSizeBonusTo(currSA, "ACVALUE", baseEq .typeList(), 1.0); } Modified: Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2012-01-17 00:52:41 UTC (rev 15835) +++ Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2012-01-17 00:56:18 UTC (rev 15836) @@ -12737,4 +12737,26 @@ { classSpellListFacet.addDefaultSpellList(id, pcc); } + + double getSizeBonusTo(SizeAdjustment sizeAdjustment, final String bonusType, final List<String> typeList, double defaultValue) + { + for ( String type : typeList ) + { + /* + * TODO: The standard for these bonuses should probably be TYPE=, but + * the bonus objects only correctly match TYPE. The bonus objects + * probably need to be reevaluated to standardize this usage + */ + final double a = BonusCalc.bonusTo(sizeAdjustment, bonusType, "TYPE." + type, this, this); + + if (!CoreUtility.doublesEqual(a, 0.0)) + { + defaultValue = a; + + break; + } + } + + return defaultValue; + } } Modified: Trunk/pcgen/code/src/java/pcgen/core/SizeAdjustment.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/SizeAdjustment.java 2012-01-17 00:52:41 UTC (rev 15835) +++ Trunk/pcgen/code/src/java/pcgen/core/SizeAdjustment.java 2012-01-17 00:56:18 UTC (rev 15836) @@ -25,9 +25,7 @@ import pcgen.cdom.enumeration.StringKey; import pcgen.core.analysis.BonusActivation; -import pcgen.core.analysis.BonusCalc; import pcgen.core.bonus.BonusObj; -import pcgen.core.utils.CoreUtility; import pcgen.util.Logging; /** @@ -60,28 +58,6 @@ return super.getActiveBonuses(aPC); } - double getBonusTo(final PlayerCharacter aPC, final String bonusType, final List<String> typeList, double defaultValue) - { - for ( String type : typeList ) - { - /* - * TODO: The standard for these bonuses should probably be TYPE=, but - * the bonus objects only correctly match TYPE. The bonus objects - * probably need to be reevaluated to standardize this usage - */ - final double a = BonusCalc.bonusTo(this, bonusType, "TYPE." + type, aPC, aPC); - - if (!CoreUtility.doublesEqual(a, 0.0)) - { - defaultValue = a; - - break; - } - } - - return defaultValue; - } - public double getLoadMultiplier() { final BigDecimal value = SettingsHandler.getGame().getLoadInfo() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2012-03-17 15:29:22
|
Revision: 16511 http://pcgen.svn.sourceforge.net/pcgen/?rev=16511&view=rev Author: thpr Date: 2012-03-17 15:29:16 +0000 (Sat, 17 Mar 2012) Log Message: ----------- cleanup Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/Ability.java Trunk/pcgen/code/src/java/pcgen/core/Deity.java Trunk/pcgen/code/src/java/pcgen/core/Equipment.java Trunk/pcgen/code/src/java/pcgen/core/PCClass.java Trunk/pcgen/code/src/java/pcgen/core/PCTemplate.java Trunk/pcgen/code/src/java/pcgen/core/Race.java Trunk/pcgen/code/src/java/pcgen/core/Skill.java Modified: Trunk/pcgen/code/src/java/pcgen/core/Ability.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/Ability.java 2012-03-17 15:28:58 UTC (rev 16510) +++ Trunk/pcgen/code/src/java/pcgen/core/Ability.java 2012-03-17 15:29:16 UTC (rev 16511) @@ -32,7 +32,6 @@ import pcgen.cdom.enumeration.ListKey; import pcgen.cdom.enumeration.MapKey; import pcgen.cdom.enumeration.ObjectKey; -import pcgen.cdom.enumeration.SourceFormat; import pcgen.cdom.enumeration.Type; import pcgen.cdom.helper.Aspect; import pcgen.cdom.list.AbilityList; Modified: Trunk/pcgen/code/src/java/pcgen/core/Deity.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/Deity.java 2012-03-17 15:28:58 UTC (rev 16510) +++ Trunk/pcgen/code/src/java/pcgen/core/Deity.java 2012-03-17 15:29:16 UTC (rev 16511) @@ -31,7 +31,6 @@ import pcgen.cdom.enumeration.ListKey; import pcgen.cdom.enumeration.ObjectKey; import pcgen.cdom.enumeration.Pantheon; -import pcgen.cdom.enumeration.SourceFormat; import pcgen.cdom.list.DomainList; import pcgen.cdom.reference.CDOMDirectSingleRef; import pcgen.core.facade.AlignmentFacade; Modified: Trunk/pcgen/code/src/java/pcgen/core/Equipment.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/Equipment.java 2012-03-17 15:28:58 UTC (rev 16510) +++ Trunk/pcgen/code/src/java/pcgen/core/Equipment.java 2012-03-17 15:29:16 UTC (rev 16511) @@ -60,7 +60,6 @@ import pcgen.cdom.enumeration.IntegerKey; import pcgen.cdom.enumeration.ListKey; import pcgen.cdom.enumeration.ObjectKey; -import pcgen.cdom.enumeration.SourceFormat; import pcgen.cdom.enumeration.StringKey; import pcgen.cdom.enumeration.Type; import pcgen.cdom.helper.Capacity; Modified: Trunk/pcgen/code/src/java/pcgen/core/PCClass.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PCClass.java 2012-03-17 15:28:58 UTC (rev 16510) +++ Trunk/pcgen/code/src/java/pcgen/core/PCClass.java 2012-03-17 15:29:16 UTC (rev 16511) @@ -50,7 +50,6 @@ import pcgen.cdom.enumeration.MapKey; import pcgen.cdom.enumeration.ObjectKey; import pcgen.cdom.enumeration.Region; -import pcgen.cdom.enumeration.SourceFormat; import pcgen.cdom.enumeration.StringKey; import pcgen.cdom.enumeration.Type; import pcgen.cdom.enumeration.VariableKey; Modified: Trunk/pcgen/code/src/java/pcgen/core/PCTemplate.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PCTemplate.java 2012-03-17 15:28:58 UTC (rev 16510) +++ Trunk/pcgen/code/src/java/pcgen/core/PCTemplate.java 2012-03-17 15:29:16 UTC (rev 16511) @@ -31,7 +31,6 @@ import pcgen.cdom.enumeration.IntegerKey; import pcgen.cdom.enumeration.ListKey; import pcgen.cdom.enumeration.ObjectKey; -import pcgen.cdom.enumeration.SourceFormat; import pcgen.core.bonus.BonusObj; import pcgen.core.facade.TemplateFacade; import pcgen.util.enumeration.Visibility; Modified: Trunk/pcgen/code/src/java/pcgen/core/Race.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/Race.java 2012-03-17 15:28:58 UTC (rev 16510) +++ Trunk/pcgen/code/src/java/pcgen/core/Race.java 2012-03-17 15:29:16 UTC (rev 16511) @@ -30,7 +30,6 @@ import pcgen.cdom.enumeration.ListKey; import pcgen.cdom.enumeration.ObjectKey; import pcgen.cdom.enumeration.RaceType; -import pcgen.cdom.enumeration.SourceFormat; import pcgen.core.facade.GenderFacade; import pcgen.core.facade.RaceFacade; import pcgen.core.facade.SimpleFacade; Modified: Trunk/pcgen/code/src/java/pcgen/core/Skill.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/Skill.java 2012-03-17 15:28:58 UTC (rev 16510) +++ Trunk/pcgen/code/src/java/pcgen/core/Skill.java 2012-03-17 15:29:16 UTC (rev 16511) @@ -26,7 +26,6 @@ import pcgen.base.lang.StringUtil; import pcgen.cdom.enumeration.ObjectKey; -import pcgen.cdom.enumeration.SourceFormat; import pcgen.cdom.enumeration.Type; import pcgen.core.facade.SkillFacade; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jde...@us...> - 2012-06-11 02:38:11
|
Revision: 16848 http://pcgen.svn.sourceforge.net/pcgen/?rev=16848&view=rev Author: jdempsey Date: 2012-06-11 02:38:05 +0000 (Mon, 11 Jun 2012) Log Message: ----------- New UI - Create Temporary Bonuses Tab * Add support for bonuses applied to equipment. Issue#: CODE-1220 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/BonusManager.java Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java Modified: Trunk/pcgen/code/src/java/pcgen/core/BonusManager.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/BonusManager.java 2012-06-11 02:06:22 UTC (rev 16847) +++ Trunk/pcgen/code/src/java/pcgen/core/BonusManager.java 2012-06-11 02:38:05 UTC (rev 16848) @@ -811,9 +811,11 @@ return returnMap; } - public void addTempBonus(BonusObj bonus, Object source, Object target) + public TempBonusInfo addTempBonus(BonusObj bonus, Object source, Object target) { - tempBonusBySource.put(bonus, new TempBonusInfo(source, target)); + TempBonusInfo tempBonusInfo = new TempBonusInfo(source, target); + tempBonusBySource.put(bonus, tempBonusInfo); + return tempBonusInfo; } public void removeTempBonus(BonusObj bonus) Modified: Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2012-06-11 02:06:22 UTC (rev 16847) +++ Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2012-06-11 02:38:05 UTC (rev 16848) @@ -108,6 +108,7 @@ import pcgen.cdom.list.DomainSpellList; import pcgen.cdom.reference.CDOMGroupRef; import pcgen.cdom.reference.CDOMSingleRef; +import pcgen.core.BonusManager.TempBonusInfo; import pcgen.core.analysis.AddObjectActions; import pcgen.core.analysis.BonusActivation; import pcgen.core.analysis.BonusCalc; @@ -3121,11 +3122,13 @@ * @param aBonus The bonus object to add. * @param source The source of the temporary bonus * @param target The object getting the bonus (typically the PC, can also be equipment). + * @return The bonus info representing the added instance of the bonus. */ - public void addTempBonus(final BonusObj aBonus, Object source, Object target) + public TempBonusInfo addTempBonus(final BonusObj aBonus, Object source, Object target) { - bonusManager.addTempBonus(aBonus, source, target); + TempBonusInfo tempBonusInfo = bonusManager.addTempBonus(aBonus, source, target); setDirty(true); + return tempBonusInfo; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jde...@us...> - 2012-09-19 10:40:18
|
Revision: 17360 http://pcgen.svn.sourceforge.net/pcgen/?rev=17360&view=rev Author: jdempsey Date: 2012-09-19 10:40:09 +0000 (Wed, 19 Sep 2012) Log Message: ----------- Fix bug: Mismatched Brackets should error gracefully Issue#: CODE-1643 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/AbilityCategory.java Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java Trunk/pcgen/code/src/java/pcgen/core/utils/LastGroupSeparator.java Modified: Trunk/pcgen/code/src/java/pcgen/core/AbilityCategory.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/AbilityCategory.java 2012-09-19 09:14:44 UTC (rev 17359) +++ Trunk/pcgen/code/src/java/pcgen/core/AbilityCategory.java 2012-09-19 10:40:09 UTC (rev 17360) @@ -53,6 +53,7 @@ import pcgen.cdom.reference.ReferenceManufacturer; import pcgen.cdom.reference.UnconstructedValidator; import pcgen.core.facade.AbilityCategoryFacade; +import pcgen.core.utils.LastGroupSeparator.GroupingMismatchException; import pcgen.util.Logging; import pcgen.system.LanguageBundle; import pcgen.util.enumeration.View; @@ -643,8 +644,15 @@ if (activeObj == null) { List<String> choices = new ArrayList<String>(); - String reduced = AbilityUtilities.getUndecoratedName(name, choices); - activeObj = rm.getObject(reduced); + try + { + String reduced = AbilityUtilities.getUndecoratedName(name, choices); + activeObj = rm.getObject(reduced); + } + catch (GroupingMismatchException e) + { + Logging.log(Logging.LST_ERROR, e.getMessage()); + } if (activeObj == null) { // Really not constructed... Modified: Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java 2012-09-19 09:14:44 UTC (rev 17359) +++ Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java 2012-09-19 10:40:09 UTC (rev 17360) @@ -38,6 +38,7 @@ import pcgen.core.chooser.ChooserUtilities; import pcgen.core.utils.CoreUtility; import pcgen.core.utils.LastGroupSeparator; +import pcgen.core.utils.LastGroupSeparator.GroupingMismatchException; /** * General utilities related to the Ability class. @@ -333,10 +334,11 @@ * completed * * @return the name with sub-choices stripped from it + * @throws GroupingMismatchException If there are mismatched brackets */ public static String getUndecoratedName( final String name, - final Collection<String> specifics) + final Collection<String> specifics) throws GroupingMismatchException { LastGroupSeparator lgs = new LastGroupSeparator(name); String subName = lgs.process(); Modified: Trunk/pcgen/code/src/java/pcgen/core/utils/LastGroupSeparator.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/utils/LastGroupSeparator.java 2012-09-19 09:14:44 UTC (rev 17359) +++ Trunk/pcgen/code/src/java/pcgen/core/utils/LastGroupSeparator.java 2012-09-19 10:40:09 UTC (rev 17360) @@ -36,7 +36,7 @@ startingString = baseString; } - public String process() + public String process() throws GroupingMismatchException { StringTokenizer base = new StringTokenizer(startingString, "()", true); root = new StringBuilder(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2012-12-29 01:46:01
|
Revision: 18834 http://sourceforge.net/p/pcgen/code/18834 Author: thpr Date: 2012-12-29 01:45:58 +0000 (Sat, 29 Dec 2012) Log Message: ----------- Isolate HandsTerm Remove last reference to HandsFacet in PlayerCharacter Issue#: CODE-1916 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java Trunk/pcgen/code/src/java/pcgen/core/term/PCHandsTermEvaluator.java Modified: Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2012-12-28 21:06:56 UTC (rev 18833) +++ Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2012-12-29 01:45:58 UTC (rev 18834) @@ -139,7 +139,6 @@ import pcgen.cdom.facet.analysis.FavoredClassFacet; import pcgen.cdom.facet.analysis.FollowerLimitFacet; import pcgen.cdom.facet.analysis.GlobalSkillCostFacet; -import pcgen.cdom.facet.analysis.HandsFacet; import pcgen.cdom.facet.analysis.LegalDeityFacet; import pcgen.cdom.facet.analysis.LegsFacet; import pcgen.cdom.facet.analysis.LevelFacet; @@ -292,7 +291,6 @@ private ChronicleEntryFacet chronicleEntryFacet = FacetLibrary.getFacet(ChronicleEntryFacet.class); private ClassSpellListFacet classSpellListFacet = FacetLibrary.getFacet(ClassSpellListFacet.class); private DomainSpellCountFacet domainSpellCountFacet = FacetLibrary.getFacet(DomainSpellCountFacet.class); - private HandsFacet handsFacet = FacetLibrary.getFacet(HandsFacet.class); private LegalDeityFacet legalDeityFacet = FacetLibrary.getFacet(LegalDeityFacet.class); private LegsFacet legsFacet = FacetLibrary.getFacet(LegsFacet.class); private MoneyFacet moneyFacet = FacetLibrary.getFacet(MoneyFacet.class); @@ -9471,16 +9469,6 @@ } /** - * Determine the number of hands the character has. - * - * @return The number of hands. - */ - public int getHands() - { - return handsFacet.getHands(id); - } - - /** * Determine the number of legs the character has. * * @return The number of legs. Modified: Trunk/pcgen/code/src/java/pcgen/core/term/PCHandsTermEvaluator.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/term/PCHandsTermEvaluator.java 2012-12-28 21:06:56 UTC (rev 18833) +++ Trunk/pcgen/code/src/java/pcgen/core/term/PCHandsTermEvaluator.java 2012-12-29 01:45:58 UTC (rev 18834) @@ -40,7 +40,7 @@ @Override public Float resolve(PlayerCharacter pc) { - return (float) pc.getHands(); + return (float) pc.getDisplay().getHands(); } @Override This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2012-12-29 01:47:48
|
Revision: 18835 http://sourceforge.net/p/pcgen/code/18835 Author: thpr Date: 2012-12-29 01:47:45 +0000 (Sat, 29 Dec 2012) Log Message: ----------- Isolate LegsTerm from PlayerCharacter Remove last LegsFacet reference from PlayerCharacter Issue#: CODE-1916 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java Trunk/pcgen/code/src/java/pcgen/core/term/PCLegsTermEvaluator.java Modified: Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2012-12-29 01:45:58 UTC (rev 18834) +++ Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2012-12-29 01:47:45 UTC (rev 18835) @@ -140,7 +140,6 @@ import pcgen.cdom.facet.analysis.FollowerLimitFacet; import pcgen.cdom.facet.analysis.GlobalSkillCostFacet; import pcgen.cdom.facet.analysis.LegalDeityFacet; -import pcgen.cdom.facet.analysis.LegsFacet; import pcgen.cdom.facet.analysis.LevelFacet; import pcgen.cdom.facet.analysis.LevelTableFacet; import pcgen.cdom.facet.analysis.ListSkillCostFacet; @@ -292,7 +291,6 @@ private ClassSpellListFacet classSpellListFacet = FacetLibrary.getFacet(ClassSpellListFacet.class); private DomainSpellCountFacet domainSpellCountFacet = FacetLibrary.getFacet(DomainSpellCountFacet.class); private LegalDeityFacet legalDeityFacet = FacetLibrary.getFacet(LegalDeityFacet.class); - private LegsFacet legsFacet = FacetLibrary.getFacet(LegsFacet.class); private MoneyFacet moneyFacet = FacetLibrary.getFacet(MoneyFacet.class); private MonsterCSkillFacet monCSkillFacet = FacetLibrary.getFacet(MonsterCSkillFacet.class); private NonAbilityFacet nonAbilityFacet = FacetLibrary.getFacet(NonAbilityFacet.class); @@ -9469,16 +9467,6 @@ } /** - * Determine the number of legs the character has. - * - * @return The number of legs. - */ - public int getLegs() - { - return legsFacet.getLegs(id); - } - - /** * Gets a list of ability objects whose name is the same as that of the ability object * passed in, no matter what category they were added in. * Modified: Trunk/pcgen/code/src/java/pcgen/core/term/PCLegsTermEvaluator.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/term/PCLegsTermEvaluator.java 2012-12-29 01:45:58 UTC (rev 18834) +++ Trunk/pcgen/code/src/java/pcgen/core/term/PCLegsTermEvaluator.java 2012-12-29 01:47:45 UTC (rev 18835) @@ -40,7 +40,7 @@ @Override public Float resolve(PlayerCharacter pc) { - return (float) pc.getLegs(); + return (float) pc.getDisplay().getLegs(); } @Override This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2012-12-29 02:16:02
|
Revision: 18839 http://sourceforge.net/p/pcgen/code/18839 Author: thpr Date: 2012-12-29 02:15:58 +0000 (Sat, 29 Dec 2012) Log Message: ----------- Isolate Vision-related Term from PlayerCharacter Remove last reference to VisionFacet in PlayerCharacter Issue#: CODE-1916 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java Trunk/pcgen/code/src/java/pcgen/core/display/CharacterDisplay.java Trunk/pcgen/code/src/java/pcgen/core/term/PCCountVisionTermEvaluator.java Modified: Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2012-12-29 02:12:06 UTC (rev 18838) +++ Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2012-12-29 02:15:58 UTC (rev 18839) @@ -152,7 +152,6 @@ import pcgen.cdom.facet.analysis.TotalWeightFacet; import pcgen.cdom.facet.analysis.UnlockedStatFacet; import pcgen.cdom.facet.analysis.VariableFacet; -import pcgen.cdom.facet.analysis.VisionFacet; import pcgen.cdom.facet.base.AbstractStorageFacet; import pcgen.cdom.facet.fact.AgeFacet; import pcgen.cdom.facet.fact.CharacterTypeFacet; @@ -305,7 +304,6 @@ private SubstitutionClassFacet substitutionClassFacet = FacetLibrary.getFacet(SubstitutionClassFacet.class); private TotalWeightFacet totalWeightFacet = FacetLibrary.getFacet(TotalWeightFacet.class); private UnlockedStatFacet unlockedStatFacet = FacetLibrary.getFacet(UnlockedStatFacet.class); - private VisionFacet visionFacet = FacetLibrary.getFacet(VisionFacet.class); /* * Note "minimal" here means getDirty is allowed on a set, it may be used in @@ -10674,11 +10672,6 @@ return spellBookFacet.containsBookNamed(id, bookName); } - public int getVisionCount() - { - return visionFacet.getVisionCount(id); - } - public Load getLoadType() { return loadFacet.getLoadType(id); Modified: Trunk/pcgen/code/src/java/pcgen/core/display/CharacterDisplay.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/display/CharacterDisplay.java 2012-12-29 02:12:06 UTC (rev 18838) +++ Trunk/pcgen/code/src/java/pcgen/core/display/CharacterDisplay.java 2012-12-29 02:15:58 UTC (rev 18839) @@ -1787,4 +1787,9 @@ return subTypesFacet.getCount(id); } + public int getVisionCount() + { + return visionFacet.getVisionCount(id); + } + } Modified: Trunk/pcgen/code/src/java/pcgen/core/term/PCCountVisionTermEvaluator.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/term/PCCountVisionTermEvaluator.java 2012-12-29 02:12:06 UTC (rev 18838) +++ Trunk/pcgen/code/src/java/pcgen/core/term/PCCountVisionTermEvaluator.java 2012-12-29 02:15:58 UTC (rev 18839) @@ -39,7 +39,7 @@ @Override public Float resolve(PlayerCharacter pc) { - return (float) pc.getVisionCount(); + return (float) pc.getDisplay().getVisionCount(); } @Override This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2012-12-29 02:23:06
|
Revision: 18840 http://sourceforge.net/p/pcgen/code/18840 Author: thpr Date: 2012-12-29 02:23:03 +0000 (Sat, 29 Dec 2012) Log Message: ----------- Isolate BaseMovement-related Term from PlayerCharacter Remove last reference to BaseMovementFacet from PlayerCharacter Issue#: CODE-1916 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java Trunk/pcgen/code/src/java/pcgen/core/display/CharacterDisplay.java Trunk/pcgen/code/src/java/pcgen/core/term/PCMoveBaseTermEvaluator.java Modified: Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2012-12-29 02:15:58 UTC (rev 18839) +++ Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2012-12-29 02:23:03 UTC (rev 18840) @@ -132,7 +132,6 @@ import pcgen.cdom.facet.UserTemplateFacet; import pcgen.cdom.facet.XPTableFacet; import pcgen.cdom.facet.analysis.AgeSetFacet; -import pcgen.cdom.facet.analysis.BaseMovementFacet; import pcgen.cdom.facet.analysis.ChangeProfFacet; import pcgen.cdom.facet.analysis.CharacterSpellResistanceFacet; import pcgen.cdom.facet.analysis.FavoredClassFacet; @@ -282,7 +281,6 @@ private AutoListArmorProfFacet armorProfListFacet = FacetLibrary.getFacet(AutoListArmorProfFacet.class); private AutoListShieldProfFacet shieldProfListFacet = FacetLibrary.getFacet(AutoListShieldProfFacet.class); private AutoListWeaponProfFacet alWeaponProfFacet = FacetLibrary.getFacet(AutoListWeaponProfFacet.class); - private BaseMovementFacet baseMovementFacet = FacetLibrary.getFacet(BaseMovementFacet.class); private BonusWeaponProfFacet wpBonusFacet = FacetLibrary.getFacet(BonusWeaponProfFacet.class); private ChronicleEntryFacet chronicleEntryFacet = FacetLibrary.getFacet(ChronicleEntryFacet.class); private ClassSpellListFacet classSpellListFacet = FacetLibrary.getFacet(ClassSpellListFacet.class); @@ -11164,11 +11162,6 @@ return changeProfFacet.getWeaponProfsInTarget(id, master); } - public Double getBaseMovement() - { - return baseMovementFacet.getSet(id).iterator().next().getDoubleMovement(); - } - public void setSubstitutionClassName(PCClassLevel lvl, String subClassKey) { substitutionClassFacet.add(id, lvl, subClassKey); Modified: Trunk/pcgen/code/src/java/pcgen/core/display/CharacterDisplay.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/display/CharacterDisplay.java 2012-12-29 02:15:58 UTC (rev 18839) +++ Trunk/pcgen/code/src/java/pcgen/core/display/CharacterDisplay.java 2012-12-29 02:23:03 UTC (rev 18840) @@ -1792,4 +1792,9 @@ return visionFacet.getVisionCount(id); } + public Double getBaseMovement() + { + return baseMovementFacet.getSet(id).iterator().next().getDoubleMovement(); + } + } Modified: Trunk/pcgen/code/src/java/pcgen/core/term/PCMoveBaseTermEvaluator.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/term/PCMoveBaseTermEvaluator.java 2012-12-29 02:15:58 UTC (rev 18839) +++ Trunk/pcgen/code/src/java/pcgen/core/term/PCMoveBaseTermEvaluator.java 2012-12-29 02:23:03 UTC (rev 18840) @@ -46,7 +46,7 @@ @Override public String evaluate (PlayerCharacter pc) { - return pc.getBaseMovement().toString(); + return pc.getDisplay().getBaseMovement().toString(); } @Override This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2012-12-29 02:47:39
|
Revision: 18842 http://sourceforge.net/p/pcgen/code/18842 Author: thpr Date: 2012-12-29 02:47:36 +0000 (Sat, 29 Dec 2012) Log Message: ----------- Make all Gender reads from CharacterDisplay Issue#: CODE-1905 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/BioSet.java Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java Modified: Trunk/pcgen/code/src/java/pcgen/core/BioSet.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/BioSet.java 2012-12-29 02:35:32 UTC (rev 18841) +++ Trunk/pcgen/code/src/java/pcgen/core/BioSet.java 2012-12-29 02:47:36 UTC (rev 18842) @@ -568,7 +568,7 @@ while (genderTok.hasMoreTokens()) { - if (genderTok.nextToken().equals(pc.getGenderObject().toString())) + if (genderTok.nextToken().equals(pc.getDisplay().getGenderObject().toString())) { final String htWtLine = genderTok.nextToken(); final StringTokenizer htwtTok = new StringTokenizer(htWtLine, "|", false); Modified: Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2012-12-29 02:35:32 UTC (rev 18841) +++ Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2012-12-29 02:47:36 UTC (rev 18842) @@ -278,6 +278,11 @@ * Note "pure" here means no getDirty call, and absolutely no other stuff in * the method. Also any method is not used elsewhere in PlayerCharacter */ + //The following facets are write-only isolated (dirty in a set is allowed) + private AllowDebtFacet allowDebtFacet = FacetLibrary.getFacet(AllowDebtFacet.class); + private IgnoreCostFacet ignoreCostFacet = FacetLibrary.getFacet(IgnoreCostFacet.class); + private GenderFacet genderFacet = FacetLibrary.getFacet(GenderFacet.class); + //The following facets are pure delegation (no exceptions) - could be considered "complete" private AddedTemplateFacet addedTemplateFacet = FacetLibrary.getFacet(AddedTemplateFacet.class); private AutoListArmorProfFacet armorProfListFacet = FacetLibrary.getFacet(AutoListArmorProfFacet.class); @@ -289,8 +294,6 @@ private DomainSpellCountFacet domainSpellCountFacet = FacetLibrary.getFacet(DomainSpellCountFacet.class); private LegalDeityFacet legalDeityFacet = FacetLibrary.getFacet(LegalDeityFacet.class); private GoldFacet goldFacet = FacetLibrary.getFacet(GoldFacet.class); - private AllowDebtFacet allowDebtFacet = FacetLibrary.getFacet(AllowDebtFacet.class); - private IgnoreCostFacet ignoreCostFacet = FacetLibrary.getFacet(IgnoreCostFacet.class); private MonsterCSkillFacet monCSkillFacet = FacetLibrary.getFacet(MonsterCSkillFacet.class); private NonAbilityFacet nonAbilityFacet = FacetLibrary.getFacet(NonAbilityFacet.class); private ProhibitedSchoolFacet prohibitedSchoolFacet = FacetLibrary.getFacet(ProhibitedSchoolFacet.class); @@ -318,7 +321,6 @@ private AddLanguageFacet addLangFacet = FacetLibrary.getFacet(AddLanguageFacet.class); private AutoLanguageListFacet autoLangListFacet = FacetLibrary.getFacet(AutoLanguageListFacet.class); private FreeLanguageFacet freeLangFacet = FacetLibrary.getFacet(FreeLanguageFacet.class); - private GenderFacet genderFacet = FacetLibrary.getFacet(GenderFacet.class); private HandedFacet handedFacet = FacetLibrary.getFacet(HandedFacet.class); private HeightFacet heightFacet = FacetLibrary.getFacet(HeightFacet.class); private RegionFacet regionFacet = FacetLibrary.getFacet(RegionFacet.class); @@ -1368,21 +1370,6 @@ } /** - * Returns a string for the character's gender. - * - * <p> - * This method will return the stored gender or the template locked gender - * if there is one. This means the <tt>setGender()</tt> side effect is not - * really required. - * - * @return the character's gender. - */ - public Gender getGenderObject() - { - return genderFacet.getGender(id); - } - - /** * Sets the character's wealth. * * <p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2012-12-29 15:31:05
|
Revision: 18859 http://sourceforge.net/p/pcgen/code/18859 Author: thpr Date: 2012-12-29 15:31:02 +0000 (Sat, 29 Dec 2012) Log Message: ----------- Isolate additional terms from PlayerCharacter Issue#: CODE-1916 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/display/CharacterDisplay.java Trunk/pcgen/code/src/java/pcgen/core/term/ConstantZeroTermEvaluator.java Trunk/pcgen/code/src/java/pcgen/core/term/FixedTermEvaluator.java Trunk/pcgen/code/src/java/pcgen/core/term/PCMoveBaseTermEvaluator.java Trunk/pcgen/code/src/java/pcgen/core/term/PCScoreTermEvaluator.java Trunk/pcgen/code/src/java/pcgen/core/term/PCSkillRankTermEvaluator.java Trunk/pcgen/code/src/java/pcgen/core/term/PCStatBaseTermEvaluator.java Trunk/pcgen/code/src/java/pcgen/core/term/PCStatModTermEvaluator.java Trunk/pcgen/code/src/java/pcgen/core/term/PCStatTotalTermEvaluator.java Modified: Trunk/pcgen/code/src/java/pcgen/core/display/CharacterDisplay.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/display/CharacterDisplay.java 2012-12-29 15:26:36 UTC (rev 18858) +++ Trunk/pcgen/code/src/java/pcgen/core/display/CharacterDisplay.java 2012-12-29 15:31:02 UTC (rev 18859) @@ -61,6 +61,7 @@ import pcgen.cdom.facet.NoteItemFacet; import pcgen.cdom.facet.PrimaryWeaponFacet; import pcgen.cdom.facet.SecondaryWeaponFacet; +import pcgen.cdom.facet.SkillRankFacet; import pcgen.cdom.facet.SpellBookFacet; import pcgen.cdom.facet.SpellListFacet; import pcgen.cdom.facet.StatBonusFacet; @@ -219,6 +220,7 @@ private NoteItemFacet noteItemFacet = FacetLibrary.getFacet(NoteItemFacet.class); private SubRaceFacet subRaceFacet = FacetLibrary.getFacet(SubRaceFacet.class); private UserSpecialAbilityFacet userSpecialAbilityFacet = FacetLibrary.getFacet(UserSpecialAbilityFacet.class); + private SkillRankFacet skillRankFacet = FacetLibrary.getFacet(SkillRankFacet.class); private ShieldProfProviderFacet shieldProfFacet = FacetLibrary.getFacet(ShieldProfProviderFacet.class); private SpecialAbilityFacet specialAbilityFacet = FacetLibrary.getFacet(SpecialAbilityFacet.class); private SecondaryWeaponFacet secondaryWeaponFacet = FacetLibrary.getFacet(SecondaryWeaponFacet.class); @@ -1864,4 +1866,14 @@ return favClassFacet.getFavoredClassLevel(id); } + /** + * returns ranks taken specifically in skill + * + * @return ranks taken in skill + */ + public Float getRank(Skill sk) + { + return skillRankFacet.getRank(id, sk); + } + } Modified: Trunk/pcgen/code/src/java/pcgen/core/term/ConstantZeroTermEvaluator.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/term/ConstantZeroTermEvaluator.java 2012-12-29 15:26:36 UTC (rev 18858) +++ Trunk/pcgen/code/src/java/pcgen/core/term/ConstantZeroTermEvaluator.java 2012-12-29 15:31:02 UTC (rev 18859) @@ -26,10 +26,10 @@ package pcgen.core.term; -import pcgen.core.PlayerCharacter; +import pcgen.core.display.CharacterDisplay; public class ConstantZeroTermEvaluator - extends BasePCTermEvaluator implements TermEvaluator { + extends BasePCDTermEvaluator implements TermEvaluator { public ConstantZeroTermEvaluator(String originalText) { @@ -37,7 +37,7 @@ } @Override - public Float resolve(PlayerCharacter pc) + public Float resolve(CharacterDisplay display) { return 0f; } Modified: Trunk/pcgen/code/src/java/pcgen/core/term/FixedTermEvaluator.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/term/FixedTermEvaluator.java 2012-12-29 15:26:36 UTC (rev 18858) +++ Trunk/pcgen/code/src/java/pcgen/core/term/FixedTermEvaluator.java 2012-12-29 15:31:02 UTC (rev 18859) @@ -26,10 +26,10 @@ package pcgen.core.term; -import pcgen.core.PlayerCharacter; +import pcgen.core.display.CharacterDisplay; public class FixedTermEvaluator - extends BasePCTermEvaluator implements TermEvaluator + extends BasePCDTermEvaluator implements TermEvaluator { private final int value; @@ -39,7 +39,7 @@ } @Override - public Float resolve(PlayerCharacter pc) + public Float resolve(CharacterDisplay display) { return new Float(value); } Modified: Trunk/pcgen/code/src/java/pcgen/core/term/PCMoveBaseTermEvaluator.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/term/PCMoveBaseTermEvaluator.java 2012-12-29 15:26:36 UTC (rev 18858) +++ Trunk/pcgen/code/src/java/pcgen/core/term/PCMoveBaseTermEvaluator.java 2012-12-29 15:31:02 UTC (rev 18859) @@ -26,11 +26,11 @@ package pcgen.core.term; -import pcgen.core.PlayerCharacter; +import pcgen.core.display.CharacterDisplay; import pcgen.core.spell.Spell; public class PCMoveBaseTermEvaluator - extends BasePCTermEvaluator implements TermEvaluator + extends BasePCDTermEvaluator implements TermEvaluator { public PCMoveBaseTermEvaluator(String originalText) { @@ -38,21 +38,21 @@ } @Override - public Float resolve(PlayerCharacter pc) + public Float resolve(CharacterDisplay display) { - return convertToFloat(originalText, evaluate(pc)); + return convertToFloat(originalText, evaluate(display)); } @Override - public String evaluate (PlayerCharacter pc) + public String evaluate(CharacterDisplay display) { - return pc.getDisplay().getBaseMovement().toString(); + return display.getBaseMovement().toString(); } @Override - public String evaluate (PlayerCharacter pc, Spell aSpell) + public String evaluate (CharacterDisplay display, Spell aSpell) { - return evaluate(pc); + return evaluate(display); } @Override Modified: Trunk/pcgen/code/src/java/pcgen/core/term/PCScoreTermEvaluator.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/term/PCScoreTermEvaluator.java 2012-12-29 15:26:36 UTC (rev 18858) +++ Trunk/pcgen/code/src/java/pcgen/core/term/PCScoreTermEvaluator.java 2012-12-29 15:31:02 UTC (rev 18859) @@ -28,10 +28,10 @@ import pcgen.core.Globals; import pcgen.core.PCStat; -import pcgen.core.PlayerCharacter; +import pcgen.core.display.CharacterDisplay; public class PCScoreTermEvaluator - extends BasePCTermEvaluator implements TermEvaluator + extends BasePCDTermEvaluator implements TermEvaluator { private final String stat; @@ -42,7 +42,7 @@ } @Override - public Float resolve(PlayerCharacter pc) + public Float resolve(CharacterDisplay display) { if ("".equals(stat)) { @@ -50,7 +50,7 @@ } PCStat pcs = Globals.getContext().ref.getAbbreviatedObject( PCStat.class, stat); - return (float) pc.getTotalStatFor(pcs); + return (float) display.getTotalStatFor(pcs); } @Override Modified: Trunk/pcgen/code/src/java/pcgen/core/term/PCSkillRankTermEvaluator.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/term/PCSkillRankTermEvaluator.java 2012-12-29 15:26:36 UTC (rev 18858) +++ Trunk/pcgen/code/src/java/pcgen/core/term/PCSkillRankTermEvaluator.java 2012-12-29 15:31:02 UTC (rev 18859) @@ -27,12 +27,12 @@ package pcgen.core.term; import pcgen.core.Globals; -import pcgen.core.PlayerCharacter; import pcgen.core.Skill; +import pcgen.core.display.CharacterDisplay; import pcgen.core.spell.Spell; public class PCSkillRankTermEvaluator - extends BasePCTermEvaluator implements TermEvaluator + extends BasePCDTermEvaluator implements TermEvaluator { private final String rank; @@ -43,27 +43,27 @@ } @Override - public Float resolve(PlayerCharacter pc) + public Float resolve(CharacterDisplay display) { - return convertToFloat(originalText, evaluate(pc)); + return convertToFloat(originalText, evaluate(display)); } @Override - public String evaluate(PlayerCharacter pc) + public String evaluate(CharacterDisplay display) { Skill skill = Globals.getContext().ref .silentlyGetConstructedCDOMObject(Skill.class, rank); - if (skill == null || !pc.getDisplay().hasSkill(skill)) + if (skill == null || !display.hasSkill(skill)) { return "0.0"; } - return pc.getRank(skill).toString(); + return display.getRank(skill).toString(); } @Override - public String evaluate(PlayerCharacter pc, final Spell aSpell) { - return evaluate(pc); + public String evaluate(CharacterDisplay display, final Spell aSpell) { + return evaluate(display); } @Override Modified: Trunk/pcgen/code/src/java/pcgen/core/term/PCStatBaseTermEvaluator.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/term/PCStatBaseTermEvaluator.java 2012-12-29 15:26:36 UTC (rev 18858) +++ Trunk/pcgen/code/src/java/pcgen/core/term/PCStatBaseTermEvaluator.java 2012-12-29 15:31:02 UTC (rev 18859) @@ -28,10 +28,10 @@ import pcgen.core.Globals; import pcgen.core.PCStat; -import pcgen.core.PlayerCharacter; +import pcgen.core.display.CharacterDisplay; public class PCStatBaseTermEvaluator - extends BasePCTermEvaluator implements TermEvaluator + extends BasePCDTermEvaluator implements TermEvaluator { private final String statAbbrev; @@ -42,11 +42,11 @@ } @Override - public Float resolve(PlayerCharacter pc) + public Float resolve(CharacterDisplay display) { PCStat stat = Globals.getContext().ref.getAbbreviatedObject( PCStat.class, statAbbrev); - return (float) pc.getBaseStatFor(stat); + return (float) display.getBaseStatFor(stat); } @Override Modified: Trunk/pcgen/code/src/java/pcgen/core/term/PCStatModTermEvaluator.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/term/PCStatModTermEvaluator.java 2012-12-29 15:26:36 UTC (rev 18858) +++ Trunk/pcgen/code/src/java/pcgen/core/term/PCStatModTermEvaluator.java 2012-12-29 15:31:02 UTC (rev 18859) @@ -28,10 +28,10 @@ import pcgen.core.Globals; import pcgen.core.PCStat; -import pcgen.core.PlayerCharacter; +import pcgen.core.display.CharacterDisplay; public class PCStatModTermEvaluator - extends BasePCTermEvaluator implements TermEvaluator + extends BasePCDTermEvaluator implements TermEvaluator { private final String statAbbrev; @@ -42,11 +42,11 @@ } @Override - public Float resolve(PlayerCharacter pc) + public Float resolve(CharacterDisplay display) { final PCStat stat = Globals.getContext().ref .getAbbreviatedObject(PCStat.class, statAbbrev); - return (float) pc.getStatModFor(stat); + return (float) display.getStatModFor(stat); } @Override Modified: Trunk/pcgen/code/src/java/pcgen/core/term/PCStatTotalTermEvaluator.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/term/PCStatTotalTermEvaluator.java 2012-12-29 15:26:36 UTC (rev 18858) +++ Trunk/pcgen/code/src/java/pcgen/core/term/PCStatTotalTermEvaluator.java 2012-12-29 15:31:02 UTC (rev 18859) @@ -28,10 +28,10 @@ import pcgen.core.Globals; import pcgen.core.PCStat; -import pcgen.core.PlayerCharacter; +import pcgen.core.display.CharacterDisplay; public class PCStatTotalTermEvaluator - extends BasePCTermEvaluator implements TermEvaluator + extends BasePCDTermEvaluator implements TermEvaluator { private final String statAbbrev; @@ -42,11 +42,11 @@ } @Override - public Float resolve(PlayerCharacter pc) + public Float resolve(CharacterDisplay display) { PCStat stat = Globals.getContext().ref .getAbbreviatedObject(PCStat.class, statAbbrev); - return (float) pc.getTotalStatFor(stat); + return (float) display.getTotalStatFor(stat); } @Override This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2013-01-08 00:02:39
|
Revision: 19053 http://sourceforge.net/p/pcgen/code/19053 Author: thpr Date: 2013-01-08 00:02:35 +0000 (Tue, 08 Jan 2013) Log Message: ----------- Remove unused code Issue#: CODE-1906 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/BonusManager.java Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java Modified: Trunk/pcgen/code/src/java/pcgen/core/BonusManager.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/BonusManager.java 2013-01-07 23:50:38 UTC (rev 19052) +++ Trunk/pcgen/code/src/java/pcgen/core/BonusManager.java 2013-01-08 00:02:35 UTC (rev 19053) @@ -783,12 +783,6 @@ return checkpointMap != null && checkpointMap.equals(activeBonusMap); } - public void setTempBonusMap(Map<BonusObj, TempBonusInfo> tbl) - { - //Need to guarantee identity - tempBonusBySource = new IdentityHashMap<BonusObj, TempBonusInfo>(tbl); - } - public Map<BonusObj, TempBonusInfo> getTempBonusMap() { return new IdentityHashMap<BonusObj, TempBonusInfo>(tempBonusBySource); Modified: Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2013-01-07 23:50:38 UTC (rev 19052) +++ Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2013-01-08 00:02:35 UTC (rev 19053) @@ -10200,11 +10200,6 @@ return domainFacet.getSource(id, d); } - public void setTempBonusMap(Map<BonusObj, BonusManager.TempBonusInfo> tempBonusMap) - { - bonusManager.setTempBonusMap(tempBonusMap); - } - public Map<String, String> getBonusStrings(String bonusString, String substring) { return bonusManager.getBonuses(bonusString, substring); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <za...@us...> - 2013-10-15 10:47:54
|
Revision: 21716 http://sourceforge.net/p/pcgen/code/21716 Author: zaister Date: 2013-10-15 10:47:50 +0000 (Tue, 15 Oct 2013) Log Message: ----------- Duplicate detection does not work for various object types * Fix equals() method for affected object classes Issue#: CODE-2303 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/ArmorProf.java Trunk/pcgen/code/src/java/pcgen/core/PObject.java Trunk/pcgen/code/src/java/pcgen/core/ShieldProf.java Trunk/pcgen/code/src/java/pcgen/core/Skill.java Trunk/pcgen/code/src/java/pcgen/core/WeaponProf.java Trunk/pcgen/code/src/java/pcgen/core/spell/Spell.java Modified: Trunk/pcgen/code/src/java/pcgen/core/ArmorProf.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/ArmorProf.java 2013-10-15 08:36:32 UTC (rev 21715) +++ Trunk/pcgen/code/src/java/pcgen/core/ArmorProf.java 2013-10-15 10:47:50 UTC (rev 21716) @@ -46,13 +46,14 @@ /** * Compares keyName only * - * @param o1 Object + * @param obj Object * @return boolean */ @Override - public boolean equals(final Object o1) + public boolean equals(final Object obj) { - return o1 instanceof ArmorProf && getKeyName().equals(((ArmorProf) o1).getKeyName()); + return obj instanceof ArmorProf + && getKeyName().equalsIgnoreCase(((ArmorProf) obj).getKeyName()); } /** Modified: Trunk/pcgen/code/src/java/pcgen/core/PObject.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PObject.java 2013-10-15 08:36:32 UTC (rev 21715) +++ Trunk/pcgen/code/src/java/pcgen/core/PObject.java 2013-10-15 10:47:50 UTC (rev 21716) @@ -111,27 +111,8 @@ @Override public boolean equals( final Object obj ) { - if (obj == this) - { - return true; - } - if ( obj == null ) - { - return false; - } - final String thisKey; - final String otherKey; - if ( obj instanceof PObject ) - { - thisKey = getKeyName(); - otherKey = ((PObject)obj).getKeyName(); - } - else - { - thisKey = toString(); - otherKey = obj.toString(); - } - return thisKey.equalsIgnoreCase( otherKey ); + return obj instanceof PObject + && getKeyName().equalsIgnoreCase(((PObject) obj).getKeyName()); } //Temporarily commented out since unit tests are badly behaved, see COD#E-1895 Modified: Trunk/pcgen/code/src/java/pcgen/core/ShieldProf.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/ShieldProf.java 2013-10-15 08:36:32 UTC (rev 21715) +++ Trunk/pcgen/code/src/java/pcgen/core/ShieldProf.java 2013-10-15 10:47:50 UTC (rev 21716) @@ -46,13 +46,14 @@ /** * Compares keyName only * - * @param o1 Object + * @param obj Object * @return boolean */ @Override - public boolean equals(final Object o1) + public boolean equals(final Object obj) { - return o1 instanceof ShieldProf && getKeyName().equals(((ShieldProf) o1).getKeyName()); + return obj instanceof ShieldProf + && getKeyName().equalsIgnoreCase(((ShieldProf) obj).getKeyName()); } /** Modified: Trunk/pcgen/code/src/java/pcgen/core/Skill.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/Skill.java 2013-10-15 08:36:32 UTC (rev 21715) +++ Trunk/pcgen/code/src/java/pcgen/core/Skill.java 2013-10-15 10:47:50 UTC (rev 21716) @@ -51,8 +51,7 @@ public boolean equals(final Object obj) { return obj instanceof Skill - && getKeyName().equals(((Skill) obj).getKeyName()) - && isCDOMEqual(((Skill) obj)); + && getKeyName().equalsIgnoreCase(((Skill) obj).getKeyName()); } @Override Modified: Trunk/pcgen/code/src/java/pcgen/core/WeaponProf.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/WeaponProf.java 2013-10-15 08:36:32 UTC (rev 21715) +++ Trunk/pcgen/code/src/java/pcgen/core/WeaponProf.java 2013-10-15 10:47:50 UTC (rev 21716) @@ -70,7 +70,7 @@ public boolean equals(final Object obj) { return obj instanceof WeaponProf - && getKeyName().equals(((WeaponProf) obj).getKeyName()); + && getKeyName().equalsIgnoreCase(((WeaponProf) obj).getKeyName()); } /** Modified: Trunk/pcgen/code/src/java/pcgen/core/spell/Spell.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/spell/Spell.java 2013-10-15 08:36:32 UTC (rev 21715) +++ Trunk/pcgen/code/src/java/pcgen/core/spell/Spell.java 2013-10-15 10:47:50 UTC (rev 21716) @@ -76,30 +76,15 @@ /** * Tests to see if two Spell objects are equal. * - * @param other Spell to compare to. + * @param obj Spell to compare to. * * @return <tt>true</tt> if the Spells are the same. */ @Override - public boolean equals( final Object other ) + public boolean equals( final Object obj ) { - if ( other == null ) - { - return false; - } - if ( ! (other instanceof Spell) ) - { - return false; - } - if ( other == this ) { - return true; - } - final Spell otherSpell = (Spell)other; - if ( getKeyName().equals( otherSpell.getKeyName() ) ) - { - return isCDOMEqual(otherSpell); - } - return false; + return obj instanceof Spell + && getKeyName().equalsIgnoreCase(((Spell) obj).getKeyName()); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jde...@us...> - 2013-10-27 11:51:07
|
Revision: 21978 http://sourceforge.net/p/pcgen/code/21978 Author: jdempsey Date: 2013-10-27 11:51:02 +0000 (Sun, 27 Oct 2013) Log Message: ----------- Fix bug: Kits - Domain cannot be applied if it is in a subkit Issue#: CODE-2323 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/core/Kit.java Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java Trunk/pcgen/code/src/java/pcgen/core/kit/KitDeity.java Trunk/pcgen/code/src/java/pcgen/core/kit/KitKit.java Modified: Trunk/pcgen/code/src/java/pcgen/core/Kit.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/Kit.java 2013-10-27 09:55:44 UTC (rev 21977) +++ Trunk/pcgen/code/src/java/pcgen/core/Kit.java 2013-10-27 11:51:02 UTC (rev 21978) @@ -265,21 +265,40 @@ } /** - * + * Test applying the top level kit and record the choices made and any + * warnings encountered. Note these changes are made on a copy of the + * character. + * * @param aPC PlayerCharacter - * @param thingsToAdd List - * @param warnings List + * @param thingsToAdd List of kit actions to be taken. + * @param warnings List of issues to be reported to the user. */ public void testApplyKit(PlayerCharacter aPC, List<BaseKit> thingsToAdd, List<String> warnings) { + testApplyKit(aPC, thingsToAdd, warnings, false); + } + + /** + * Test applying the kit and record the choices made and any warnings + * encountered. Note these changes are made on a copy of the character. + * + * @param aPC PlayerCharacter + * @param thingsToAdd List of kit actions to be taken. + * @param warnings List of issues to be reported to the user. + * @param subkit Is this kit being added by a parent kit? + */ + public void testApplyKit(PlayerCharacter aPC, List<BaseKit> thingsToAdd, + List<String> warnings, boolean subkit) + { // Ensure a reset of random values from a prior run selectValue = -1; // We will create a copy of the PC since we may need to add classes and // levels to the PC that the user may choose not to apply. // NOTE: These methods need to be called in the correct order. - PlayerCharacter tempPC = (PlayerCharacter) aPC.clone(); + PlayerCharacter tempPC = subkit ? aPC : (PlayerCharacter) aPC.clone(); + for (KitStat kStat : getStats()) { kStat.testApply(this, tempPC, warnings); Modified: Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2013-10-27 09:55:44 UTC (rev 21977) +++ Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2013-10-27 11:51:02 UTC (rev 21978) @@ -427,7 +427,7 @@ private LevelInfoFacet levelInfoFacet = FacetLibrary.getFacet(LevelInfoFacet.class); - private ClassSource defaultDomainSource = null; + private ClassSource defaultDomainSource; private Map<String, Integer> autoEquipOutputOrderCache = new HashMap<String, Integer>(); @@ -8023,6 +8023,7 @@ aClone.outputSheetHTML = outputSheetHTML; aClone.outputSheetPDF = outputSheetPDF; aClone.ageSetKitSelections = new boolean[10]; + aClone.defaultDomainSource = defaultDomainSource; System.arraycopy(ageSetKitSelections, 0, aClone.ageSetKitSelections, 0, ageSetKitSelections.length); Modified: Trunk/pcgen/code/src/java/pcgen/core/kit/KitDeity.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/kit/KitDeity.java 2013-10-27 09:55:44 UTC (rev 21977) +++ Trunk/pcgen/code/src/java/pcgen/core/kit/KitDeity.java 2013-10-27 11:51:02 UTC (rev 21978) @@ -201,7 +201,15 @@ return false; } - + if (!aPC.hasDefaultDomainSource()) + { + warnings + .add("DEITY: Cannot add domain \"" + + domain.getDisplayName() + + "\" as the character does not have a domain " + + "source yet."); + return false; + } if (domainsToAdd == null) { domainsToAdd = new ArrayList<Domain>(); @@ -224,15 +232,14 @@ } aPC.setDeity(theDeity); - if (domainsToAdd == null) + if (domainsToAdd != null) { - return; + for (Domain domain : domainsToAdd) + { + aPC.addDomain(domain); + DomainApplication.applyDomain(aPC, domain); + } } - for (Domain domain : domainsToAdd) - { - aPC.addDomain(domain); - DomainApplication.applyDomain(aPC, domain); - } aPC.calcActiveBonuses(); theDeity = null; Modified: Trunk/pcgen/code/src/java/pcgen/core/kit/KitKit.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/core/kit/KitKit.java 2013-10-27 09:55:44 UTC (rev 21977) +++ Trunk/pcgen/code/src/java/pcgen/core/kit/KitKit.java 2013-10-27 11:51:02 UTC (rev 21978) @@ -76,7 +76,7 @@ { Kit addedKit = ref.resolvesTo(); ArrayList<BaseKit> thingsToAdd = new ArrayList<BaseKit>(); - addedKit.testApplyKit(aPC, thingsToAdd, warnings); + addedKit.testApplyKit(aPC, thingsToAdd, warnings, true); appliedKits.put(addedKit, thingsToAdd); } return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |