public MagicSpell NextSpell(Player player) { var spells = AllSpells .Where(s => s.Cost <= player.Mana) .Where(s => s.EffectType == null || !player.Effects.Any(e => e.GetType() == s.EffectType)) .ToArray(); if (!spells.Any()) { return(null); } var spell = spells[Random.Next(0, spells.Length - 1)]; return(spell); }
public Spell SpellByClassAndName(ClassType classType, SpellName spellName) { return(AllSpells.Where((s) => s.classType == classType && s.name == spellName).Last()); }
public List <Spell> SpellsByClassAndLevel(ClassType classType, int lvl) { Debug.Log("Geting spells by " + classType.ToString() + " and " + lvl); return(AllSpells.Where((spell) => spell.classType == classType && spell.level == lvl).ToList()); }