public override void AddField(TextSpan field) { if (!field.StartsWith("PRE")) { if (field.TryRemovePrefix("TYPE=", out var type) || field.TryRemovePrefix("!TYPE=", out type)) { var types = type.Value.Split('.'); var selector = string.Join(" or ", types.Select(t => $"language.IsType(\"{t}\")")); if (field.StartsWith("!")) { selector = $"not ({selector})"; } Selectors.Add(selector); } else if (field.Value == "ALL") { Selectors.Add("true"); } else { Selectors.Add($"stringMatch(language.Name, \"{field.Value}\")"); } return; } base.AddField(field); }
public override void AddField(TextSpan field) { if (field.Value == "DONOTADD:HITDIE") { DoNotAddHitDie = true; return; } if (field.Value == "DONOTADD:SKILLPOINTS") { DoNotAddSkillPoints = true; return; } if (field.TryRemovePrefix("CAST:", out field)) { SpellsPerDay.Clear(); SpellsPerDay.AddRange(field.Split(',').Select(v => new Formula(v.Value)).ToList()); return; } if (field.TryRemovePrefix("KNOWN:", out field)) { SpellsKnown.Clear(); SpellsKnown.AddRange(field.Split(',').Select(v => new Formula(v.Value)).ToList()); return; } base.AddField(field); }
public override void AddField(TextSpan field) { if (Category == null) { Category = field.Value; return; } if (Nature == null) { Nature = field.Value; return; } if (!field.StartsWith("PRE") && !field.StartsWith("!PRE")) { if (field.TryRemovePrefix("TYPE=", out field)) { Types.Add(field.Value); return; } Names.Add(field.Value); return; } base.AddField(field); }
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"); } }
public override void AddField(TextSpan field) { if (field.TryRemovePrefix("CHOICE:", out field)) { if (!field.TryRemoveInfix("|", out var k, out var v)) { throw new ParseFailedException(field, "Unable to parse CHOICE"); } ChoiceKind = k.Value; ChoiceValue = v.Value; return; } base.AddField(field); }