public int GetSpellCount(SpellCountType spellCountType, CasterClass casterClass, int casterLevel, int spellLevel) { BuildProgressionLookup(); if (!progressionLookup.ContainsKey(spellCountType.ToString())) { Debug.LogError("Invalid List"); return(-1); } if (!progressionLookup[spellCountType.ToString()].ContainsKey(casterClass.ToString())) { Debug.LogError("Invalid Caster Class"); return(-1); } if (!progressionLookup[spellCountType.ToString()][spellCountType.ToString()].ContainsKey(casterLevel.ToString())) { Debug.LogError("Invalid Caster Level"); return(-1); } float[] spellLevels = progressionLookup[spellCountType.ToString()][spellCountType.ToString()][casterLevel.ToString()]; if (spellLevel > spellLevels.Length - 1) { Debug.LogError(spellCountType + "Cannot Cast Spells of this Level"); return(-1); } return((int)spellLevels[spellLevel]); }
// Private Methods private void SetCasterClass() { foreach (CasterClass cClass in Enum.GetValues(typeof(CasterClass))) { if (characterClass.ToString() == cClass.ToString()) { casterClass = cClass; } } }