// precast - modifies selections public static void Cast(Env env, string spell, bool pre) { var lib = pre ? _fast : _spells; while (spell.Length > 0) { for (int k = 3; k >= 1; k--) { if (spell.Length < k) { continue; } var frag = spell.Substring(0, k); if (lib.ContainsKey(frag)) { spell = spell.Substring(k); var text = _spellText.ContainsKey(frag) ? _spellText[frag] : ""; env.Queue(lib[frag], text, frag.Length); } else if (k == 1) { spell = ""; } } } }