MCPcopy Create free account
hub / github.com/PCGen/pcgen / getFirstLvlForKey

Method getFirstLvlForKey

code/src/java/pcgen/core/analysis/SpellLevel.java:93–106  ·  view source on GitHub ↗

Retrieve the first level that the pc receives the spell from the specified list. Note that this only returns spells that the pc has available. @param sp The spell to be found. @param list The spell list (e.g. a class spell list) @param aPC The character who must already have the spell. @return The

(Spell sp, CDOMList<Spell> list, PlayerCharacter aPC)

Source from the content-addressed store, hash-verified

91 * @return The level of the spell, or -1 if not found.
92 */
93 public static int getFirstLvlForKey(Spell sp, CDOMList<Spell> list, PlayerCharacter aPC)
94 {
95 HashMapToList<CDOMList<Spell>, Integer> wLevelInfo = aPC.getSpellLevelInfo(sp);
96 if ((wLevelInfo != null) && (!wLevelInfo.isEmpty()))
97 {
98 List<Integer> levelList = wLevelInfo.getListFor(list);
99 if (levelList != null)
100 {
101 // In specific situations, this list may not be sorted, so we won't assume it is
102 return Collections.min(levelList);
103 }
104 }
105 return -1;
106 }
107
108 /**
109 * isLevel(int aLevel)

Callers 3

levelForKeyMethod · 0.95
applyDomainMethod · 0.95
removeDomainMethod · 0.95

Calls 4

isEmptyMethod · 0.65
getListForMethod · 0.65
getSpellLevelInfoMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected