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)
| 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) |
no test coverage detected