public static bool CanLearn(Entity entity, Spell spell) { bool canLearn = true; if (entity.Level < spell.LevelRequirement) { canLearn = false; } if (!spell.AllowedClasses.Contains(entity.EntityClass.ToLower())) { canLearn = false; } foreach (string s in spell.AttributeRequirements.Keys) { if (Mechanics.GetAttributeByString(entity, s) < spell.AttributeRequirements[s]) { canLearn = false; break; } } foreach (string s in spell.SpellPrerequisites) { if (!entity.Talents.ContainsKey(s)) { canLearn = false; break; } } return(canLearn); }