|
From: <th...@us...> - 2014-04-05 23:53:58
|
Revision: 23599
http://sourceforge.net/p/pcgen/code/23599
Author: thpr
Date: 2014-04-05 23:53:54 +0000 (Sat, 05 Apr 2014)
Log Message:
-----------
Long term, Ability Category visibility needs to be addressed with increased clarity of behavior given certain words and definitions/usages of those words.
I do not believe we are being consistent in how VISIBLE works and I think that decreases overall clarity of using PCGen.
In order to band-aid the issue, this reintroduces behavior that the data is apparently dependent upon...
Reintroduce Behavior to Address: [Pathfinder] Archetype Tab is no longer being displayed
Issue#: CODE-2555
Modified Paths:
--------------
Trunk/pcgen/code/src/java/pcgen/cdom/facet/GrantedAbilityFacet.java
Trunk/pcgen/code/src/java/pcgen/cdom/facet/input/ActiveAbilityFacet.java
Trunk/pcgen/code/src/java/pcgen/core/AbilityCategory.java
Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java
Modified: Trunk/pcgen/code/src/java/pcgen/cdom/facet/GrantedAbilityFacet.java
===================================================================
--- Trunk/pcgen/code/src/java/pcgen/cdom/facet/GrantedAbilityFacet.java 2014-04-05 23:44:11 UTC (rev 23598)
+++ Trunk/pcgen/code/src/java/pcgen/cdom/facet/GrantedAbilityFacet.java 2014-04-05 23:53:54 UTC (rev 23599)
@@ -32,6 +32,7 @@
import pcgen.cdom.facet.event.DataFacetChangeListener;
import pcgen.cdom.helper.CNAbilitySelection;
import pcgen.core.Ability;
+import pcgen.core.AbilityCategory;
import pcgen.util.enumeration.View;
/**
@@ -210,4 +211,21 @@
{
remove(dfce.getCharID(), dfce.getCDOMObject(), dfce.getSource());
}
+
+ public boolean hasAbilityInPool(CharID id, AbilityCategory cat)
+ {
+ Map<CNAbilitySelection, Set<Object>> map = getCachedMap(id);
+ if (map != null)
+ {
+ for (CNAbilitySelection cnas : map.keySet())
+ {
+ CNAbility cna = cnas.getCNAbility();
+ if (cna.getAbilityCategory().equals(cat))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
}
\ No newline at end of file
Modified: Trunk/pcgen/code/src/java/pcgen/cdom/facet/input/ActiveAbilityFacet.java
===================================================================
--- Trunk/pcgen/code/src/java/pcgen/cdom/facet/input/ActiveAbilityFacet.java 2014-04-05 23:44:11 UTC (rev 23598)
+++ Trunk/pcgen/code/src/java/pcgen/cdom/facet/input/ActiveAbilityFacet.java 2014-04-05 23:53:54 UTC (rev 23599)
@@ -966,4 +966,24 @@
return set;
}
+ public boolean hasAbilityInPool(CharID id, AbilityCategory cat)
+ {
+ Map<Category<Ability>, Map<Nature, Set<Ability>>> catMap = getCachedMap(id);
+ if (catMap != null)
+ {
+ for (Entry<Category<Ability>, Map<Nature, Set<Ability>>> catME : catMap.entrySet())
+ {
+ Category<Ability> c = catME.getKey();
+ if (c.equals(cat))
+ {
+ if (!catME.getValue().values().isEmpty())
+ {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
}
\ No newline at end of file
Modified: Trunk/pcgen/code/src/java/pcgen/core/AbilityCategory.java
===================================================================
--- Trunk/pcgen/code/src/java/pcgen/core/AbilityCategory.java 2014-04-05 23:44:11 UTC (rev 23598)
+++ Trunk/pcgen/code/src/java/pcgen/core/AbilityCategory.java 2014-04-05 23:53:54 UTC (rev 23599)
@@ -391,9 +391,20 @@
{
if (visibility.equals(Visibility.QUALIFY))
{
+ /*
+ * Note that hasAbilityVisibleTo is apparently not how data is
+ * designed - the problem (in my opinion) being that either an
+ * undocumented design change was made or a bug was being taken
+ * advantage of and the data is now dependent upon that bug. This
+ * reintroduces a wider behavior, but - again in my opinion -
+ * decreases clarity over the definition of QUALIFIED and whether
+ * the actual behavior aligns with the dictionary definition of the
+ * word. - thpr Apr 5 '14
+ */
return (pc == null)
|| pc.getTotalAbilityPool(this).floatValue() != 0.0
- || pc.hasAbilityVisibleTo(this, v);
+ || pc.hasAbilityInPool(this);
+ //|| pc.hasAbilityVisibleTo(this, v);
}
return visibility.isVisibleTo(v);
}
Modified: Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java
===================================================================
--- Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2014-04-05 23:44:11 UTC (rev 23598)
+++ Trunk/pcgen/code/src/java/pcgen/core/PlayerCharacter.java 2014-04-05 23:53:54 UTC (rev 23599)
@@ -10958,4 +10958,10 @@
cna.doMagicalAndEvilThings(contained);
return needClone;
}
+
+ public boolean hasAbilityInPool(AbilityCategory aCategory)
+ {
+ return abFacet.hasAbilityInPool(id, aCategory)
+ || grantedAbilityFacet.hasAbilityInPool(id, aCategory);
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|