private void ReadAttackDetailsBlock(string html, CreaturePower cp, string action) { cp.Details = CleanHtml(html); if (_regRange.IsMatch(cp.Details)) { string[] temp = cp.Details.Split(new char[] { ';' }, 2, StringSplitOptions.RemoveEmptyEntries); cp.Details = temp[1].Trim(); cp.Range = temp[0].Trim(); } if (cp.Action != null) // not a trait { cp.ExtractAttackDetails(); Match match = _regConditionsFrequency.Match(cp.Action.Trigger); if (match.Success) { // Charnel Cinderhouse Crushing Prison (free 1/round, at-will) cp.Condition = cp.Action.Trigger; cp.Action.Trigger = String.Empty; } if (action.ToLower().StartsWith("when ") && String.IsNullOrEmpty(cp.Action.Trigger)) { // Charnel Cinderhouse Crushing Prison /Charnel Pyre cp.Action.Trigger = action; cp.Action.Action = ActionType.Reaction; } } }
private HtmlNode ReadMM3Power(HtmlNode currentLine, CreaturePower cp, bool IsTrait, string powerTitleHtml) { string temp; cp.Keywords = CleanParenthesis(GetTextUntilTag(powerTitleHtml, "</b>")); Match match = _regConditionsFrequency.Match(powerTitleHtml); if (match.Success) { cp.Condition = match.Value.Trim(); powerTitleHtml = powerTitleHtml.Replace(match.Value, ""); } if (!IsTrait && cp.Action.Use != PowerUseType.Basic) { string afterName = powerTitleHtml.Replace(",", ";"); match = _regRequires.Match(afterName); if (match.Success) { //requires cp.Condition = CleanExtraComma(CleanHtml(match.Groups[1].Value)); powerTitleHtml = powerTitleHtml.Replace(match.Value, ""); } match = _regRecharge.Match(powerTitleHtml); if (match.Success) { CalculateRecharge(powerTitleHtml.Substring(match.Index), cp, MonsterStatType.MM3); } else { temp = GetTextUntilTag(powerTitleHtml, "<b>", 2); cp.Action.Use = ActionUseFromText(temp); } } // Read power details while (currentLine != null && currentLine.Name == "p" && (currentLine.Attributes["Class"].Value != "flavor alt")) //mean new power { bool textAffected = false; if (currentLine.InnerHtml.ToLower().StartsWith("<i>attack:</i>")) { temp = GetTextUntilTag(currentLine.InnerHtml, "</i>"); ReadAttackDetailsBlock(temp, cp, ""); cp.ExtractAttackDetails(); textAffected = true; } if (currentLine.InnerHtml.ToLower().StartsWith("<i>requirement:</i>")) { cp.Condition = GetTextUntilTag(currentLine.InnerHtml, "</i>"); textAffected = true; } if (currentLine.InnerHtml.ToLower().StartsWith("<i>trigger:</i>")) { cp.Action.Trigger = GetTextUntilTag(currentLine.InnerHtml, "</i>"); textAffected = true; } if (!textAffected) { if (!String.IsNullOrEmpty(cp.Details)) { cp.Details += Environment.NewLine; } cp.Details += CleanHtml(currentLine.InnerText); } currentLine = currentLine.NextSibling; } if (cp.Attack == null) { // BloodSpear Save Throng Move actions containing an attack in the details text cp.Attack = TryToGetAttackFrom(cp.Details); } return(currentLine); }