//能力値を設定する public static Searcher AbilityDataSet(Searcher searcher) { searcher.SetSkill(new Skill("アイデア", searcher.abilityValues.INT * 5, "探索")); searcher.SetSkill(new Skill("幸運", searcher.abilityValues.POW * 5, "探索")); searcher.SetSkill(new Skill("知識", searcher.abilityValues.EDU * 5, "探索")); if (searcher.skills.FindAll(s => s.name == "回避").Count == 0) { searcher.SetSkill(new Skill("回避", searcher.abilityValues.DEX * 2, "戦闘")); } searcher.characterInfos.damageBonus = GetBonusDamege(searcher.abilityValues.STR + searcher.abilityValues.SIZ); return(searcher); }
private Searcher ReplacementSkills(Dictionary <string, string> skills, Searcher searcher, string type) { foreach (var item in skills) { searcher.SetSkill(new Skill(item.Key, int.Parse(item.Value), type)); } return(searcher); }
//能力値を設定する public void AbilityDataSet() { Searcher.SetSkill(new Skill("アイデア", Searcher.abilityValues.INT * 5, "探索")); Searcher.SetSkill(new Skill("幸運", Searcher.abilityValues.POW * 5, "探索")); Searcher.SetSkill(new Skill("知識", Searcher.abilityValues.EDU * 5, "探索")); if (Searcher.skills.FindAll(s => s.name == "回避").Count == 0) { Searcher.SetSkill(new Skill("回避", Searcher.abilityValues.DEX * 2, "戦闘")); } Searcher.characterInfos.damageBonus = GetBonusDamege(Searcher.abilityValues.STR + Searcher.abilityValues.SIZ); }
private Searcher ImportCharacterByAngleSharp(string html, Searcher searcher) { var parser = new HtmlParser(); // HtmlParserクラスのParserメソッドを使用してパースする。 // Parserメソッドの戻り値の型はIHtmlDocument var doc = parser.ParseDocument(html); string[] dt; //キャラネームの取得 var name = doc.QuerySelector("h1").TextContent.Trim(); char[] removeChars = new char[] { ' ', ' ' }; string m_buff = removeChars.Aggregate(name, (s, c) => s.Replace(c.ToString(), "")); dt = m_buff.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries); searcher.characterInfos.characterName = dt[0]; //キャラ能力値の取得 var status = doc.QuerySelectorAll("tr[id = status_total] td"); var charaStatus = new List <String>(); foreach (var row in status) { var nodes = row.TextContent; if (nodes == null) { continue; } m_buff = removeChars.Aggregate(nodes, (s, c) => s.Replace(c.ToString(), "")); charaStatus.Add(m_buff.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries)[0]); } int num; searcher.characterInfos.HP = int.TryParse(charaStatus[8], out num) ? num : 0; searcher.characterInfos.MP = int.TryParse(charaStatus[9], out num) ? num : 0; searcher.characterInfos.SAN = int.TryParse(charaStatus[10], out num) ? num : 0; searcher.abilityValues.STR = int.TryParse(charaStatus[0], out num) ? num : 0; searcher.abilityValues.CON = int.TryParse(charaStatus[1], out num) ? num : 0; searcher.abilityValues.POW = int.TryParse(charaStatus[2], out num) ? num : 0; searcher.abilityValues.DEX = int.TryParse(charaStatus[3], out num) ? num : 0; searcher.abilityValues.APP = int.TryParse(charaStatus[4], out num) ? num : 0; searcher.abilityValues.SIZ = int.TryParse(charaStatus[5], out num) ? num : 0; searcher.abilityValues.INT = int.TryParse(charaStatus[6], out num) ? num : 0; searcher.abilityValues.EDU = int.TryParse(charaStatus[7], out num) ? num : 0; //技能の取得 foreach (var row in doc.QuerySelectorAll("div [id = skill] tr")) { var nodes = row.TextContent; if (nodes == null) { continue; } m_buff = removeChars.Aggregate(nodes, (s, c) => s.Replace(c.ToString(), "")); dt = m_buff.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries); try { if (dt[0] == "種別" || dt[1] == "技能名" || dt[2] == "値") { continue; } var value = int.TryParse(dt[2], out var m) ? m : -1; if (value == -1) { continue; } searcher.SetSkill(new Skill(dt[1], value, dt[0])); } catch (Exception exc) { Console.WriteLine(exc.Message); } } return(searcher); }
//スキルをキャラクターにセットする private Searcher AddSkillSearcher(string name, int value, string type, Searcher searcher) { searcher.SetSkill(new Skill(name, value, type)); return(searcher); }