private static bool ParseEffectDescription(PgPowerEffectCollection effectDescriptionList, string effectDescription, string parsedFile, string parsedKey) { PgPowerEffect PowerEffect; if (effectDescription.StartsWith("{") && effectDescription.EndsWith("}")) { string EffectString = effectDescription.Substring(1, effectDescription.Length - 2); if (!ParseItemEffectAttribute(EffectString, parsedFile, parsedKey, out PowerEffect)) { return(Program.ReportFailure(parsedFile, parsedKey, $"Invalid attribute format '{EffectString}'")); } } else if (effectDescription.Contains("{") || effectDescription.Contains("}")) { return(Program.ReportFailure(parsedFile, parsedKey, $"Invalid attribute format '{effectDescription}'")); } else { if (!ParseItemEffectSimple(effectDescription, parsedFile, parsedKey, out PowerEffect)) { return(Program.ReportFailure(parsedFile, parsedKey, $"Invalid attribute format '{effectDescription}'")); } } ParsingContext.AddSuplementaryObject(PowerEffect); effectDescriptionList.Add(PowerEffect); return(true); }
public static bool ParseEffectDescriptionList(PgPowerEffectCollection effectDescriptionList, object value, string parsedFile, string parsedKey) { if (!(value is List <object> ObjectList)) { return(Program.ReportFailure(parsedFile, parsedKey, $"Value '{value}' was expected to be a list")); } foreach (object Item in ObjectList) { if (!(Item is string EffectDescription)) { return(Program.ReportFailure(parsedFile, parsedKey, $"Value '{Item}' was expected to be a string")); } if (!ParseEffectDescription(effectDescriptionList, EffectDescription, parsedFile, parsedKey)) { return(false); } } return(true); }