From 36a43fe7b6d76fa0396448d746baa2df087196d3 Mon Sep 17 00:00:00 2001 From: Yan Maniez Date: Mon, 18 Jun 2018 23:21:16 +0200 Subject: [PATCH] =?UTF-8?q?Reparsing=20des=20propri=C3=A9t=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AideDeJeu/Tools/MarkdownExtensions.cs | 182 ++++++++++++++---- Data/monsters_hd.md | 4 +- 2 files changed, 144 insertions(+), 42 deletions(-) diff --git a/AideDeJeu/AideDeJeu/Tools/MarkdownExtensions.cs b/AideDeJeu/AideDeJeu/Tools/MarkdownExtensions.cs index db73cf88..8cedb666 100644 --- a/AideDeJeu/AideDeJeu/Tools/MarkdownExtensions.cs +++ b/AideDeJeu/AideDeJeu/Tools/MarkdownExtensions.cs @@ -241,48 +241,150 @@ namespace AideDeJeu.Tools var paragraphBlock = ininblock as Markdig.Syntax.ParagraphBlock; //DumpParagraphBlock(paragraphBlock); var str = paragraphBlock.Inline.ToContainerString(); - var match = regex.Match(str); - var key = match.Groups["key"].Value; - var value = match.Groups["value"].Value; - switch (key) + //var match = regex.Match(str); + //var key = match.Groups["key"].Value; + //var value = match.Groups["value"].Value; + //switch (key) + //{ + //case "NameVO": + // monster.NameVO = value; + // break; + //case "SizeAlignment": + if(str.StartsWith("Classe d'armure ")) { - case "NameVO": - monster.NameVO = value; - break; - case "SizeAlignment": - { - var regexx = new Regex("(?.*) de taille (?.*), (?.*)"); - var matchh = regexx.Match(value); - monster.Alignment = matchh.Groups["alignment"].Value; - monster.Size = matchh.Groups["size"].Value; - monster.Type = matchh.Groups["type"].Value; - } - break; - case "ArmorClass": - monster.ArmorClass = value; - break; - case "HitPoints": - monster.HitPoints = value; - break; - case "Speed": - monster.Speed = value; - break; - case "SavingThrows": - monster.SavingThrows = value; - break; - case "Skills": - monster.Skills = value ; - break; - case "Senses": - monster.Senses = value; - break; - case "Languages": - monster.Languages = value; - break; - case "Challenge": - monster.Challenge = value; - break; + monster.ArmorClass = str; } + else if (str.StartsWith("Points de vie ")) + { + monster.HitPoints = str; + } + else if (str.StartsWith("Vitesse ")) + { + monster.Speed = str; + } + else if (str.StartsWith("Résistance aux dégâts ")) + { + monster.DamageResistances = str; + } + else if (str.StartsWith("Résistances aux dégâts ")) + { + monster.DamageResistances = str; + } + else if (str.StartsWith("Résistance contre les dégâts ")) + { + monster.DamageResistances = str; + } + else if (str.StartsWith("Résistances contre les dégâts ")) + { + monster.DamageResistances = str; + } + else if (str.StartsWith("Immunité contre les dégâts ")) + { + monster.DamageImmunities = str; + } + else if (str.StartsWith("Immunité contre des dégâts ")) + { + monster.DamageImmunities = str; + } + else if (str.StartsWith("Immunité aux dégâts ")) + { + monster.DamageImmunities = str; + } + else if (str.StartsWith("Immunité à l'état ")) + { + monster.ConditionImmunities = str; + } + else if (str.StartsWith("Immunités à l'état ")) + { + monster.ConditionImmunities = str; + } + else if (str.StartsWith("Immunité contre l'état ")) + { + monster.ConditionImmunities = str; + } + else if (str.StartsWith("Immunité contre les états ")) + { + monster.ConditionImmunities = str; + } + else if (str.StartsWith("Immunités contre les états ")) + { + monster.ConditionImmunities = str; + } + else if (str.StartsWith("Vulnérabilité ")) + { + monster.DamageVulnerabilities = str; + } + else if (str.StartsWith("Sens ")) + { + monster.Senses = str; + } + else if (str.StartsWith("Langue ")) + { + monster.Languages = str; + } + else if (str.StartsWith("Dangerosité ")) + { + monster.Challenge = str; + } + else if (str.StartsWith("Jets de sauvegarde ")) + { + monster.Challenge = str; + } + else if (str.StartsWith("Jet de sauvegarde ")) + { + monster.Challenge = str; + } + else if (str.StartsWith("Compétences ")) + { + monster.Skills = str; + } + else if (str.StartsWith("Compétence ")) + { + monster.Skills = str; + } + else if (str.StartsWith("Langues ")) + { + monster.Languages = str; + } + else + { + if (monster.Alignment != null) + { + App.Current.MainPage.DisplayAlert("Erreur de parsing", str, "OK"); + } + //Debug.Assert(monster.Alignment == null, str); + var regexx = new Regex("(?.*) de taille (?.*), (?.*)"); + var matchh = regexx.Match(str); + monster.Alignment = matchh.Groups["alignment"].Value; + monster.Size = matchh.Groups["size"].Value; + monster.Type = matchh.Groups["type"].Value; + } + //break; + // if(str.st "ArmorClass": + // monster.ArmorClass = value; + // break; + // case "HitPoints": + // monster.HitPoints = value; + // break; + // case "Speed": + // monster.Speed = value; + // break; + // case "SavingThrows": + // monster.SavingThrows = value; + // break; + // case "Skills": + // monster.Skills = value ; + // break; + // case "Senses": + // monster.Senses = value; + // break; + // case "Languages": + // monster.Languages = value; + // break; + // case "Challenge": + // monster.Challenge = value; + // break; + //} } } diff --git a/Data/monsters_hd.md b/Data/monsters_hd.md index a54bf863..180670ae 100644 --- a/Data/monsters_hd.md +++ b/Data/monsters_hd.md @@ -587,7 +587,7 @@ plus 3 (1d6) dégâts de feu. | --- | --- | --- | --- | --- | --- | |10 (+0)| 8 (-1)|16 (+3)| 3 (-4)|10 (+0)| 6 (-2)| -- Immunité contre l'étatà terre +- Immunité contre l'état à terre - Sens vision dans le noir 18 m, Perception passive 10 - Langue — - Dangerosité 2 (450 PX) @@ -10287,7 +10287,7 @@ Touché : 4 (1d4+2) dégâts perforants. ## Capacités -- Immunité limitée à la magie. Le rakshasa ne peut +* Immunité limitée à la magie. Le rakshasa ne peut pas être affecté ou détecté par des sorts de niveau 6 ou moins, à moins qu'il ne le souhaite. Il obtient un avantage lors des jets de sauvegarde contre tous les