Ejemplo n.º 1
0
        public ProhibitedSpell(TextSpan value)
        {
            AddPropertyDefinitions(() => new[]
            {
                CommonProperties.Conditions,
            });

            if (value.TryRemoveInfix("|", out var newValue, out var conditions))
            {
                foreach (var part in conditions.Split('|'))
                {
                    AddField(part);
                }

                value = newValue;
            }

            if (value.TryRemovePrefix("ALIGNMENT.", out value))
            {
                Alignments.AddRange(value.Value.Split('.'));
            }
            else if (value.TryRemovePrefix("DESCRIPTOR.", out value))
            {
                Descriptors.AddRange(value.Value.Split('.'));
            }
            else if (value.TryRemovePrefix("SCHOOL.", out value))
            {
                Schools.AddRange(value.Value.Split('.'));
            }
            else if (value.TryRemovePrefix("SUBSCHOOL.", out value))
            {
                SubSchools.AddRange(value.Value.Split('.'));
            }
            else if (value.TryRemovePrefix("SPELL.", out value))
            {
                Names.AddRange(value.Value.Split(','));
            }
            else
            {
                throw new ParseFailedException(value, "Unable to parse PROHIBITSPELL");
            }
        }