示例#1
0
 public static string Format(this XXEffect target, string format)
 {
     return(string.Format(format, target.Name
                          , target.Usage
                          , target.CostErosion
                          , target.CostHP
                          ));
 }
示例#2
0
        public XXEffect(XXEffect copy) : this()
        {
            this.Name          = copy.Name;
            this.EffectLevel   = copy.EffectLevel;
            this.Usage         = copy.Usage;
            this.CostErosion   = copy.CostErosion;
            this.CostHP        = copy.CostHP;
            this.LimitErosion  = copy.LimitErosion;
            this.LimitCritical = copy.LimitCritical;
            this.IsMajor       = copy.IsMajor;

            int i = 0;

            foreach (var v in this.EffectValues)
            {
                v.Value = copy.EffectValues[i++].Value;
            }
        }
示例#3
0
        private static XXPC ParsePC(string url, HtmlDocument html)
        {
            var result = new XXPC
            {
                SheetUrl = url,
            };

            result.DodontoFPCData.UsingSystem = TrpgSystem.DoubleCross;


            var charaTitles = new List <string>()
            {
                "肉体", "感覚", "精神", "社会", "HP", "侵蝕", "行動", "移動"
            };

            var tables = html.DocumentNode.SelectNodes("//table");

            result.DodontoFPCData.Resources.Items.Clear();

            var cnt     = 0;
            var erosion = 0;

            foreach (var table in tables)
            {
                switch (cnt++)
                {
                case 0:     //能力値・HP
                {
                    //var charaTitles = table.SelectNodes("tbody/tr/th").Select(i => i.InnerText).ToList();
                    var charaValues = table.SelectNodes(@"tbody/tr/td[@class=""sumTD""]/input").Select(i => i.Attributes["value"].Value).ToList();

                    //Physical, Perceptional, Mental, Social
                    foreach (int i in Enumerable.Range(0, 4))
                    {
                        int.TryParse(charaValues[i], out int cv);
                        result.CharacterValues.AddItem(new BindableValue <int>(cv));
                    }

                    //HP, /HP
                    {
                        int.TryParse(charaValues[4], out int cv);
                        result.DodontoFPCData.Resources.AddItem(new BindableValue <int>(cv));
                        result.DodontoFPCData.Resources.AddItem(new BindableValue <int>(cv));
                    }

                    //侵蝕率,ロイス
                    {
                        int.TryParse(charaValues[5], out int cv);
                        erosion = cv;
                        result.DodontoFPCData.Resources.AddItem(new BindableValue <int>(cv));
                        result.DodontoFPCData.Resources.AddItem(new BindableValue <int>(7));
                    }


                    //var data = charaValues.Zip(titles, (i, j) => j + ":" + i).ToList()

                    break;
                }

                case 1:     //ライフパス

                    //未使用
                    break;

                case 2:     //エフェクト
                case 3:     //イージーエフェクト
                {
                    var Effects = table.SelectNodes("tbody/tr");

                    foreach (var EffectRow in Effects)
                    {
                        //var Memo = EffectRow.SelectSingleNode("th")?.InnerText;
                        var Effect = EffectRow.SelectNodes("td")?.Select(i => getEffectName(i)).ToList();
                        //0エフェクト名 1SL 2タイミング 3判定 4対象 5射程 6コスト 7制限 8効果など

                        if (Effect != null)
                        {
                            var ae = new XXEffect
                            {
                                Name  = Effect[0],
                                Usage = $"[{Effect[2]}]{Effect[8]}"
                            };

                            int.TryParse(Effect[1], out var cv1);
                            ae.EffectLevel = cv1;

                            int.TryParse(Effect[6], out var cv6);
                            ae.CostErosion = cv6;

                            ae.IsMajor = (Effect[2] == "メジャー");

                            ae.SetErosion(erosion);
                            result.Effects.AddItem(ae);
                        }
                    }

                    break;
                }

                case 4:     //技能_初期習得

                    //未使用
                    break;

                case 5:     //技能_各SL
                {
                    var RollDices = table.SelectNodes("tbody/tr");

                    var rcnt       = 0;
                    var addEffects = new int[] { 1, 4 };

                    foreach (var RollDiceRow in RollDices)
                    {
                        var RollTitle = RollDiceRow.SelectSingleNode("th")?.InnerText;
                        var RollDice  = RollDiceRow.SelectNodes("td")?.Select(i => getEffectName(i)).ToList();

                        if (RollDice != null)
                        {
                            //使用能力値index
                            var cv = rcnt++ / 3;
                            var rd = TrpgSystem.DoubleCross.MakeNormalRollDice();

                            //0 SL   (使用しない)
                            //1 能力 (使用しない)
                            //2 技能 (使用しない)
                            //3 判定 (<DiceNumber>r+<DiceConst>)
                            //4 参考 (技能名の後ろに括弧書きで追加)

                            var res = Regex.Match(RollDice[3], @"(?<DiceNumber>[0-9]+)r[+-]*(?<DiceConst>[0-9]*)");
                            rd.RollGroup = charaTitles[cv];
                            rd.RollName  = RollTitle + (!string.IsNullOrEmpty(RollDice[4]) ? $"({RollDice[4]})" : "");

                            rd.DiceNumber = int.Parse(res.Groups["DiceNumber"].ToString());

                            int.TryParse(res.Groups["DiceConst"].ToString(), out var dc);
                            rd.DiceConst = dc;

                            result.RollDices.AddItem(rd);

                            //0白兵、3射撃はコンボ作成に必要なのでエフェクトに追加する。
                            if (addEffects.Contains(rcnt))
                            {
                                var ae = new XXEffect()
                                {
                                    Name  = $"{rd.RollName}攻撃({rd.RollGroup})",
                                    Usage = $"[EL:★/メジャー]{rd.RollName}攻撃({rd.RollGroup})"
                                };
                                ae.EffectValues[(int)XXEffectValueName.DiceNumber].Value   = rd.DiceNumber.ToString();
                                ae.EffectValues[(int)XXEffectValueName.DiceCritical].Value = rd.DiceBase.ToString();
                                ae.EffectValues[(int)XXEffectValueName.DiceConst].Value    = rd.DiceConst.ToString();

                                ae.IsMajor = true;

                                ae.SetErosion(erosion);
                                result.Effects.AddItem(ae);
                            }
                        }
                    }

                    //白兵、射撃を上段に移動
                    var ec = result.Effects.Items.Count();
                    result.Effects.MoveAt(ec - 1, "Top");
                    result.Effects.MoveAt(ec - 1, "Top");


                    break;
                }

                case 6:     //戦闘・武器・防具_武器
                {
                    break;
                }

                case 7:     //戦闘・武器・防具_防具
                {
                    break;
                }

                case 8:     //所持品・所持金

                    //未使用
                    break;


                case 9:     //ロイス

                    //未使用
                    break;

                case 10:     //成長履歴_取得経験点
                case 11:     //成長履歴_使用経験点

                    //未使用
                    break;

                case 12:     //パーソナルデータ
                {
                    //名前のみ使用。将来的に他のデータも保持する。
                    //var FieldNames = table.SelectNodes("tbody/tr/th").Select(i => i.InnerText.Trim()).ToList<string>();
                    var FieldValues = table.SelectNodes("tbody/tr/td/input").Select(i => i.Attributes["value"].Value).ToList <string>();
                    result.Name = string.IsNullOrEmpty(FieldValues[0]) ? "名無し(パーソナルデータ-キャラクター名に名前を入力!)" : FieldValues[0];
                    break;
                }

                case 13:     //

                    //未使用
                    break;
                }
            }

            return(result);

            string getEffectName(HtmlNode node)
            {
                var resEN = "";

                try
                {
                    resEN = node.SelectSingleNode("input").Attributes["Value"].Value;
                }
                catch
                {
                    resEN = node.InnerText;
                }
                return(resEN);
            }
        }