|
From: <th...@us...> - 2014-04-05 17:21:16
|
Revision: 23594
http://sourceforge.net/p/pcgen/code/23594
Author: thpr
Date: 2014-04-05 17:21:11 +0000 (Sat, 05 Apr 2014)
Log Message:
-----------
Increased consistency in how Skills are applied to a PC (relative to other objects)
One step in changing how skills are processed so that we can implement conditional skills under the new proposal
Issue#: CODE-2442, CODE-2448
Modified Paths:
--------------
Trunk/pcgen/code/src/itest/pcgen/io/SkillTargetSaveRestoreTest.java
Trunk/pcgen/code/src/java/applicationContext.xml
Trunk/pcgen/code/src/java/gmgen/plugin/PcgCombatant.java
Trunk/pcgen/code/src/java/pcgen/cdom/facet/analysis/GlobalToSkillCostFacet.java
Trunk/pcgen/code/src/java/pcgen/cdom/facet/input/MasterUsableSkillFacet.java
Trunk/pcgen/code/src/java/pcgen/cdom/facet/model/SkillFacet.java
Trunk/pcgen/code/src/java/pcgen/cdom/helper/ClassSkillChoiceActor.java
Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java
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/display/SkillDisplay.java
Trunk/pcgen/code/src/java/pcgen/core/kit/KitSkill.java
Trunk/pcgen/code/src/java/pcgen/core/npcgen/NPCGenerator.java
Trunk/pcgen/code/src/java/pcgen/core/term/PCSkillTypeTermEvaluator.java
Trunk/pcgen/code/src/java/pcgen/gui2/facade/CharacterLevelsFacadeImpl.java
Trunk/pcgen/code/src/java/pcgen/io/PCGVer2Creator.java
Trunk/pcgen/code/src/java/pcgen/io/PCGVer2Parser.java
Trunk/pcgen/code/src/java/pcgen/util/JepCountType.java
Trunk/pcgen/code/src/java/plugin/lsttokens/add/SkillToken.java
Trunk/pcgen/code/src/test/pcgen/core/PlayerCharacterTest.java
Trunk/pcgen/code/src/test/pcgen/core/prereq/PreMultTest.java
Trunk/pcgen/code/src/test/pcgen/core/prereq/PreSkillTest.java
Trunk/pcgen/code/src/test/pcgen/io/ExportHandlerTest.java
Trunk/pcgen/code/src/test/plugin/exporttokens/SkillTokenTest.java
Trunk/pcgen/code/src/utest/pcgen/cdom/facet/model/SkillFacetTest.java
Modified: Trunk/pcgen/code/src/itest/pcgen/io/SkillTargetSaveRestoreTest.java
===================================================================
--- Trunk/pcgen/code/src/itest/pcgen/io/SkillTargetSaveRestoreTest.java 2014-04-05 17:17:47 UTC (rev 23593)
+++ Trunk/pcgen/code/src/itest/pcgen/io/SkillTargetSaveRestoreTest.java 2014-04-05 17:21:11 UTC (rev 23594)
@@ -50,7 +50,6 @@
pc.addClass(cl);
pc.incrementClassLevel(1, cl);
pc.setHP(pc.getActiveClassLevel(cl, 0), 4);
- pc.addSkill(obj);
SkillRankControl.modRanks(1.0, cl, true, pc, obj);
SkillRankControl.getSkillRankBonusTo(pc, obj);
}
@@ -74,7 +73,6 @@
SkillRankControl.modRanks(-1.0, cl, true, reloadedPC, sk);
assertTrue(reloadedPC.getRank(sk).equals(0.0f));
SkillRankControl.getSkillRankBonusTo(reloadedPC, sk);
- reloadedPC.removeSkill(sk);
assertFalse(reloadedPC.hasSkill(sk));
}
Modified: Trunk/pcgen/code/src/java/applicationContext.xml
===================================================================
--- Trunk/pcgen/code/src/java/applicationContext.xml 2014-04-05 17:17:47 UTC (rev 23593)
+++ Trunk/pcgen/code/src/java/applicationContext.xml 2014-04-05 17:21:11 UTC (rev 23594)
@@ -520,7 +520,10 @@
<property name="levelFacet" ref="levelFacet"/>
<property name="consolidationFacet" ref="consolidationFacet" />
</bean>
- <bean id="skillFacet" class="pcgen.cdom.facet.model.SkillFacet"/>
+ <bean id="skillFacet" class="pcgen.cdom.facet.model.SkillFacet">
+ <property name="usableSkillsFacet" ref="usableSkillsFacet"/>
+ <property name="totalSkillRankFacet" ref="totalSkillRankFacet"/>
+ </bean>
<bean id="skillFilterFacet" class="pcgen.cdom.facet.fact.SkillFilterFacet"/>
<bean id="skillCostFacet" class="pcgen.cdom.facet.SkillCostFacet">
<property name="globalToSkillCostFacet" ref="globalToSkillCostFacet"/>
Modified: Trunk/pcgen/code/src/java/gmgen/plugin/PcgCombatant.java
===================================================================
--- Trunk/pcgen/code/src/java/gmgen/plugin/PcgCombatant.java 2014-04-05 17:17:47 UTC (rev 23593)
+++ Trunk/pcgen/code/src/java/gmgen/plugin/PcgCombatant.java 2014-04-05 17:21:11 UTC (rev 23594)
@@ -782,8 +782,7 @@
statBuf
.append("<p><font class='type'>Skills and Feats:</font> ");
- pc.refreshSkillList(); //force refresh of skills
-
+ //force refresh of skills
List<Skill> skillList =
SkillDisplay.getSkillListInOutputOrder(pc, display
.getPartialSkillList(View.VISIBLE_EXPORT));
Modified: Trunk/pcgen/code/src/java/pcgen/cdom/facet/analysis/GlobalToSkillCostFacet.java
===================================================================
--- Trunk/pcgen/code/src/java/pcgen/cdom/facet/analysis/GlobalToSkillCostFacet.java 2014-04-05 17:17:47 UTC (rev 23593)
+++ Trunk/pcgen/code/src/java/pcgen/cdom/facet/analysis/GlobalToSkillCostFacet.java 2014-04-05 17:21:11 UTC (rev 23594)
@@ -77,12 +77,9 @@
CharID id = dfce.getCharID();
PCClass cl = dfce.getCDOMObject();
DataSetID dsID = id.getDatasetID();
- for (SkillCost cost : masterUsableSkillFacet.getScopes(dsID))
+ for (Skill sk : masterUsableSkillFacet.getSet(dsID))
{
- for (Skill sk : masterUsableSkillFacet.getSet(dsID, cost))
- {
- add(id, cl, cost, sk, masterUsableSkillFacet);
- }
+ add(id, cl, SkillCost.CROSS_CLASS, sk, masterUsableSkillFacet);
}
for (SkillCost cost : globalSkillCostFacet.getScopes(id))
{
@@ -105,12 +102,9 @@
CharID id = dfce.getCharID();
PCClass cl = dfce.getCDOMObject();
DataSetID dsID = id.getDatasetID();
- for (SkillCost cost : masterUsableSkillFacet.getScopes(dsID))
+ for (Skill sk : masterUsableSkillFacet.getSet(dsID))
{
- for (Skill sk : masterUsableSkillFacet.getSet(dsID, cost))
- {
- remove(id, cl, cost, sk, masterUsableSkillFacet);
- }
+ remove(id, cl, SkillCost.CROSS_CLASS, sk, masterUsableSkillFacet);
}
for (SkillCost cost : globalSkillCostFacet.getScopes(id))
{
Modified: Trunk/pcgen/code/src/java/pcgen/cdom/facet/input/MasterUsableSkillFacet.java
===================================================================
--- Trunk/pcgen/code/src/java/pcgen/cdom/facet/input/MasterUsableSkillFacet.java 2014-04-05 17:17:47 UTC (rev 23593)
+++ Trunk/pcgen/code/src/java/pcgen/cdom/facet/input/MasterUsableSkillFacet.java 2014-04-05 17:21:11 UTC (rev 23594)
@@ -20,9 +20,8 @@
import pcgen.cdom.base.DataSetInitializedFacet;
import pcgen.cdom.enumeration.DataSetID;
import pcgen.cdom.enumeration.ObjectKey;
-import pcgen.cdom.enumeration.SkillCost;
import pcgen.cdom.facet.DataSetInitializationFacet;
-import pcgen.cdom.facet.base.AbstractScopeFacet;
+import pcgen.cdom.facet.base.AbstractSourcedListFacet;
import pcgen.core.Skill;
import pcgen.rules.context.LoadContext;
@@ -30,7 +29,7 @@
* @author Thomas Parker (thpr [at] yahoo.com)
*/
public class MasterUsableSkillFacet extends
- AbstractScopeFacet<DataSetID, SkillCost, Skill> implements
+ AbstractSourcedListFacet<DataSetID, Skill> implements
DataSetInitializedFacet
{
@@ -46,7 +45,7 @@
if (!sk.getSafe(ObjectKey.EXCLUSIVE)
&& sk.getSafe(ObjectKey.USE_UNTRAINED))
{
- add(id, SkillCost.CROSS_CLASS, sk, sk);
+ add(id, sk, sk);
}
}
}
Modified: Trunk/pcgen/code/src/java/pcgen/cdom/facet/model/SkillFacet.java
===================================================================
--- Trunk/pcgen/code/src/java/pcgen/cdom/facet/model/SkillFacet.java 2014-04-05 17:17:47 UTC (rev 23593)
+++ Trunk/pcgen/code/src/java/pcgen/cdom/facet/model/SkillFacet.java 2014-04-05 17:21:11 UTC (rev 23594)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) Thomas Parker, 2009.
+ * Copyright (c) Thomas Parker, 2009-14.
*
* This program 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
@@ -17,13 +17,84 @@
*/
package pcgen.cdom.facet.model;
-import pcgen.cdom.facet.base.AbstractListFacet;
+import pcgen.cdom.enumeration.CharID;
+import pcgen.cdom.facet.SkillRankFacet.SkillRankChangeEvent;
+import pcgen.cdom.facet.SkillRankFacet.SkillRankChangeListener;
+import pcgen.cdom.facet.TotalSkillRankFacet;
+import pcgen.cdom.facet.UsableSkillsFacet;
+import pcgen.cdom.facet.base.AbstractSourcedListFacet;
+import pcgen.cdom.facet.event.AssociationChangeEvent;
+import pcgen.cdom.facet.event.AssociationChangeListener;
+import pcgen.cdom.facet.event.DataFacetChangeEvent;
+import pcgen.cdom.facet.event.DataFacetChangeListener;
import pcgen.core.Skill;
/**
* SkillFacet is a Facet that tracks the Skills possessed by a Player Character.
*/
-public class SkillFacet extends AbstractListFacet<Skill>
+public class SkillFacet extends AbstractSourcedListFacet<CharID, Skill> implements
+ SkillRankChangeListener, DataFacetChangeListener<CharID, Skill>,
+ AssociationChangeListener
{
+ private TotalSkillRankFacet totalSkillRankFacet;
+
+ private UsableSkillsFacet usableSkillsFacet;
+
+ public void dataAdded(DataFacetChangeEvent<CharID, Skill> dfce)
+ {
+ add(dfce.getCharID(), dfce.getCDOMObject(), dfce.getSource());
+ }
+
+ public void dataRemoved(DataFacetChangeEvent<CharID, Skill> dfce)
+ {
+ remove(dfce.getCharID(), dfce.getCDOMObject(), dfce.getSource());
+ }
+
+ public void rankChanged(SkillRankChangeEvent lce)
+ {
+ CharID id = lce.getCharID();
+ Skill skill = lce.getSkill();
+ if (lce.getNewRank() == 0.0f)
+ {
+ remove(id, skill, lce.getSource());
+ }
+ else
+ {
+ add(id, skill, lce.getSource());
+ }
+ }
+
+ public void setTotalSkillRankFacet(TotalSkillRankFacet totalSkillRankFacet)
+ {
+ this.totalSkillRankFacet = totalSkillRankFacet;
+ }
+
+ public void setUsableSkillsFacet(UsableSkillsFacet usableSkillsFacet)
+ {
+ this.usableSkillsFacet = usableSkillsFacet;
+ }
+
+ public void init()
+ {
+ totalSkillRankFacet.addAssociationChangeListener(this);
+ usableSkillsFacet.addDataFacetChangeListener(this);
+ }
+
+ @Override
+ public void bonusChange(AssociationChangeEvent dfce)
+ {
+ CharID id = dfce.getCharID();
+ Skill sk = dfce.getSkill();
+ Number ranks = dfce.getNewVal();
+ if (ranks.doubleValue() > 0)
+ {
+ add(id, sk, dfce.getSource());
+ }
+ else
+ {
+ remove(id, sk, dfce.getSource());
+ }
+ }
+
}
Modified: Trunk/pcgen/code/src/java/pcgen/cdom/helper/ClassSkillChoiceActor.java
===================================================================
--- Trunk/pcgen/code/src/java/pcgen/cdom/helper/ClassSkillChoiceActor.java 2014-04-05 17:17:47 UTC (rev 23593)
+++ Trunk/pcgen/code/src/java/pcgen/cdom/helper/ClassSkillChoiceActor.java 2014-04-05 17:21:11 UTC (rev 23594)
@@ -94,7 +94,6 @@
@Override
public void applyChoice(CDOMObject owner, Skill choice, PlayerCharacter pc)
{
- pc.addSkill(choice);
PCClass pcc = getSourceClass(pc);
if (pcc == null)
{
@@ -212,7 +211,6 @@
@Override
public void restoreChoice(PlayerCharacter pc, CDOMObject owner, Skill choice)
{
- pc.addSkill(choice);
PCClass pcc = getSourceClass(pc);
if (pcc == null)
{
@@ -268,7 +266,6 @@
@Override
public void removeChoice(PlayerCharacter pc, CDOMObject owner, Skill choice)
{
- pc.addSkill(choice);
PCClass pcc = pc.getClassKeyed(source.getKeyName());
if (applyRank != null)
{
Modified: Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java
===================================================================
--- Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java 2014-04-05 17:17:47 UTC (rev 23593)
+++ Trunk/pcgen/code/src/java/pcgen/core/AbilityUtilities.java 2014-04-05 17:21:11 UTC (rev 23594)
@@ -28,7 +28,6 @@
import java.util.Collection;
import java.util.List;
-import pcgen.cdom.base.CDOMObject;
import pcgen.cdom.base.ChooseInformation;
import pcgen.cdom.base.UserSelection;
import pcgen.cdom.content.CNAbility;
@@ -54,13 +53,6 @@
// private constructor, do nothing
}
- private static <T> void add(ChoiceManagerList<T> aMan, PlayerCharacter pc,
- CDOMObject obj, String choice)
- {
- T sel = aMan.decodeChoice(choice);
- aMan.applyChoice(pc, obj, sel);
- }
-
public static void adjustPool(final Ability ability,
final PlayerCharacter aPC, final boolean addIt,
double abilityCount, boolean removed)
Modified: Trunk/pcgen/code/src/java/pcgen/core/PCClass.java
===================================================================
--- Trunk/pcgen/code/src/java/pcgen/core/PCClass.java 2014-04-05 17:17:47 UTC (rev 23593)
+++ Trunk/pcgen/code/src/java/pcgen/core/PCClass.java 2014-04-05 17:21:11 UTC (rev 23594)
@@ -1244,12 +1244,8 @@
aPC.setLevelWithoutConsequence(this, newLevel);
- if (!isMonster() && (total == 0))
+ if (isMonster() || (total != 0))
{
- aPC.removeAllSkills();
- }
- else
- {
Integer currentPool = aPC.getSkillPool(this);
int newSkillPool = (currentPool == null ? 0 : currentPool) - spMod;
aPC.setSkillPool(this, newSkillPool);
Modified: Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java
===================================================================
--- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2014-04-05 17:17:47 UTC (rev 23593)
+++ Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2014-04-05 17:21:11 UTC (rev 23594)
@@ -91,6 +91,7 @@
import pcgen.cdom.facet.AutoLanguageGrantedFacet;
import pcgen.cdom.facet.AvailableSpellFacet;
import pcgen.cdom.facet.BonusChangeFacet;
+import pcgen.cdom.facet.BonusSkillRankChangeFacet;
import pcgen.cdom.facet.CheckBonusFacet;
import pcgen.cdom.facet.ClassSpellListFacet;
import pcgen.cdom.facet.ConditionalAbilityFacet;
@@ -248,6 +249,7 @@
import pcgen.core.chooser.ChoiceManagerList;
import pcgen.core.chooser.ChooserUtilities;
import pcgen.core.display.CharacterDisplay;
+import pcgen.core.display.SkillDisplay;
import pcgen.core.pclevelinfo.PCLevelInfo;
import pcgen.core.spell.Spell;
import pcgen.core.utils.CoreUtility;
@@ -432,6 +434,7 @@
private PlayerCharacterTrackingFacet trackingFacet = FacetLibrary.getFacet(PlayerCharacterTrackingFacet.class);
private PortraitThumbnailRectFacet portraitThumbnailRectFacet = FacetLibrary
.getFacet(PortraitThumbnailRectFacet.class);
+ private BonusSkillRankChangeFacet bonusSkillRankChangeFacet = FacetLibrary.getFacet(BonusSkillRankChangeFacet.class);
private LevelInfoFacet levelInfoFacet = FacetLibrary.getFacet(LevelInfoFacet.class);
@@ -558,7 +561,6 @@
rollStats(SettingsHandler.getGame().getRollMethod());
addSpellBook(new SpellBook(Globals.getDefaultSpellBook(), SpellBook.TYPE_KNOWN_SPELLS));
addSpellBook(new SpellBook(Constants.INNATE_SPELL_BOOK_NAME, SpellBook.TYPE_INNATE_SPELLS));
- populateSkills(getSkillFilter());
// XXX do not set it, as for gender. Remark: not working, value is not set.
// setStringFor(StringKey.HANDED, Handed.getDefaultValue().toString());
FacetLibrary.getFacet(MasterAvailableSpellInitializationFacet.class).initialize(id);
@@ -984,6 +986,7 @@
cAvSpellFacet.update(id);
cKnSpellFacet.update(id);
condLangFacet.update(id);
+ bonusSkillRankChangeFacet.reset(id);
}
dirtyFlag = dirtyState;
@@ -1730,7 +1733,6 @@
// now we have to merge the two lists together and
// take the higher rank of each skill for the Familiar
- refreshSkillList();
for (Skill fSkill : getSkillSet())
{
for (Skill mSkill : mList)
@@ -1773,7 +1775,6 @@
// We don't pass in a class here so that the real skills can be
// distinguished from the ones form the master.
SkillRankControl.modRanks(sr, null, true, this, newSkill);
- skillFacet.add(id, newSkill);
if (ChooseActivation.hasNewChooseToken(newSkill))
{
@@ -4603,19 +4604,6 @@
setDirty(true);
}
- public void addSkill(final Skill addSkill)
- {
- boolean added = skillFacet.add(id, addSkill);
- if (added)
- {
- setDirty(true);
- if (!isImporting())
- {
- calcActiveBonuses();
- }
- }
- }
-
/**
* @param acs
* is the CharacterSpell object containing the spell which is to
@@ -6240,35 +6228,6 @@
}
/**
- * Populate the characters skills list according to the requested
- * SkillFilter.
- *
- * @param filter
- */
- public void populateSkills(final SkillFilter filter)
- {
- removeExcessSkills();
- addNewSkills(filter);
- final List<Skill> localSkillList = new ArrayList<Skill>(getSkillSet());
- SkillComparator comparator = getSkillsOutputOrder().getComparator(this);
- if (comparator == null)
- {
- return;
- }
- Collections.sort(localSkillList, comparator);
-
- int nextOutputIndex = 1;
- for (Skill skill : localSkillList)
- {
- Integer outputIndex = getSkillOrder(skill);
- if (outputIndex == null || outputIndex >= 0)
- {
- setSkillOrder(skill, nextOutputIndex++);
- }
- }
- }
-
- /**
* Removes a "temporary" bonus
*
* @param aBonus
@@ -6858,26 +6817,6 @@
}
/**
- * @param filter
- */
- private void addNewSkills(final SkillFilter filter)
- {
- final List<Skill> addItems = new ArrayList<Skill>();
- final List<Skill> skillList = new ArrayList<Skill>(getSkillSet());
-
- for (Skill aSkill : Globals.getContext().ref.getConstructedCDOMObjects(Skill.class))
- {
- if (includeSkill(aSkill, filter) && !skillList.contains(aSkill))
- {
- addItems.add(aSkill);
- }
- }
-
- skillFacet.addAll(id, addItems);
- // setDirty(true);
- }
-
- /**
* availableSpells sk4p 13 Dec 2002
*
* For learning or preparing a spell: Are there slots available at this
@@ -7442,25 +7381,6 @@
calcActiveBonuses();
}
- private void removeExcessSkills()
- {
- boolean modified = false;
- // Wrap to avoid a ConcurrentModificationException
- for (Skill skill : new ArrayList<Skill>(skillFacet.getSet(id)))
- {
- if (!qualifySkill(skill))
- {
- skillFacet.remove(id, skill);
- modified = true;
- }
- }
-
- if (modified)
- {
- setDirty(true);
- }
- }
-
/**
* Remove from the character the PCLevelInfo representing the highest level
* of the supplied class.
@@ -7633,8 +7553,6 @@
getSpellList();
// Force refresh of skills
- refreshSkillList();
-
SkillFilter filter = SkillFilter.getByValue(PCGenSettings.OPTIONS_CONTEXT.initInt(
PCGenSettings.OPTION_SKILL_FILTER, SkillFilter.Usable.getValue()));
@@ -7647,7 +7565,8 @@
// Calculate any active bonuses
calcActiveBonuses();
- populateSkills(filter);
+ //Sort Skills
+ SkillDisplay.resortSelected(this, getSkillsOutputOrder());
// Determine which hands weapons are currently being wielded in
determinePrimaryOffWeapon();
@@ -9717,36 +9636,6 @@
}
}
- public void removeSkill(Skill sk)
- {
- if (skillFacet.remove(id, sk))
- {
- setDirty(true);
- }
- }
-
- public void removeAllSkills()
- {
- if (skillFacet.removeAll(id).size() > 0)
- {
- setDirty(true);
- }
- }
-
- public void refreshSkillList()
- {
- for (final Skill skill : Globals.getContext().ref.getConstructedCDOMObjects(Skill.class))
- {
- if (!hasSkill(skill))
- {
- if (!CoreUtility.doublesEqual(SkillRankControl.getSkillRankBonusTo(this, skill), 0.0))
- {
- addSkill(skill);
- }
- }
- }
- }
-
public void setSubstitutionLevel(PCClass pcc, PCClassLevel originalClassLevel)
{
try
Modified: Trunk/pcgen/code/src/java/pcgen/core/display/SkillDisplay.java
===================================================================
--- Trunk/pcgen/code/src/java/pcgen/core/display/SkillDisplay.java 2014-04-05 17:17:47 UTC (rev 23593)
+++ Trunk/pcgen/code/src/java/pcgen/core/display/SkillDisplay.java 2014-04-05 17:21:11 UTC (rev 23594)
@@ -138,8 +138,7 @@
}
}
-
- private static void resortSelected(PlayerCharacter pc, SkillsOutputOrder sortSelection)
+ public static void resortSelected(PlayerCharacter pc, SkillsOutputOrder sortSelection)
{
int sort = -1;
boolean sortOrder = false;
Modified: Trunk/pcgen/code/src/java/pcgen/core/kit/KitSkill.java
===================================================================
--- Trunk/pcgen/code/src/java/pcgen/core/kit/KitSkill.java 2014-04-05 17:17:47 UTC (rev 23593)
+++ Trunk/pcgen/code/src/java/pcgen/core/kit/KitSkill.java 2014-04-05 17:21:11 UTC (rev 23594)
@@ -238,8 +238,6 @@
final Skill aSkill, final int aRank, final double aCost,
List<Language> langList, final PCClass pcClass)
{
- pc.addSkill(aSkill);
-
boolean oldImporting = pc.isImporting();
pc.setImporting(true);
final String aString =
@@ -396,7 +394,6 @@
ranksToAdd = ranksAdded;
ptsToSpend = (int) (ranksToAdd * skillCost);
}
- pc.addSkill(aSkill);
String ret =
SkillRankControl
Modified: Trunk/pcgen/code/src/java/pcgen/core/npcgen/NPCGenerator.java
===================================================================
--- Trunk/pcgen/code/src/java/pcgen/core/npcgen/NPCGenerator.java 2014-04-05 17:17:47 UTC (rev 23593)
+++ Trunk/pcgen/code/src/java/pcgen/core/npcgen/NPCGenerator.java 2014-04-05 17:21:11 UTC (rev 23594)
@@ -260,7 +260,6 @@
}
}
- aPC.addSkill(skill);
SkillRankControl.modRanks(ranks, aClass, false, aPC, skill);
// Add weight to skills we select to try and encourage us to select
// them again.
Modified: Trunk/pcgen/code/src/java/pcgen/core/term/PCSkillTypeTermEvaluator.java
===================================================================
--- Trunk/pcgen/code/src/java/pcgen/core/term/PCSkillTypeTermEvaluator.java 2014-04-05 17:17:47 UTC (rev 23593)
+++ Trunk/pcgen/code/src/java/pcgen/core/term/PCSkillTypeTermEvaluator.java 2014-04-05 17:21:11 UTC (rev 23594)
@@ -47,10 +47,8 @@
}
@Override
- public Float resolve(PlayerCharacter pc) {
-
- pc.refreshSkillList();
-
+ public Float resolve(PlayerCharacter pc)
+ {
int count = 0;
Collection<Skill> skills = pc.getDisplay().getSkillSet();
for(Skill sk : skills)
Modified: Trunk/pcgen/code/src/java/pcgen/gui2/facade/CharacterLevelsFacadeImpl.java
===================================================================
--- Trunk/pcgen/code/src/java/pcgen/gui2/facade/CharacterLevelsFacadeImpl.java 2014-04-05 17:17:47 UTC (rev 23593)
+++ Trunk/pcgen/code/src/java/pcgen/gui2/facade/CharacterLevelsFacadeImpl.java 2014-04-05 17:21:11 UTC (rev 23594)
@@ -29,7 +29,6 @@
import pcgen.cdom.base.Constants;
import pcgen.cdom.enumeration.CharID;
-import pcgen.cdom.enumeration.ObjectKey;
import pcgen.cdom.enumeration.SkillCost;
import pcgen.cdom.facet.BonusChangeFacet;
import pcgen.cdom.facet.BonusChangeFacet.BonusChangeEvent;
@@ -57,7 +56,6 @@
import pcgen.core.facade.UIDelegate;
import pcgen.core.facade.util.AbstractListFacade;
import pcgen.core.pclevelinfo.PCLevelInfo;
-import pcgen.core.utils.CoreUtility;
import pcgen.system.LanguageBundle;
import pcgen.util.Logging;
import pcgen.util.enumeration.Tab;
@@ -578,7 +576,6 @@
boolean hasSkill = charDisplay.hasSkill(aSkill);
if (!hasSkill)
{
- theCharacter.addSkill(aSkill);
SkillDisplay.updateSkillsOutputOrder(theCharacter, aSkill);
}
@@ -590,16 +587,6 @@
{
classLevel.setSkillPointsRemaining(skillPool - points);
}
-
- //
- // Remove the skill from the skill list if we've
- // just set the rank to zero and it is not untrained
- //
- if (CoreUtility.doublesEqual(theCharacter.getRank(aSkill).doubleValue(), 0.0)
- && !aSkill.getSafe(ObjectKey.USE_UNTRAINED))
- {
- theCharacter.removeSkill(aSkill);
- }
if (ChooseActivation.hasNewChooseToken(aSkill)
&& characterFacadeImpl != null)
Modified: Trunk/pcgen/code/src/java/pcgen/io/PCGVer2Creator.java
===================================================================
--- Trunk/pcgen/code/src/java/pcgen/io/PCGVer2Creator.java 2014-04-05 17:17:47 UTC (rev 23593)
+++ Trunk/pcgen/code/src/java/pcgen/io/PCGVer2Creator.java 2014-04-05 17:21:11 UTC (rev 23594)
@@ -58,7 +58,6 @@
import pcgen.cdom.enumeration.ListKey;
import pcgen.cdom.enumeration.Nature;
import pcgen.cdom.enumeration.ObjectKey;
-import pcgen.cdom.enumeration.SkillFilter;
import pcgen.cdom.enumeration.StringKey;
import pcgen.cdom.helper.CNAbilitySelection;
import pcgen.cdom.helper.ClassSource;
@@ -2018,10 +2017,6 @@
*/
private void appendSkillLines(StringBuilder buffer)
{
- SkillFilter filter = thePC.getSkillFilter();
-
- thePC.populateSkills(filter);
-
Collection<Skill> skillSet = charDisplay.getSkillSet();
for (Skill skill : skillSet)
{
@@ -2032,10 +2027,14 @@
buffer.append(TAG_SKILL).append(':');
buffer.append(EntityEncoder.encode(skill.getKeyName()));
+
buffer.append('|');
- buffer.append(TAG_OUTPUTORDER).append(':');
- buffer.append(outputIndex == null ? 0 : outputIndex);
- buffer.append('|');
+ if (outputIndex != null && outputIndex != 0)
+ {
+ buffer.append(TAG_OUTPUTORDER).append(':');
+ buffer.append(outputIndex == null ? 0 : outputIndex);
+ buffer.append('|');
+ }
for (PCClass pcc : thePC.getSkillRankClasses(skill))
{
Modified: Trunk/pcgen/code/src/java/pcgen/io/PCGVer2Parser.java
===================================================================
--- Trunk/pcgen/code/src/java/pcgen/io/PCGVer2Parser.java 2014-04-05 17:17:47 UTC (rev 23593)
+++ Trunk/pcgen/code/src/java/pcgen/io/PCGVer2Parser.java 2014-04-05 17:21:11 UTC (rev 23594)
@@ -3773,11 +3773,6 @@
aSkill =
Globals.getContext().ref.silentlyGetConstructedCDOMObject(
Skill.class, skillKey);
-
- if (aSkill != null && !thePC.hasSkill(aSkill))
- {
- thePC.addSkill(aSkill);
- }
}
while (it.hasNext())
Modified: Trunk/pcgen/code/src/java/pcgen/util/JepCountType.java
===================================================================
--- Trunk/pcgen/code/src/java/pcgen/util/JepCountType.java 2014-04-05 17:17:47 UTC (rev 23593)
+++ Trunk/pcgen/code/src/java/pcgen/util/JepCountType.java 2014-04-05 17:21:11 UTC (rev 23594)
@@ -311,7 +311,6 @@
@Override
protected Collection<Skill> getData(PlayerCharacter pc)
{
- pc.refreshSkillList();
return pc.getDisplay().getSkillSet();
}
};
Modified: Trunk/pcgen/code/src/java/plugin/lsttokens/add/SkillToken.java
===================================================================
--- Trunk/pcgen/code/src/java/plugin/lsttokens/add/SkillToken.java 2014-04-05 17:17:47 UTC (rev 23593)
+++ Trunk/pcgen/code/src/java/plugin/lsttokens/add/SkillToken.java 2014-04-05 17:21:11 UTC (rev 23594)
@@ -211,7 +211,6 @@
@Override
public void applyChoice(CDOMObject owner, Skill choice, PlayerCharacter pc)
{
- pc.addSkill(choice);
SkillRankControl.modRanks(1.0, null, true, pc, choice);
}
@@ -242,7 +241,6 @@
@Override
public void removeChoice(PlayerCharacter pc, CDOMObject owner, Skill choice)
{
- pc.addSkill(choice);
SkillRankControl.modRanks(-1.0, null, true, pc, choice);
}
}
Modified: Trunk/pcgen/code/src/test/pcgen/core/PlayerCharacterTest.java
===================================================================
--- Trunk/pcgen/code/src/test/pcgen/core/PlayerCharacterTest.java 2014-04-05 17:17:47 UTC (rev 23593)
+++ Trunk/pcgen/code/src/test/pcgen/core/PlayerCharacterTest.java 2014-04-05 17:21:11 UTC (rev 23594)
@@ -655,21 +655,18 @@
guiSkill.addToListFor(ListKey.TYPE, Type.getConstant("INT"));
guiSkill.put(ObjectKey.VISIBILITY, Visibility.DISPLAY_ONLY);
SkillRankControl.modRanks(1.0, pcClass, true, pc, guiSkill);
- pc.addSkill(guiSkill);
context.unconditionallyProcess(outputSkill, "CLASSES", "MyClass");
outputSkill.setName("Output");
outputSkill.addToListFor(ListKey.TYPE, Type.getConstant("INT"));
outputSkill.put(ObjectKey.VISIBILITY, Visibility.OUTPUT_ONLY);
SkillRankControl.modRanks(1.0, pcClass, true, pc, outputSkill);
- pc.addSkill(outputSkill);
context.unconditionallyProcess(defaultSkill, "CLASSES", "MyClass");
defaultSkill.setName("Default");
defaultSkill.addToListFor(ListKey.TYPE, Type.getConstant("INT"));
defaultSkill.put(ObjectKey.VISIBILITY, Visibility.DEFAULT);
SkillRankControl.modRanks(1.0, pcClass, true, pc, defaultSkill);
- pc.addSkill(defaultSkill);
// Test retrieved list
Collection<Skill> skillList = pc.getSkillSet();
Modified: Trunk/pcgen/code/src/test/pcgen/core/prereq/PreMultTest.java
===================================================================
--- Trunk/pcgen/code/src/test/pcgen/core/prereq/PreMultTest.java 2014-04-05 17:17:47 UTC (rev 23593)
+++ Trunk/pcgen/code/src/test/pcgen/core/prereq/PreMultTest.java 2014-04-05 17:21:11 UTC (rev 23594)
@@ -89,7 +89,6 @@
Globals.getContext().unconditionallyProcess(knowledge, "CLASSES", "My Class");
knowledge.setName("KNOWLEDGE (ARCANA)");
TestHelper.addType(knowledge, "KNOWLEDGE.INT");
- character.addSkill(knowledge);
SkillRankControl.modRanks(8.0, myClass, true, character, knowledge);
}
@@ -252,13 +251,9 @@
Globals.getContext().unconditionallyProcess(extraKnow, "CLASSES", "MyClass");
extraKnow.setName("KNOWLEDGE (RELIGION)");
TestHelper.addType(extraKnow, "KNOWLEDGE.INT");
- character.addSkill(extraKnow);
SkillRankControl.modRanks(5.0, myClass, true, character, extraKnow);
passes = PrereqHandler.passes(prereq, character, null);
assertTrue("Should pass 2 knowledge skill test with 2 skills", passes);
-
- character.removeSkill(knowledge);
- character.calcActiveBonuses();
}
}
Modified: Trunk/pcgen/code/src/test/pcgen/core/prereq/PreSkillTest.java
===================================================================
--- Trunk/pcgen/code/src/test/pcgen/core/prereq/PreSkillTest.java 2014-04-05 17:17:47 UTC (rev 23593)
+++ Trunk/pcgen/code/src/test/pcgen/core/prereq/PreSkillTest.java 2014-04-05 17:21:11 UTC (rev 23594)
@@ -88,7 +88,6 @@
knowledge.setName("KNOWLEDGE (ARCANA)");
TestHelper.addType(knowledge, "KNOWLEDGE.INT");
context.ref.importObject(knowledge);
- character.addSkill(knowledge);
SkillRankControl.modRanks(6.0, myClass, true, character, knowledge);
knowledge2 = new Skill();
@@ -96,7 +95,6 @@
knowledge2.setName("KNOWLEDGE (NATURE)");
TestHelper.addType(knowledge2, "KNOWLEDGE.INT");
context.ref.importObject(knowledge2);
- character.addSkill(knowledge2);
SkillRankControl.modRanks(8.0, myClass, true, character, knowledge2);
tumble = new Skill();
@@ -104,7 +102,6 @@
tumble.setName("Tumble");
tumble.addToListFor(ListKey.TYPE, Type.getConstant("DEX"));
context.ref.importObject(tumble);
- character.addSkill(tumble);
SkillRankControl.modRanks(8.0, myClass, true, character, tumble);
balance = new Skill();
@@ -112,7 +109,6 @@
balance.setName("Balance");
balance.addToListFor(ListKey.TYPE, Type.getConstant("DEX"));
context.ref.importObject(balance);
- character.addSkill(balance);
SkillRankControl.modRanks(4.0, myClass, true, character, balance);
target = new Skill();
@@ -134,7 +130,6 @@
fake.addToListFor(ListKey.SERVES_AS_SKILL, CDOMDirectSingleRef.getRef(target));
fake.addToListFor(ListKey.SERVES_AS_SKILL, CDOMDirectSingleRef.getRef(target2));
context.ref.importObject(fake);
- character.addSkill(fake);
SkillRankControl.modRanks(6.0, myClass, true, character, fake);
fake2 = new Skill();
@@ -142,7 +137,6 @@
fake2.setName("Fake 2");
fake2.addToListFor(ListKey.TYPE, Type.getConstant("INT"));
context.ref.importObject(fake2);
- character.addSkill(fake2);
SkillRankControl.modRanks(8.0, myClass, true, character, fake2);
context.ref.buildDerivedObjects();
Modified: Trunk/pcgen/code/src/test/pcgen/io/ExportHandlerTest.java
===================================================================
--- Trunk/pcgen/code/src/test/pcgen/io/ExportHandlerTest.java 2014-04-05 17:17:47 UTC (rev 23593)
+++ Trunk/pcgen/code/src/test/pcgen/io/ExportHandlerTest.java 2014-04-05 17:21:11 UTC (rev 23594)
@@ -144,7 +144,6 @@
knowledge[0].put(ObjectKey.KEY_STAT, intel);
character.setSkillOrder(knowledge[0], 2);
Globals.getContext().ref.importObject(knowledge[0]);
- character.addSkill(knowledge[0]);
SkillRankControl.modRanks(8.0, myClass, true, character, knowledge[0]);
knowledge[1] = new Skill();
@@ -154,7 +153,6 @@
knowledge[1].put(ObjectKey.KEY_STAT, intel);
character.setSkillOrder(knowledge[1], 3);
Globals.getContext().ref.importObject(knowledge[1]);
- character.addSkill(knowledge[1]);
SkillRankControl.modRanks(5.0, myClass, true, character, knowledge[1]);
tumble = new Skill();
@@ -164,7 +162,6 @@
tumble.put(ObjectKey.KEY_STAT, dex);
character.setSkillOrder(tumble, 4);
Globals.getContext().ref.importObject(tumble);
- character.addSkill(tumble);
SkillRankControl.modRanks(7.0, myClass, true, character, tumble);
balance = new Skill();
@@ -180,7 +177,6 @@
balance.addToListFor(ListKey.BONUS, aBonus);
}
Globals.getContext().ref.importObject(balance);
- character.addSkill(balance);
SkillRankControl.modRanks(4.0, myClass, true, character, balance);
character.calcActiveBonuses();
Modified: Trunk/pcgen/code/src/test/plugin/exporttokens/SkillTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/test/plugin/exporttokens/SkillTokenTest.java 2014-04-05 17:17:47 UTC (rev 23593)
+++ Trunk/pcgen/code/src/test/plugin/exporttokens/SkillTokenTest.java 2014-04-05 17:21:11 UTC (rev 23594)
@@ -129,7 +129,6 @@
TestHelper.addType(knowledge[0], "KNOWLEDGE.INT");
knowledge[0].put(ObjectKey.KEY_STAT, intel);
context.ref.importObject(knowledge[0]);
- character.addSkill(knowledge[0]);
SkillRankControl.modRanks(8.0, myClass, true, character, knowledge[0]);
knowledge[1] = new Skill();
@@ -138,7 +137,6 @@
TestHelper.addType(knowledge[1], "KNOWLEDGE.INT");
knowledge[1].put(ObjectKey.KEY_STAT, intel);
context.ref.importObject(knowledge[1]);
- character.addSkill(knowledge[1]);
SkillRankControl.modRanks(5.0, myClass, true, character, knowledge[1]);
tumble = new Skill();
@@ -147,7 +145,6 @@
tumble.addToListFor(ListKey.TYPE, Type.getConstant("DEX"));
tumble.put(ObjectKey.KEY_STAT, dex);
context.ref.importObject(tumble);
- character.addSkill(tumble);
SkillRankControl.modRanks(7.0, myClass, true, character, tumble);
balance = new Skill();
@@ -162,7 +159,6 @@
balance.addToListFor(ListKey.BONUS, aBonus);
}
context.ref.importObject(balance);
- character.addSkill(balance);
SkillRankControl.modRanks(4.0, myClass, true, character, balance);
context.ref.buildDerivedObjects();
Modified: Trunk/pcgen/code/src/utest/pcgen/cdom/facet/model/SkillFacetTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/pcgen/cdom/facet/model/SkillFacetTest.java 2014-04-05 17:17:47 UTC (rev 23593)
+++ Trunk/pcgen/code/src/utest/pcgen/cdom/facet/model/SkillFacetTest.java 2014-04-05 17:21:11 UTC (rev 23594)
@@ -17,17 +17,17 @@
*/
package pcgen.cdom.facet.model;
-import pcgen.cdom.facet.base.AbstractListFacet;
-import pcgen.cdom.facet.model.SkillFacet;
-import pcgen.cdom.testsupport.AbstractListFacetTest;
+import pcgen.cdom.enumeration.CharID;
+import pcgen.cdom.facet.base.AbstractSourcedListFacet;
+import pcgen.cdom.testsupport.AbstractSourcedListFacetTest;
import pcgen.core.Skill;
-public class SkillFacetTest extends AbstractListFacetTest<Skill>
+public class SkillFacetTest extends AbstractSourcedListFacetTest<Skill>
{
private SkillFacet facet = new SkillFacet();
@Override
- protected AbstractListFacet<Skill> getFacet()
+ protected AbstractSourcedListFacet<CharID, Skill> getFacet()
{
return facet;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|