//[Test] public void TestAccents() { var match = new MockMatch(); var legality = new PennyDreadfulLegality(); Assert.IsTrue(legality.IsCardLegal(CardName.FixAccents("Dandan"))); //Assert.IsTrue(legality.IsCardLegal(CardName.FixAccents("Junún Efreet"))); Assert.IsTrue(legality.IsCardLegal(CardName.FixAccents("DandAþn"))); Assert.IsFalse(legality.IsCardLegal(CardName.FixAccents("Lim-dl"))); }
public GameLogLine(string line, IMatch match) { var createsMatch = NewToken.Match(line); if (createsMatch.Success) { var name = createsMatch.Groups["name"].Value; if (!name.EndsWith("token") && !LegendaryTokens.Contains(name) && !match.NamedTokens.Contains(name)) { match.NamedTokens.Add(name); } } var copiesToken = Transreliquat.Match(line); if (copiesToken.Success) { var name = copiesToken.Groups["name"].Value; if (!LegendaryTokens.Contains(name) && !match.NamedTokens.Contains(name)) { match.NamedTokens.Add(name); } } this.Line = line; var i = -1; while ((i = line.IndexOf('[')) != -1) { line = line.Substring(i); var end = line.IndexOf("]"); if (end == -1 && line.Contains("...")) { // Ugh. return; } var name = line.Substring(1, end - 1); name = CardName.FixAccents(name); line = line.Substring(end + 1); var IsToken = line.TrimStart().StartsWith("token"); if (LegendaryTokens.Contains(name) || match.NamedTokens.Contains(name)) { IsToken = true; } if (IsToken) { this.Tokens.Add(name); } else { this.Cards.Add(name); } } }