Example #1
0
        // UPGRADE_WARNING: イベント txtMP3Volume.TextChanged は、フォームが初期化されたときに発生します。 詳細については、'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="88B12AE1-6DE0-48A0-86F1-60C0686C026A"' をクリックしてください。
        private void txtMP3Volume_TextChanged(object eventSender, EventArgs eventArgs)
        {
            var    IsMP3Supported = default(object);
            string argexpr        = txtMP3Volume.Text;

            Sound.MP3Volume   = (short)GeneralLib.StrToLng(ref argexpr);
            txtMP3Volume.Text = argexpr;
            if (Sound.MP3Volume < 0)
            {
                Sound.MP3Volume   = 0;
                txtMP3Volume.Text = "0";
            }
            else if (Sound.MP3Volume > 100)
            {
                Sound.MP3Volume   = 100;
                txtMP3Volume.Text = "100";
            }

            hscMP3Volume.Value = Sound.MP3Volume;

            // UPGRADE_WARNING: オブジェクト IsMP3Supported の既定プロパティを解決できませんでした。 詳細については、'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' をクリックしてください。
            if (Conversions.ToBoolean(IsMP3Supported))
            {
                VBMP3.vbmp3_setVolume(Sound.MP3Volume, Sound.MP3Volume);
            }
        }
Example #2
0
        protected override int ExecInternal()
        {
            string wname;
            int    wid, num;
            Unit   u;

            switch (ArgNum)
            {
            case 4:
            {
                u     = GetArgAsUnit(2);
                wname = GetArgAsString(3);
                num   = GetArgAsLong(4);
                break;
            }

            case 3:
            {
                u     = Event.SelectedUnitForEvent;
                wname = GetArgAsString(2);
                num   = GetArgAsLong(3);
                break;
            }

            default:
                throw new EventErrorException(this, "SetBulletコマンドの引数の数が違います");
            }

            if (Information.IsNumeric(wname))
            {
                wid = GeneralLib.StrToLng(wname);
                if (wid < 1 || u.CountWeapon() < wid)
                {
                    throw new EventErrorException(this, "武器の番号「" + wname + "」が間違っています");
                }
            }
            else
            {
                var loopTo = u.CountWeapon();
                for (wid = 1; wid <= loopTo; wid++)
                {
                    if ((u.Weapon(wid).Name ?? "") == (wname ?? ""))
                    {
                        break;
                    }
                }

                if (wid < 1 || u.CountWeapon() < wid)
                {
                    throw new EventErrorException(this, u.Name + "は武器「" + wname + "」を持っていません");
                }
            }

            var uw = u.Weapon(wid);

            uw.SetBullet(GeneralLib.MinLng(num, uw.MaxBullet()));
            return(EventData.NextID);
        }
Example #3
0
        protected override int ExecInternal()
        {
            string aname;
            int    aid, num;
            Unit   u;

            switch (ArgNum)
            {
            case 4:
            {
                u     = GetArgAsUnit(2);
                aname = GetArgAsString(3);
                num   = GetArgAsLong(4);
                break;
            }

            case 3:
            {
                u     = Event.SelectedUnitForEvent;
                aname = GetArgAsString(2);
                num   = GetArgAsLong(3);
                break;
            }

            default:
                throw new EventErrorException(this, "SetStockコマンドの引数の数が違います");
            }

            if (Information.IsNumeric(aname))
            {
                aid = GeneralLib.StrToLng(aname);
                if (aid < 1 || u.CountAbility() < aid)
                {
                    throw new EventErrorException(this, "アビリティの番号「" + aname + "」が間違っています");
                }
            }
            else
            {
                var loopTo = u.CountAbility();
                for (aid = 1; aid <= loopTo; aid++)
                {
                    if ((u.Ability(aid).Data.Name ?? "") == (aname ?? ""))
                    {
                        break;
                    }
                }

                if (aid < 1 || u.CountAbility() < aid)
                {
                    throw new EventErrorException(this, u.Name + "はアビリティ「" + aname + "」を持っていません");
                }
            }

            var ua = u.Ability(aid);

            ua.SetStock(GeneralLib.MinLng(num, ua.MaxStock()));
            return(EventData.NextID);
        }
Example #4
0
 public void StrToLngTest()
 {
     Assert.AreEqual(0, GeneralLib.StrToLng(""));
     Assert.AreEqual(1, GeneralLib.StrToLng("1"));
     Assert.AreEqual(1, GeneralLib.StrToLng("1.0"));
     Assert.AreEqual(1, GeneralLib.StrToLng("1.1"));
     Assert.AreEqual(1, GeneralLib.StrToLng("1.9"));
     //Assert.AreEqual(1, GeneralLib.StrToLng("0x1"));
 }
Example #5
0
File: XY.cs Project: 7474/SRC
        protected override ValueType InvokeInternal(SRC SRC, ValueType etype, string[] @params, int pcount, bool[] is_term, out string str_result, out double num_result)
        {
            str_result = "";
            num_result = 0d;

            switch (pcount)
            {
            case 1:
                var pname = SRC.Expression.GetValueAsString(@params[1], is_term[1]);
                if (GeneralLib.IsNumber(pname))
                {
                    num_result = GeneralLib.StrToLng(pname);
                }
                else if (pname == "目標地点")
                {
                    num_result = SRC.Commands.SelectedY;
                }
                else if (SRC.UList.IsDefined2(pname))
                {
                    num_result = SRC.UList.Item2(pname).y;
                }
                else if (SRC.PList.IsDefined(pname))
                {
                    {
                        var p = SRC.PList.Item(pname);
                        if (p.Unit is object)
                        {
                            num_result = p.Unit.y;
                        }
                    }
                }

                break;

            case 0:
                if (SRC.Event.SelectedUnitForEvent is object)
                {
                    num_result = SRC.Event.SelectedUnitForEvent.y;
                }

                break;
            }

            num_result = SRC.GUI.MapToPixelY((int)num_result);
            if (etype == ValueType.StringType)
            {
                str_result = GeneralLib.FormatNum(num_result);
                return(ValueType.StringType);
            }
            else
            {
                return(ValueType.NumericType);
            }
        }
Example #6
0
        private void txtMP3Volume_TextChanged(object eventSender, EventArgs eventArgs)
        {
            var volume = GeneralLib.StrToLng(txtMP3Volume.Text);

            if (volume < 0)
            {
                volume            = 0;
                txtMP3Volume.Text = "0";
            }
            else if (volume > 100)
            {
                volume            = 100;
                txtMP3Volume.Text = "100";
            }

            hscMP3Volume.Value = volume;
        }
Example #7
0
        protected override int ExecInternal()
        {
            if (ArgNum < 4)
            {
                throw new EventErrorException(this, "PaintPictureコマンドの引数の数が違います");
            }

            var buf     = "";
            var options = "";
            var tcolor  = Color.White;
            var i       = 5;
            var opt_n   = 4;

            while (i <= ArgNum)
            {
                buf = GetArgAsString(i);
                switch (buf ?? "")
                {
                case "透過":
                case "背景":
                case "白黒":
                case "セピア":
                case "明":
                case "暗":
                case "上下反転":
                case "左右反転":
                case "上半分":
                case "下半分":
                case "右半分":
                case "左半分":
                case "右上":
                case "左上":
                case "右下":
                case "左下":
                case "ネガポジ反転":
                case "シルエット":
                case "夕焼け":
                case "水中":
                case "保持":
                case "フィルタ":
                {
                    options = options + buf + " ";
                    break;
                }

                case "右回転":
                {
                    i       = (i + 1);
                    options = options + "右回転 " + GetArgAsString(i) + " ";
                    break;
                }

                case "左回転":
                {
                    i       = (i + 1);
                    options = options + "左回転 " + GetArgAsString(i) + " ";
                    break;
                }

                case "-":
                {
                    // スキップ
                    // スキップ
                    opt_n = i;
                    break;
                }

                case var @case when @case == "":
                {
                    break;
                }

                default:
                {
                    if (Strings.Asc(buf) == 35 && Strings.Len(buf) == 7)
                    {
                        Color filterColor = ColorExtension.FromHexString(buf);
                        if (!filterColor.IsEmpty)
                        {
                            if (GetArgAsString((i - 1)) == "フィルタ")
                            {
                                options = options + filterColor.ToHexString() + " ";
                            }
                        }
                    }
                    else if (Information.IsNumeric(buf))
                    {
                        // スキップ
                        opt_n = i;
                    }
                    else if (Strings.InStr(buf, " ") > 0)
                    {
                        options = options + buf + " ";
                    }
                    else if (Strings.Right(buf, 1) == "%" && Information.IsNumeric(Strings.Left(buf, Strings.Len(buf) - 1)))
                    {
                        options = options + buf + " ";
                    }
                    else
                    {
                        throw new EventErrorException(this, "PaintPictureコマンドの" + i + "番目のパラメータ「" + buf + "」が不正です");
                    }

                    break;
                }
                }

                i = (i + 1);
            }

            var fname = GetArgAsString(2);

            switch (Strings.Right(Strings.LCase(fname), 4) ?? "")
            {
            // 正しい画像ファイル名
            case ".bmp":
            case ".jpg":
            case ".gif":
            case ".png":
                break;

            default:
                if (SRC.PDList.IsDefined(fname))
                {
                    fname = @"Pilot\" + SRC.PDList.Item(fname).Bitmap;
                }
                else if (SRC.NPDList.IsDefined(fname))
                {
                    fname = @"Pilot\" + SRC.NPDList.Item(fname).Bitmap;
                }
                else if (SRC.UDList.IsDefined(fname))
                {
                    fname = @"Unit\" + SRC.UDList.Item(fname).Bitmap;
                }
                else
                {
                    throw new EventErrorException(this, "不正な画像ファイル名「" + fname + "」が指定されています");
                }

                break;
            }

            // 描画先の画像
            int dx, dy, dw, dh;

            buf = GetArgAsString(3);
            if (buf == "-")
            {
                dx = Constants.DEFAULT_LEVEL;
            }
            else
            {
                dx = GeneralLib.StrToLng(buf) + Event.BaseX;
            }

            buf = GetArgAsString(4);
            if (buf == "-")
            {
                dy = Constants.DEFAULT_LEVEL;
            }
            else
            {
                dy = GeneralLib.StrToLng(buf) + Event.BaseY;
            }

            // 描画サイズ
            if (opt_n >= 6)
            {
                buf = GetArgAsString(5);
                if (buf == "-")
                {
                    dw = Constants.DEFAULT_LEVEL;
                }
                else
                {
                    dw = GeneralLib.StrToLng(buf);
                    if (dw <= 0)
                    {
                        return(EventData.NextID);
                    }
                }

                buf = GetArgAsString(6);
                if (buf == "-")
                {
                    dh = Constants.DEFAULT_LEVEL;
                }
                else
                {
                    dh = GeneralLib.StrToLng(buf);
                    if (dh <= 0)
                    {
                        return(EventData.NextID);
                    }
                }
            }
            else
            {
                dw = Constants.DEFAULT_LEVEL;
                dh = Constants.DEFAULT_LEVEL;
            }

            // 原画像における転送元座標&サイズ
            int sx, sy, sw, sh;

            if (opt_n == 10)
            {
                buf = GetArgAsString(7);
                if (buf == "-")
                {
                    sx = Constants.DEFAULT_LEVEL;
                }
                else
                {
                    sx = GeneralLib.StrToLng(buf);
                }

                buf = GetArgAsString(8);
                if (buf == "-")
                {
                    sy = Constants.DEFAULT_LEVEL;
                }
                else
                {
                    sy = GeneralLib.StrToLng(buf);
                }

                sw = GetArgAsLong(9);
                sh = GetArgAsLong(10);
            }
            else
            {
                sx = 0;
                sy = 0;
                sw = 0;
                sh = 0;
            }

            GUI.DrawPicture(fname, dx, dy, dw, dh, sx, sy, sw, sh, options);
            SRC.LogTrace($"DrawPicture({fname}, {dx}, {dy}, {dw}, {dh}, {sx}, {sy}, {sw}, {sh}, {options})");

            return(EventData.NextID);
        }
Example #8
0
        // 「特殊能力一覧」コマンド
        private void FeatureListCommand()
        {
            LogDebug();

            GUI.LockGUI();

            // 表示する特殊能力名一覧の作成
            var list = new List <ListBoxItem <ItemKind> >();

            var currentUnit = SelectedUnit;

            // 武器・防具クラス
            if (Expression.IsOptionDefined("アイテム交換"))
            {
                if (currentUnit.IsFeatureAvailable("武器クラス") || currentUnit.IsFeatureAvailable("防具クラス"))
                {
                    list.Add(new ListBoxItem <ItemKind>("武器・防具クラス", "武器・防具クラス"));
                }
            }

            var p = SelectedUnit.MainPilot();
            // パイロット特殊能力
            var loopTo = p.CountSkill();

            for (var i = 1; i <= loopTo; i++)
            {
                string fname = "";
                switch (p.Skill(i) ?? "")
                {
                case "得意技":
                case "不得手":
                {
                    fname = p.Skill(i);
                    break;
                }

                default:
                {
                    fname = p.SkillName(i);
                    break;
                }
                }

                // 非表示の能力は除く
                if (Strings.InStr(fname, "非表示") > 0)
                {
                    continue;
                }

                // 既に表示されていればスキップ
                if (list.Any(x => x.Text == fname))
                {
                    continue;
                }

                // リストに追加
                list.Add(new ListBoxItem <ItemKind>(fname, "" + i)
                {
                    ListItemObject = ItemKind.Pilot,
                });
            }

            // 付加・強化されたパイロット用特殊能力
            foreach (var cond in currentUnit.Conditions)
            {
                // パイロット能力付加または強化?
                if (Strings.Right(cond.Name, 3) != "付加2" && Strings.Right(cond.Name, 3) != "強化2")
                {
                    continue;
                }

                var ftype = Strings.Left(cond.Name, Strings.Len(cond.Name) - 3);

                // 非表示の能力?
                switch (GeneralLib.LIndex(cond.StrData, 1) ?? "")
                {
                case "非表示":
                case "解説":
                    continue;
                }

                // 有効時間が残っている?
                if (!cond.IsEnable)
                {
                    continue;
                }

                // 表示名称
                var fname = currentUnit.MainPilot().SkillName(ftype);
                if (Strings.InStr(fname, "非表示") > 0)
                {
                    continue;
                }

                // 既に表示していればスキップ
                if (list.Any(x => x.Text == fname))
                {
                    continue;
                }

                // リストに追加
                list.Add(new ListBoxItem <ItemKind>(fname, ftype)
                {
                    ListItemObject = ItemKind.Pilot,
                });
            }

            // ユニット用特殊能力
            // 付加された特殊能力より先に固有の特殊能力を表示
            foreach (var i in Enumerable.Range(
                         currentUnit.AdditionalFeaturesNum + 1,
                         currentUnit.AllFeatures.Count - currentUnit.AdditionalFeaturesNum)
                     .AppendRange(Enumerable.Range(1, currentUnit.AdditionalFeaturesNum)))
            {
                var fd    = currentUnit.AllFeature(i);
                var fname = fd.FeatureName(currentUnit);
                // 非表示の特殊能力を排除
                if (string.IsNullOrEmpty(fname))
                {
                    continue;
                }

                // 合体の場合は合体後の形態が作成されていなければならない
                if (fd.Name == "合体" && !SRC.UList.IsDefined(GeneralLib.LIndex(fd.Data, 2)))
                {
                    continue;
                }

                // 既に表示していればスキップ
                if (list.Any(x => x.Text == fname))
                {
                    continue;
                }

                // リストに追加
                list.Add(new ListBoxItem <ItemKind>(fname, "" + i)
                {
                    ListItemObject = ItemKind.Unit,
                });
            }

            // アビリティで付加・強化されたパイロット用特殊能力
            foreach (var cond in currentUnit.Conditions)
            {
                // パイロット能力付加または強化?
                if (Strings.Right(cond.Name, 2) != "付加" && Strings.Right(cond.Name, 2) != "強化")
                {
                    continue;
                }

                var ftype = Strings.Left(cond.Name, Strings.Len(cond.Name) - 2);

                // 非表示の能力?
                if (ftype == "メッセージ")
                {
                    continue;
                }
                switch (GeneralLib.LIndex(cond.StrData, 1) ?? "")
                {
                case "非表示":
                case "解説":
                    continue;
                }

                // 有効時間が残っている?
                if (!cond.IsEnable)
                {
                    continue;
                }

                // 表示名称
                var fname = currentUnit.MainPilot().SkillName0(ftype);
                if (string.IsNullOrEmpty(fname))
                {
                    continue;
                }
                if (Strings.InStr(fname, "非表示") > 0)
                {
                    continue;
                }

                // 付加されたユニット用特殊能力として既に表示していればスキップ
                if (list.Any(x => x.Text == fname))
                {
                    continue;
                }

                fname = currentUnit.MainPilot().SkillName(ftype);
                string fname0;
                if (Strings.InStr(fname, "Lv") > 0)
                {
                    fname0 = Strings.Left(fname, Strings.InStr(fname, "Lv") - 1);
                }
                else
                {
                    fname0 = fname;
                }

                // パイロット用特殊能力として既に表示していればスキップ
                if (list.Any(x => x.Text == fname || x.Text == fname0))
                {
                    continue;
                }

                // リストに追加
                list.Add(new ListBoxItem <ItemKind>(fname, ftype)
                {
                    ListItemObject = ItemKind.Pilot,
                });
            }

            switch (list.Count)
            {
            case 0:
                break;

            case 1:
            {
                if (SRC.AutoMoveCursor)
                {
                    GUI.SaveCursorPos();
                }

                var retItem = list.First();
                if (retItem.ListItemID == "武器・防具クラス")
                {
                    Help.FeatureHelp(SelectedUnit, "武器・防具クラス", false);
                }
                else if (retItem.ListItemObject == ItemKind.Unit)
                {
                    Help.FeatureHelp(SelectedUnit, GeneralLib.StrToLng(retItem.ListItemID), GeneralLib.StrToLng(retItem.ListItemID) <= SelectedUnit.AdditionalFeaturesNum);
                }
                else
                {
                    Help.SkillHelp(SelectedUnit.MainPilot(), retItem.ListItemID);
                }

                if (SRC.AutoMoveCursor)
                {
                    GUI.RestoreCursorPos();
                }
            }
            break;

            default:
            {
                GUI.TopItem = 1;
                var ret = GUI.ListBox(new ListBoxArgs
                    {
                        lb_caption = "特殊能力一覧",
                        Items      = list.Cast <ListBoxItem>().ToList(),
                        lb_info    = "能力名",
                        lb_mode    = "表示のみ",
                    });
                if (SRC.AutoMoveCursor)
                {
                    GUI.MoveCursorPos("ダイアログ");
                }

                while (true)
                {
                    ret = GUI.ListBox(new ListBoxArgs
                        {
                            lb_caption = "特殊能力一覧",
                            Items      = list.Cast <ListBoxItem>().ToList(),
                            lb_info    = "能力名",
                            lb_mode    = "連続表示",
                        });
                    GUI.CloseListBox();
                    if (ret == 0)
                    {
                        break;
                    }

                    var retItem = list[ret - 1];
                    if (retItem.ListItemID == "武器・防具クラス")
                    {
                        Help.FeatureHelp(SelectedUnit, "武器・防具クラス", false);
                    }
                    else if (retItem.ListItemObject == ItemKind.Unit)
                    {
                        Help.FeatureHelp(SelectedUnit, GeneralLib.StrToLng(retItem.ListItemID), GeneralLib.StrToLng(retItem.ListItemID) <= SelectedUnit.AdditionalFeaturesNum);
                    }
                    else
                    {
                        Help.SkillHelp(SelectedUnit.MainPilot(), retItem.ListItemID);
                    }
                }

                if (SRC.AutoMoveCursor)
                {
                    GUI.RestoreCursorPos();
                }
                break;
            }
            }

            CommandState = "ユニット選択";
            GUI.UnlockGUI();
        }
Example #9
0
        public PilotData LoadPilot(SrcDataReader reader, PilotData lastPd)
        {
            PilotData pd = null;

            try
            {
                string buf, buf2;

                string data_name = "";
                string line_buf  = "";
                // 空行をスキップ
                while (reader.HasMore && string.IsNullOrEmpty(line_buf))
                {
                    line_buf = reader.GetLine();
                }
                if (lastPd != null)
                {
                    lastPd.DataComment = reader.RawComment.Trim();
                }
                else
                {
                    DataComment = string.Join(Environment.NewLine + Environment.NewLine,
                                              new string[] {
                        DataComment,
                        reader.RawComment.Trim(),
                    }.Where(x => !string.IsNullOrEmpty(x)));
                }
                reader.ClearRawComment();
                if (reader.EOT)
                {
                    return(null);
                }

                if (Strings.InStr(line_buf, ",") > 0)
                {
                    throw reader.InvalidDataException(@"名称の設定が抜けています。", data_name);
                }

                // 名称
                data_name = line_buf;
                if (Strings.InStr(data_name, " ") > 0)
                {
                    throw reader.InvalidDataException(@"名称に半角スペースは使用出来ません。", data_name);
                }

                if (Strings.InStr(data_name, "(") > 0 || Strings.InStr(data_name, ")") > 0)
                {
                    throw reader.InvalidDataException(@"名称に全角括弧は使用出来ません", data_name);
                }

                if (Strings.InStr(data_name, "\"") > 0)
                {
                    throw reader.InvalidDataException("名称に\"は使用出来ません。", data_name);
                }

                if (IsDefined2(data_name))
                {
                    // すでに定義済みのパイロットの場合はデータを置き換え
                    pd = Item(data_name);
                    pd.Clear();
                }
                else
                {
                    pd = Add(data_name);
                }

                // 愛称, 読み仮名, 性別, クラス, 地形適応, 経験値
                line_buf = reader.GetLine();

                // 書式チェックのため、コンマの数を数えておく
                int comma_num = 0;
                var loopTo    = Strings.Len(line_buf);
                for (int i = 1; i <= loopTo; i++)
                {
                    if (Strings.Mid(line_buf, i, 1) == ",")
                    {
                        comma_num = (comma_num + 1);
                    }
                }

                if (comma_num < 3)
                {
                    throw reader.InvalidDataException(@"設定に抜けがあります。", data_name);
                }
                else if (comma_num > 5)
                {
                    throw reader.InvalidDataException(@"余分な「,」があります。", data_name);
                }

                // 愛称
                int ret = Strings.InStr(line_buf, ",");
                buf2 = Strings.Trim(Strings.Left(line_buf, ret - 1));
                buf  = Strings.Mid(line_buf, ret + 1);
                if (Strings.Len(buf2) == 0)
                {
                    throw reader.InvalidDataException(@"愛称の設定が抜けています。", data_name);
                }

                pd.Nickname = buf2;
                switch (comma_num)
                {
                case 4:
                {
                    // 読み仮名 or 性別
                    ret  = Strings.InStr(buf, ",");
                    buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                    buf  = Strings.Mid(buf, ret + 1);
                    switch (buf2 ?? "")
                    {
                    case "男性":
                    case "女性":
                    case "-":
                    {
                        pd.KanaName = GeneralLib.StrToHiragana(pd.Nickname);
                        pd.Sex      = buf2;
                        break;
                    }

                    default:
                    {
                        pd.KanaName = buf2;
                        break;
                    }
                    }

                    break;
                }

                case 5:
                {
                    // 読み仮名
                    ret  = Strings.InStr(buf, ",");
                    buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                    buf  = Strings.Mid(buf, ret + 1);
                    switch (buf2 ?? "")
                    {
                    case "男性":
                    case "女性":
                    case "-":
                    {
                        SRC.AddDataError(reader.InvalidData(@"読み仮名の設定が抜けています。", data_name));
                        pd.KanaName = GeneralLib.StrToHiragana(pd.Nickname);
                        break;
                    }

                    default:
                    {
                        pd.KanaName = buf2;
                        break;
                    }
                    }

                    // 性別
                    ret  = Strings.InStr(buf, ",");
                    buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                    buf  = Strings.Mid(buf, ret + 1);
                    switch (buf2 ?? "")
                    {
                    case "男性":
                    case "女性":
                    case "-":
                    {
                        pd.Sex = buf2;
                        break;
                    }

                    default:
                    {
                        SRC.AddDataError(reader.InvalidData(@"性別の設定が間違っています。", data_name));
                        break;
                    }
                    }

                    break;
                }

                default:
                {
                    pd.KanaName = GeneralLib.StrToHiragana(pd.Nickname);
                    break;
                }
                }

                // クラス
                ret  = Strings.InStr(buf, ",");
                buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                buf  = Strings.Mid(buf, ret + 1);
                if (!Information.IsNumeric(buf2))
                {
                    pd.Class = buf2;
                }
                else
                {
                    SRC.AddDataError(reader.InvalidData(@"クラスの設定が間違っています。", data_name));
                }

                // 地形適応
                ret  = Strings.InStr(buf, ",");
                buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                buf  = Strings.Mid(buf, ret + 1);
                if (Strings.Len(buf2) == 4)
                {
                    pd.Adaption = buf2;
                }
                else
                {
                    SRC.AddDataError(reader.InvalidData(@"地形適応の設定が間違っています。", data_name));
                    pd.Adaption = "AAAA";
                }

                // 経験値
                buf2 = Strings.Trim(buf);
                if (Information.IsNumeric(buf2))
                {
                    pd.ExpValue = GeneralLib.MinLng(Conversions.ToInteger(buf2), 9999);
                }
                else
                {
                    SRC.AddDataError(reader.InvalidData(@"経験値の設定が間違っています。", data_name));
                }

                // 特殊能力データ
                line_buf = reader.GetLine();
                if (line_buf == "特殊能力なし")
                {
                    line_buf = reader.GetLine();
                }
                else if (line_buf == "特殊能力")
                {
                    // 新形式による特殊能力表記
                    line_buf = reader.GetLine();
                    buf      = line_buf;
                    int    i      = 0;
                    string aname  = "";
                    string adata  = "";
                    double alevel = Constants.DEFAULT_LEVEL;
                    while (true)
                    {
                        i = (i + 1);

                        // コンマの位置を検索
                        ret = Strings.InStr(buf, ",");
                        // 「"」が使われているか検索
                        int ret2 = Strings.InStr(buf, "\"");
                        if (ret2 < ret && ret2 > 0)
                        {
                            // 「"」が見つかった場合、次の「"」後のコンマを検索
                            bool in_quote = true;
                            int  j        = (ret2 + 1);
                            while (j <= Strings.Len(buf))
                            {
                                switch (Strings.Mid(buf, j, 1) ?? "")
                                {
                                case "\"":
                                {
                                    in_quote = !in_quote;
                                    break;
                                }

                                case ",":
                                {
                                    if (!in_quote)
                                    {
                                        buf2 = Strings.Left(buf, j - 1);
                                        buf  = Strings.Mid(buf, j + 1);
                                    }

                                    break;
                                }
                                }

                                j = (j + 1);
                            }

                            if (j == Strings.Len(buf))
                            {
                                buf2 = buf;
                                buf  = "";
                            }

                            in_quote = false;
                        }
                        else if (ret > 0)
                        {
                            // コンマが見つかったらコンマまでの文字列を切り出す
                            buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                            buf  = Strings.Trim(Strings.Mid(buf, ret + 1));

                            // コンマの後ろの文字列が空白の場合
                            if (string.IsNullOrEmpty(buf))
                            {
                                if (i % 2 == 1)
                                {
                                    throw reader.InvalidDataException(@"行末の「,」の後に特殊能力指定が抜けています。", data_name);
                                }
                                else
                                {
                                    throw reader.InvalidDataException(@"行末の「,」の後に特殊能力レベル指定が抜けています。", data_name);
                                };
                            }
                        }
                        else
                        {
                            // 行末の文字列
                            buf2 = buf;
                            buf  = "";
                        }

                        if (i % 2 == 1)
                        {
                            // 特殊能力名&レベル

                            if (Information.IsNumeric(buf2))
                            {
                                if (i == 1)
                                {
                                    // 特殊能力の指定は終り。能力値の指定へ
                                    buf = buf2 + ", " + buf;
                                    break;
                                }
                                else
                                {
                                    SRC.AddDataError(reader.InvalidData(@"行頭から" + SrcFormatter.Format((object)((i + 1) / 2)) + "番目の特殊能力名の設定が間違っています。", data_name));
                                }
                            }

                            if (Strings.InStr(buf2, " ") > 0)
                            {
                                if (Strings.Left(buf2, 4) != "先手必勝" && Strings.Left(buf2, 6) != "SP消費減少" && Strings.Left(buf2, 12) != "スペシャルパワー自動発動" && Strings.Left(buf2, 4) != "ハンター" && Strings.InStr(buf2, "=解説 ") == 0)
                                {
                                    if (string.IsNullOrEmpty(aname))
                                    {
                                        throw reader.InvalidDataException(@"行頭から" + SrcFormatter.Format((object)((i + 1) / 2)) + "番目の特殊能力「" + Strings.Trim(Strings.Left(buf2, Strings.InStr(buf2, " "))) + "」の指定の後に「,」が抜けています。", data_name);
                                    }
                                    else
                                    {
                                        throw reader.InvalidDataException(@"特殊能力「" + aname + "」のレベル指定の後に「,」が抜けています。", data_name);
                                    };
                                }
                            }

                            // 特殊能力の別名指定がある?
                            int j = Strings.InStr(buf2, "=");
                            if (j > 0)
                            {
                                adata = Strings.Mid(buf2, j + 1);
                                buf2  = Strings.Left(buf2, j - 1);
                            }
                            else
                            {
                                adata = "";
                            }

                            // 特殊能力のレベル指定を切り出す
                            j = Strings.InStr(buf2, "Lv");
                            switch (j)
                            {
                            case 0:
                            {
                                // 指定なし
                                aname  = buf2;
                                alevel = Constants.DEFAULT_LEVEL;
                                break;
                            }

                            case 1:
                            {
                                // レベル指定のみあり
                                if (!Information.IsNumeric(Strings.Mid(buf2, j + 2)))
                                {
                                    SRC.AddDataError(reader.InvalidData(@"特殊能力「" + aname + "」のレベル指定が不正です。", data_name));
                                }

                                alevel = Conversions.ToDouble(Strings.Mid(buf2, j + 2));
                                if (string.IsNullOrEmpty(aname))
                                {
                                    SRC.AddDataError(reader.InvalidData(@"行頭から" + SrcFormatter.Format((object)((i + 1) / 2)) + "番目の特殊能力名の設定が間違っています。", data_name));
                                }

                                break;
                            }

                            default:
                            {
                                // 特殊能力名とレベルの両方が指定されている
                                aname  = Strings.Left(buf2, j - 1);
                                alevel = Conversions.ToDouble(Strings.Mid(buf2, j + 2));
                                break;
                            }
                            }
                        }
                        // 特殊能力修得レベル
                        else if (Information.IsNumeric(buf2))
                        {
                            pd.AddSkill(aname, alevel, adata, Conversions.ToInteger(buf2));
                        }
                        else
                        {
                            if (alevel > 0d)
                            {
                                SRC.AddDataError(reader.InvalidData(@"特殊能力「" + aname + "Lv" + SrcFormatter.Format((object)alevel) + "」の修得レベルが間違っています。", data_name));
                            }
                            else
                            {
                                SRC.AddDataError(reader.InvalidData(@"特殊能力「" + aname + "」の修得レベルが間違っています。", data_name));
                            }

                            pd.AddSkill(aname, alevel, adata, 1);
                        }

                        if (string.IsNullOrEmpty(buf))
                        {
                            // ここでこの行は終り

                            // iが奇数の場合は修得レベルが抜けている
                            if (i % 2 == 1)
                            {
                                if (alevel > 0d)
                                {
                                    SRC.AddDataError(reader.InvalidData(@"特殊能力「" + aname + "Lv" + SrcFormatter.Format((object)alevel) + "」の修得レベルが間違っています。", data_name));
                                }
                                else
                                {
                                    SRC.AddDataError(reader.InvalidData(@"特殊能力「" + aname + "」の修得レベルが間違っています。", data_name));
                                }
                            }

                            line_buf = reader.GetLine();
                            buf      = line_buf;
                            i        = 0;
                            aname    = "";
                        }
                    }
                }
                else if (Strings.InStr(line_buf, "特殊能力,") == 1)
                {
                    // 旧形式による特殊能力表記
                    buf = Strings.Mid(line_buf, 6);
                    int    i      = 0;
                    string aname  = "";
                    string adata  = "";
                    double alevel = Constants.DEFAULT_LEVEL;
                    do
                    {
                        i = (i + 1);

                        // コンマの位置を検索
                        ret = Strings.InStr(buf, ",");
                        // 「"」が使われているか検索
                        int ret2 = Strings.InStr(buf, "\"");
                        if (ret2 < ret && ret2 > 0)
                        {
                            // 「"」が見つかった場合、次の「"」後のコンマを検索
                            bool in_quote = true;
                            int  j        = (ret2 + 1);
                            while (j <= Strings.Len(buf))
                            {
                                switch (Strings.Mid(buf, j, 1) ?? "")
                                {
                                case "\"":
                                {
                                    in_quote = !in_quote;
                                    break;
                                }

                                case ",":
                                {
                                    if (!in_quote)
                                    {
                                        buf2 = Strings.Left(buf, j - 1);
                                        buf  = Strings.Mid(buf, j + 1);
                                    }

                                    break;
                                }
                                }

                                j = (j + 1);
                            }

                            if (j == Strings.Len(buf))
                            {
                                buf2 = buf;
                                buf  = "";
                            }

                            in_quote = false;
                        }
                        else if (ret > 0)
                        {
                            // コンマが見つかったらコンマまでの文字列を切り出す
                            buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                            buf  = Strings.Mid(buf, ret + 1);

                            // コンマの後ろの文字列が空白の場合
                            if (string.IsNullOrEmpty(buf))
                            {
                                if (i % 2 == 1)
                                {
                                    throw reader.InvalidDataException(@"行末の「,」の後に特殊能力指定が抜けています。", data_name);
                                }
                                else
                                {
                                    throw reader.InvalidDataException(@"行末の「,」の後に特殊能力レベル指定が抜けています。", data_name);
                                };
                            }
                        }
                        else
                        {
                            // 行末の文字列
                            buf2 = buf;
                            buf  = "";
                        }

                        if (i % 2 == 1)
                        {
                            // 特殊能力名&レベル

                            if (Strings.InStr(buf2, " ") > 0)
                            {
                                if (string.IsNullOrEmpty(aname))
                                {
                                    throw reader.InvalidDataException(@"行頭から" + SrcFormatter.Format((object)((i + 1) / 2)) + "番目の特殊能力の指定の後に「,」が抜けています。", data_name);
                                }
                                else
                                {
                                    throw reader.InvalidDataException(@"特殊能力「" + aname + "」のレベル指定の後に「,」が抜けています。", data_name);
                                };
                            }

                            // 特殊能力の別名指定がある?
                            int j = Strings.InStr(buf2, "=");
                            if (j > 0)
                            {
                                adata = Strings.Mid(buf2, j + 1);
                                buf2  = Strings.Left(buf2, j - 1);
                            }
                            else
                            {
                                adata = "";
                            }

                            // 特殊能力のレベル指定を切り出す
                            j = Strings.InStr(buf2, "Lv");
                            switch (j)
                            {
                            case 0:
                            {
                                // 指定なし
                                aname  = buf2;
                                alevel = Constants.DEFAULT_LEVEL;
                                break;
                            }

                            case 1:
                            {
                                // レベル指定のみあり
                                if (!Information.IsNumeric(Strings.Mid(buf2, j + 2)))
                                {
                                    throw reader.InvalidDataException(@"特殊能力「" + aname + "」のレベル指定が不正です", data_name);
                                }

                                alevel = Conversions.ToDouble(Strings.Mid(buf2, j + 2));
                                if (string.IsNullOrEmpty(aname))
                                {
                                    throw reader.InvalidDataException(@"行頭から" + SrcFormatter.Format((object)((i + 1) / 2)) + "番目の特殊能力の名前「" + buf2 + "」が不正です", data_name);
                                }

                                break;
                            }

                            default:
                            {
                                // 特殊能力名とレベルの両方が指定されている
                                aname  = Strings.Left(buf2, j - 1);
                                alevel = Conversions.ToDouble(Strings.Mid(buf2, j + 2));
                                break;
                            }
                            }
                        }
                        // 特殊能力修得レベル
                        else if (Information.IsNumeric(buf2))
                        {
                            pd.AddSkill(aname, alevel, adata, Conversions.ToInteger(buf2));
                        }
                        else
                        {
                            if (alevel > 0d)
                            {
                                SRC.AddDataError(reader.InvalidData(@"特殊能力「" + aname + "Lv" + SrcFormatter.Format((object)alevel) + "」の修得レベルが間違っています。", data_name));
                            }
                            else
                            {
                                SRC.AddDataError(reader.InvalidData(@"特殊能力「" + aname + "」の修得レベルが間違っています。", data_name));
                            }

                            pd.AddSkill(aname, alevel, adata, 1);
                        }
                    }while (ret > 0);

                    // iが奇数の場合は修得レベルが抜けている
                    if (i % 2 == 1)
                    {
                        if (alevel > 0d)
                        {
                            SRC.AddDataError(reader.InvalidData(@"特殊能力「" + aname + "Lv" + SrcFormatter.Format((object)alevel) + "」の修得レベルが間違っています。", data_name));
                        }
                        else
                        {
                            SRC.AddDataError(reader.InvalidData(@"特殊能力「" + aname + "」の修得レベルが間違っています。", data_name));
                        }
                    }

                    line_buf = reader.GetLine();
                }
                else
                {
                    throw reader.InvalidDataException(@"特殊能力の設定が抜けています。", data_name);
                }

                // 格闘
                if (Strings.Len(line_buf) == 0)
                {
                    throw reader.InvalidDataException(@"格闘攻撃力の設定が抜けています。", data_name);
                }

                ret = Strings.InStr(line_buf, ",");
                if (ret == 0)
                {
                    throw reader.InvalidDataException(@"射撃攻撃力の設定が抜けています。", data_name);
                }

                buf2 = Strings.Trim(Strings.Left(line_buf, ret - 1));
                buf  = Strings.Mid(line_buf, ret + 1);
                if (Information.IsNumeric(buf2))
                {
                    pd.Infight = GeneralLib.MinLng(Conversions.ToInteger(buf2), 9999);
                }
                else
                {
                    SRC.AddDataError(reader.InvalidData(@"格闘攻撃力の設定が間違っています。", data_name));
                }

                // 射撃
                ret = Strings.InStr(buf, ",");
                if (ret == 0)
                {
                    throw reader.InvalidDataException(@"命中の設定が抜けています。", data_name);
                }

                buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                buf  = Strings.Mid(buf, ret + 1);
                if (Information.IsNumeric(buf2))
                {
                    pd.Shooting = GeneralLib.MinLng(Conversions.ToInteger(buf2), 9999);
                }
                else
                {
                    SRC.AddDataError(reader.InvalidData(@"射撃攻撃力の設定が間違っています。", data_name));
                }

                // 命中
                ret = Strings.InStr(buf, ",");
                if (ret == 0)
                {
                    throw reader.InvalidDataException(@"回避の設定が抜けています。", data_name);
                }

                buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                buf  = Strings.Mid(buf, ret + 1);
                if (Information.IsNumeric(buf2))
                {
                    pd.Hit = GeneralLib.MinLng(Conversions.ToInteger(buf2), 9999);
                }
                else
                {
                    SRC.AddDataError(reader.InvalidData(@"命中の設定が間違っています。", data_name));
                }

                // 回避
                ret = Strings.InStr(buf, ",");
                if (ret == 0)
                {
                    throw reader.InvalidDataException(@"技量の設定が抜けています。", data_name);
                }

                buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                buf  = Strings.Mid(buf, ret + 1);
                if (Information.IsNumeric(buf2))
                {
                    pd.Dodge = GeneralLib.MinLng(Conversions.ToInteger(buf2), 9999);
                }
                else
                {
                    SRC.AddDataError(reader.InvalidData(@"回避の設定が間違っています。", data_name));
                }

                // 技量
                ret = Strings.InStr(buf, ",");
                if (ret == 0)
                {
                    throw reader.InvalidDataException(@"反応の設定が抜けています。", data_name);
                }

                buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                buf  = Strings.Mid(buf, ret + 1);
                if (Information.IsNumeric(buf2))
                {
                    pd.Technique = GeneralLib.MinLng(Conversions.ToInteger(buf2), 9999);
                }
                else
                {
                    SRC.AddDataError(reader.InvalidData(@"技量の設定が間違っています。", data_name));
                }

                // 反応
                ret = Strings.InStr(buf, ",");
                if (ret == 0)
                {
                    throw reader.InvalidDataException(@"性格の設定が抜けています。", data_name);
                }

                buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                buf  = Strings.Mid(buf, ret + 1);
                if (Information.IsNumeric(buf2))
                {
                    pd.Intuition = GeneralLib.MinLng(Conversions.ToInteger(buf2), 9999);
                }
                else
                {
                    SRC.AddDataError(reader.InvalidData(@"反応の設定が間違っています。", data_name));
                }

                // 性格
                buf2 = Strings.Trim(buf);
                if (Strings.Len(buf2) == 0)
                {
                    throw reader.InvalidDataException(@"性格の設定が抜けています。", data_name);
                }

                if (Strings.InStr(buf2, ",") > 0)
                {
                    SRC.AddDataError(reader.InvalidData(@"行末に余分なコンマが付けられています。", data_name));
                    buf2 = Strings.Trim(Strings.Left(buf2, Strings.InStr(buf2, ",") - 1));
                }

                if (!Information.IsNumeric(buf2))
                {
                    pd.Personality = buf2;
                }
                else
                {
                    SRC.AddDataError(reader.InvalidData(@"性格の設定が間違っています。", data_name));
                }

                // スペシャルパワー
                line_buf = reader.GetLine();
                switch (line_buf ?? "")
                {
                // スペシャルパワーを持っていない
                case "SPなし":
                case "精神なし":
                {
                    break;
                }

                case var @case when @case == "":
                {
                    throw reader.InvalidDataException(@"スペシャルパワーの設定が抜けています。", data_name);
                }

                default:
                {
                    ret = Strings.InStr(line_buf, ",");
                    if (ret == 0)
                    {
                        throw reader.InvalidDataException(@"SP値の設定が抜けています。", data_name);
                    }

                    buf2 = Strings.Trim(Strings.Left(line_buf, ret - 1));
                    buf  = Strings.Mid(line_buf, ret + 1);
                    if (buf2 != "SP" && buf2 != "精神")
                    {
                        throw reader.InvalidDataException(@"スペシャルパワーの設定が抜けています。", data_name);
                    }

                    // SP値
                    ret = Strings.InStr(buf, ",");
                    if (ret > 0)
                    {
                        buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                        buf  = Strings.Mid(buf, ret + 1);
                    }
                    else
                    {
                        buf2 = Strings.Trim(buf);
                        buf  = "";
                    }

                    if (Information.IsNumeric(buf2))
                    {
                        pd.SP = GeneralLib.MinLng(Conversions.ToInteger(buf2), 9999);
                    }
                    else
                    {
                        SRC.AddDataError(reader.InvalidData(@"SPの設定が間違っています。", data_name));
                        pd.SP = 1;
                    }

                    // スペシャルパワーと獲得レベル
                    ret = Strings.InStr(buf, ",");
                    string sname = "";
                    while (ret > 0)
                    {
                        sname = Strings.Trim(Strings.Left(buf, ret - 1));
                        int sp_cost = 0;
                        buf = Strings.Mid(buf, ret + 1);

                        // SP消費量
                        if (Strings.InStr(sname, "=") > 0)
                        {
                            sp_cost = GeneralLib.StrToLng(Strings.Mid(sname, Strings.InStr(sname, "=") + 1));
                            sname   = Strings.Left(sname, Strings.InStr(sname, "=") - 1);
                        }
                        else
                        {
                            sp_cost = 0;
                        }

                        ret = Strings.InStr(buf, ",");
                        if (ret == 0)
                        {
                            buf2 = Strings.Trim(buf);
                            buf  = "";
                        }
                        else
                        {
                            buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                            buf  = Strings.Mid(buf, ret + 1);
                        }

                        if (string.IsNullOrEmpty(sname))
                        {
                            SRC.AddDataError(reader.InvalidData(@"スペシャルパワーの指定が抜けています。", data_name));
                        }
                        // TODO ビューワでSP設定しとく
                        //else if (!SRC.SPDList.IsDefined(sname))
                        //{
                        //    SRC.AddDataError(reader.InvalidData(@sname + "というスペシャルパワーは存在しません。", data_name));
                        //}
                        else if (!Information.IsNumeric(buf2))
                        {
                            SRC.AddDataError(reader.InvalidData(@"スペシャルパワー「" + sname + "」の獲得レベルが間違っています。", data_name));
                            pd.AddSpecialPower(sname, 1, sp_cost);
                        }
                        else
                        {
                            pd.AddSpecialPower(sname, Conversions.ToInteger(buf2), sp_cost);
                        }

                        ret = Strings.InStr(buf, ",");
                    }

                    if (!string.IsNullOrEmpty(buf))
                    {
                        SRC.AddDataError(reader.InvalidData(@"スペシャルパワー「" + Strings.Trim(sname) + "」の獲得レベル指定が抜けています。", data_name));
                    }

                    break;
                }
                }

                // ビットマップ, MIDI
                line_buf = reader.GetLine();

                // ビットマップ
                if (Strings.Len(line_buf) == 0)
                {
                    throw reader.InvalidDataException(@"ビットマップの設定が抜けています。", data_name);
                }

                ret = Strings.InStr(line_buf, ",");
                if (ret == 0)
                {
                    throw reader.InvalidDataException(@"MIDIの設定が抜けています。", data_name);
                }

                buf2 = Strings.Trim(Strings.Left(line_buf, ret - 1));
                buf  = Strings.Mid(line_buf, ret + 1);
                if (Strings.LCase(Strings.Right(buf2, 4)) == ".bmp")
                {
                    pd.Bitmap = buf2;
                }
                else
                {
                    SRC.AddDataError(reader.InvalidData(@"ビットマップの設定が間違っています。", data_name));
                    pd.IsBitmapMissing = true;
                }

                // MIDI
                buf  = Strings.Trim(buf);
                buf2 = buf;
                while (Strings.Right(buf2, 1) == ")")
                {
                    buf2 = Strings.Left(buf2, Strings.Len(buf2) - 1);
                }
                switch (Strings.LCase(Strings.Right(buf2, 4)) ?? "")
                {
                case ".mid":
                case ".mp3":
                case ".wav":
                case "-":
                {
                    pd.BGM = buf;
                    break;
                }

                case var case1 when case1 == "":
                {
                    SRC.AddDataError(reader.InvalidData(@"MIDIの設定が抜けています。", data_name));
                    pd.Bitmap = "-.mid";
                    break;
                }

                default:
                {
                    SRC.AddDataError(reader.InvalidData(@"MIDIの設定が間違っています。", data_name));
                    pd.Bitmap = "-.mid";
                    break;
                }
                }

                if (reader.EOT)
                {
                    return(pd);
                }

                line_buf = reader.GetLine();
                if (line_buf != "===")
                {
                    return(pd);
                }

                // 特殊能力データ
                line_buf = UnitDataList.LoadFeature(data_name, pd, reader, SRC);


                if (line_buf != "===")
                {
                    return(pd);
                }

                // 武器データ
                line_buf = UnitDataList.LoadWepon(data_name, pd, reader, SRC);

                if (line_buf != "===")
                {
                    return(pd);
                }

                // アビリティデータ
                line_buf = UnitDataList.LoadAbility(data_name, pd, reader, SRC);
            }
            finally
            {
                if (pd != null)
                {
                    pd.Raw = reader.RawData;
                    reader.ClearRawData();
                }
            }
            return(pd);
        }
Example #10
0
        private void ParseArgs(string list)
        {
            string[] rawArgs;
            ArgNum = GeneralLib.ListSplit(list, out rawArgs);

            // コマンド名も含める
            foreach (var buf in rawArgs)
            {
                var arg = new CmdArgument()
                {
                    strArg  = buf,
                    argType = Expressions.ValueType.UndefinedType,
                };
                args.Add(arg);

                // 先頭の一文字からパラメータの属性を判定
                switch (Strings.Asc(buf))
                {
                case 0:     // 空文字列
                {
                    arg.argType = Expressions.ValueType.StringType;
                    break;
                }

                case 34:     // "
                {
                    if (Strings.Right(buf, 1) == "\"")
                    {
                        if (Strings.InStr(buf, "$(") == 0)
                        {
                            arg.argType = Expressions.ValueType.StringType;
                            arg.strArg  = Strings.Mid(buf, 2, Strings.Len(buf) - 2);
                        }
                    }
                    else
                    {
                        arg.argType = Expressions.ValueType.StringType;
                    }

                    break;
                }

                case 40:     // (
                {
                    break;
                }

                // 式
                case 45:     // -
                {
                    if (Information.IsNumeric(buf))
                    {
                        arg.lngArg  = GeneralLib.StrToLng(buf);
                        arg.dblArg  = Conversions.ToDouble(buf);
                        arg.argType = Expressions.ValueType.NumericType;
                    }
                    else
                    {
                        arg.argType = Expressions.ValueType.StringType;
                    }

                    break;
                }

                case var @case when 48 <= @case && @case <= 57:     // 0~9
                {
                    if (Information.IsNumeric(buf))
                    {
                        arg.lngArg  = GeneralLib.StrToLng(buf);
                        arg.dblArg  = Conversions.ToDouble(buf);
                        arg.argType = Expressions.ValueType.NumericType;
                    }
                    else
                    {
                        arg.argType = Expressions.ValueType.StringType;
                    }

                    break;
                }

                case 96:     // `
                {
                    if (Strings.Right(buf, 1) == "`")
                    {
                        arg.strArg = Strings.Mid(buf, 2, Strings.Len(buf) - 2);
                    }

                    arg.argType = Expressions.ValueType.StringType;
                    break;
                }
                }
            }
        }
Example #11
0
        public static string LoadWepon(string data_name, IUnitDataElements ud, SrcDataReader reader, SRC SRC)
        {
            int    ret;
            string buf;
            string buf2;
            string line_buf = reader.GetLine();

            // アビリティとの区切り文字かアイテムの解説行で終了
            while (Strings.Len(line_buf) > 0 &&
                   line_buf != "===" &&
                   !line_buf.StartsWith("*"))
            {
                // 武器名
                ret = Strings.InStr(line_buf, ",");
                if (ret == 0)
                {
                    throw reader.InvalidDataException(@"武器データの終りには空行を置いてください。", data_name);
                }

                string wname = Strings.Trim(Strings.Left(line_buf, ret - 1));
                buf = Strings.Mid(line_buf, ret + 1);
                if (string.IsNullOrEmpty(wname))
                {
                    throw reader.InvalidDataException(@"武器名の設定が間違っています。", data_name);
                }

                // 武器を登録
                WeaponData wd = ud.AddWeapon(wname);

                // 攻撃力
                ret = Strings.InStr(buf, ",");
                if (ret == 0)
                {
                    throw reader.InvalidDataException(@wname + "の最小射程が抜けています。", data_name);
                }

                buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                buf  = Strings.Mid(buf, ret + 1);
                if (Information.IsNumeric(buf2))
                {
                    wd.Power = GeneralLib.MinLng(Conversions.ToInteger(buf2), 99999);
                }
                else if (buf == "-")
                {
                    wd.Power = 0;
                }
                else
                {
                    SRC.AddDataError(reader.InvalidData(@wname + "の攻撃力の設定が間違っています。", data_name));
                    if (GeneralLib.LLength(buf2) > 1)
                    {
                        buf      = GeneralLib.LIndex(buf2, 2) + "," + buf;
                        wd.Power = GeneralLib.StrToLng(GeneralLib.LIndex(buf2, 1));
                    }
                }

                // 最小射程
                ret = Strings.InStr(buf, ",");
                if (ret == 0)
                {
                    throw reader.InvalidDataException(@wname + "の最大射程の設定が抜けています。", data_name);
                }

                buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                buf  = Strings.Mid(buf, ret + 1);
                if (Information.IsNumeric(buf2))
                {
                    wd.MinRange = Conversions.ToInteger(buf2);
                }
                else
                {
                    SRC.AddDataError(reader.InvalidData(@wname + "の最小射程の設定が間違っています。", data_name));
                    wd.MinRange = 1;
                    if (GeneralLib.LLength(buf2) > 1)
                    {
                        buf         = GeneralLib.LIndex(buf2, 2) + "," + buf;
                        wd.MinRange = GeneralLib.StrToLng(GeneralLib.LIndex(buf2, 1));
                    }
                }

                // 最大射程
                ret = Strings.InStr(buf, ",");
                if (ret == 0)
                {
                    throw reader.InvalidDataException(@wname + "の命中率の設定が抜けています。", data_name);
                }

                buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                buf  = Strings.Mid(buf, ret + 1);
                if (Information.IsNumeric(buf2))
                {
                    wd.MaxRange = GeneralLib.MinLng(Conversions.ToInteger(buf2), 99);
                }
                else
                {
                    SRC.AddDataError(reader.InvalidData(@wname + "の最大射程の設定が間違っています。", data_name));
                    wd.MaxRange = 1;
                    if (GeneralLib.LLength(buf2) > 1)
                    {
                        buf         = GeneralLib.LIndex(buf2, 2) + "," + buf;
                        wd.MaxRange = GeneralLib.StrToLng(GeneralLib.LIndex(buf2, 1));
                    }
                }

                // 命中率
                ret = Strings.InStr(buf, ",");
                if (ret == 0)
                {
                    throw reader.InvalidDataException(@wname + "の弾数の設定が抜けています。", data_name);
                }

                buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                buf  = Strings.Mid(buf, ret + 1);
                if (Information.IsNumeric(buf2))
                {
                    int n = Conversions.ToInteger(buf2);
                    if (n > 999)
                    {
                        n = 999;
                    }
                    else if (n < -999)
                    {
                        n = -999;
                    }

                    wd.Precision = n;
                }
                else
                {
                    SRC.AddDataError(reader.InvalidData(@wname + "の命中率の設定が間違っています。", data_name));
                    if (GeneralLib.LLength(buf2) > 1)
                    {
                        buf          = GeneralLib.LIndex(buf2, 2) + "," + buf;
                        wd.Precision = GeneralLib.StrToLng(GeneralLib.LIndex(buf2, 1));
                    }
                }

                // 弾数
                ret = Strings.InStr(buf, ",");
                if (ret == 0)
                {
                    throw reader.InvalidDataException(@wname + "の消費ENの設定が抜けています。", data_name);
                }

                buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                buf  = Strings.Mid(buf, ret + 1);
                if (buf2 != "-")
                {
                    if (Information.IsNumeric(buf2))
                    {
                        wd.Bullet = GeneralLib.MinLng(Conversions.ToInteger(buf2), 99);
                    }
                    else
                    {
                        SRC.AddDataError(reader.InvalidData(@wname + "の弾数の設定が間違っています。", data_name));
                        if (GeneralLib.LLength(buf2) > 1)
                        {
                            buf       = GeneralLib.LIndex(buf2, 2) + "," + buf;
                            wd.Bullet = GeneralLib.StrToLng(GeneralLib.LIndex(buf2, 1));
                        }
                    }
                }

                // 消費EN
                ret = Strings.InStr(buf, ",");
                if (ret == 0)
                {
                    throw reader.InvalidDataException(@wname + "の必要気力が抜けています。", data_name);
                }

                buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                buf  = Strings.Mid(buf, ret + 1);
                if (buf2 != "-")
                {
                    if (Information.IsNumeric(buf2))
                    {
                        wd.ENConsumption = GeneralLib.MinLng(Conversions.ToInteger(buf2), 999);
                    }
                    else
                    {
                        SRC.AddDataError(reader.InvalidData(@wname + "の消費ENの設定が間違っています。", data_name));
                        {
                            buf = GeneralLib.LIndex(buf2, 2) + "," + buf;
                            wd.ENConsumption = GeneralLib.StrToLng(GeneralLib.LIndex(buf2, 1));
                        }
                    }
                }

                // 必要気力
                ret = Strings.InStr(buf, ",");
                if (ret == 0)
                {
                    throw reader.InvalidDataException(@wname + "の地形適応が抜けています。", data_name);
                }

                buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                buf  = Strings.Mid(buf, ret + 1);
                if (buf2 != "-")
                {
                    if (Information.IsNumeric(buf2))
                    {
                        int n = Conversions.ToInteger(buf2);
                        if (n > 1000)
                        {
                            n = 1000;
                        }
                        else if (n < 0)
                        {
                            n = 0;
                        }

                        wd.NecessaryMorale = n;
                    }
                    else
                    {
                        SRC.AddDataError(reader.InvalidData(@wname + "の必要気力の設定が間違っています。", data_name));
                        if (GeneralLib.LLength(buf2) > 1)
                        {
                            buf = GeneralLib.LIndex(buf2, 2) + "," + buf;
                            wd.NecessaryMorale = GeneralLib.StrToLng(GeneralLib.LIndex(buf2, 1));
                        }
                    }
                }

                // 地形適応
                ret = Strings.InStr(buf, ",");
                if (ret == 0)
                {
                    throw reader.InvalidDataException(@wname + "のクリティカル率が抜けています。", data_name);
                }

                buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                buf  = Strings.Mid(buf, ret + 1);
                if (Strings.Len(buf2) == 4)
                {
                    wd.Adaption = buf2;
                }
                else
                {
                    SRC.AddDataError(reader.InvalidData(@wname + "の地形適応の設定が間違っています。", data_name));
                    wd.Adaption = "----";
                    if (GeneralLib.LLength(buf2) > 1)
                    {
                        buf         = GeneralLib.LIndex(buf2, 2) + "," + buf;
                        wd.Adaption = GeneralLib.LIndex(buf2, 1);
                    }
                }

                // クリティカル率
                ret = Strings.InStr(buf, ",");
                if (ret == 0)
                {
                    throw reader.InvalidDataException(@wname + "の武器属性が抜けています。", data_name);
                }

                buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                buf  = Strings.Mid(buf, ret + 1);
                if (Information.IsNumeric(buf2))
                {
                    int n = Conversions.ToInteger(buf2);
                    if (n > 999)
                    {
                        n = 999;
                    }
                    else if (n < -999)
                    {
                        n = -999;
                    }

                    wd.Critical = n;
                }
                else
                {
                    SRC.AddDataError(reader.InvalidData(@wname + "のクリティカル率の設定が間違っています。", data_name));
                    if (GeneralLib.LLength(buf2) > 1)
                    {
                        buf         = GeneralLib.LIndex(buf2, 2) + "," + buf;
                        wd.Critical = GeneralLib.StrToLng(GeneralLib.LIndex(buf2, 1));
                    }
                }

                // 武器属性
                buf = Strings.Trim(buf);
                if (Strings.Len(buf) == 0)
                {
                    SRC.AddDataError(reader.InvalidData(@wname + "の武器属性の設定が間違っています。", data_name));
                }

                if (Strings.Right(buf, 1) == ")")
                {
                    // 必要技能
                    ret = Strings.InStr(buf, "> ");
                    if (ret > 0)
                    {
                        if (ret > 0)
                        {
                            wd.NecessarySkill = Strings.Mid(buf, ret + 2);
                            buf = Strings.Trim(Strings.Left(buf, ret + 1));
                            ret = Strings.InStr(wd.NecessarySkill, "(");
                            wd.NecessarySkill = Strings.Mid(wd.NecessarySkill, ret + 1, Strings.Len(wd.NecessarySkill) - ret - 1);
                        }
                    }
                    else
                    {
                        ret = Strings.InStr(buf, "(");
                        if (ret > 0)
                        {
                            wd.NecessarySkill = Strings.Trim(Strings.Mid(buf, ret + 1, Strings.Len(buf) - ret - 1));
                            buf = Strings.Trim(Strings.Left(buf, ret - 1));
                        }
                    }
                }

                if (Strings.Right(buf, 1) == ">")
                {
                    // 必要条件
                    ret = Strings.InStr(buf, "<");
                    if (ret > 0)
                    {
                        wd.NecessaryCondition = Strings.Trim(Strings.Mid(buf, ret + 1, Strings.Len(buf) - ret - 1));
                        buf = Strings.Trim(Strings.Left(buf, ret - 1));
                    }
                }

                wd.Class = buf;
                if (wd.Class == "-")
                {
                    wd.Class = "";
                }

                if (Strings.InStr(wd.Class, "Lv") > 0)
                {
                    SRC.AddDataError(reader.InvalidData(@wname + "の属性のレベル指定が間違っています。", data_name));
                }

                if (reader.EOT)
                {
                    return("");
                }

                line_buf = reader.GetLine();
            }
            return(line_buf);
        }
Example #12
0
        public static string LoadAbility(string data_name, IUnitDataElements ud, SrcDataReader reader, SRC SRC)
        {
            int    ret;
            string buf;
            string buf2;
            string line_buf = reader.GetLine();

            // アイテムの解説行で終了
            while (Strings.Len(line_buf) > 0 &&
                   !line_buf.StartsWith("*"))
            {
                // アビリティ名
                ret = Strings.InStr(line_buf, ",");
                if (ret == 0)
                {
                    throw reader.InvalidDataException(@"アビリティデータの終りに空行を置いてください。", data_name);
                }

                string sname = Strings.Trim(Strings.Left(line_buf, ret - 1));
                buf = Strings.Mid(line_buf, ret + 1);
                if (string.IsNullOrEmpty(sname))
                {
                    throw reader.InvalidDataException(@"アビリティ名の設定が間違っています。", data_name);
                }

                // アビリティを登録
                AbilityData sd = ud.AddAbility(sname);

                // 効果
                ret = Strings.InStr(buf, ",");
                if (ret == 0)
                {
                    throw reader.InvalidDataException(@sname + "の射程の設定が抜けています。", data_name);
                }

                buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                buf  = Strings.Mid(buf, ret + 1);
                sd.SetEffect(buf2);

                // 射程
                sd.MinRange = 0;
                ret         = Strings.InStr(buf, ",");
                if (ret == 0)
                {
                    throw reader.InvalidDataException(@sname + "の回数の設定が抜けています。", data_name);
                }

                buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                buf  = Strings.Mid(buf, ret + 1);
                if (Information.IsNumeric(buf2))
                {
                    sd.MaxRange = GeneralLib.MinLng(Conversions.ToInteger(buf2), 99);
                }
                else if (buf2 == "-")
                {
                    sd.MaxRange = 0;
                }
                else
                {
                    SRC.AddDataError(reader.InvalidData(@sname + "の射程の設定が間違っています。", data_name));
                    if (GeneralLib.LLength(buf2) > 1)
                    {
                        buf         = GeneralLib.LIndex(buf2, 2) + "," + buf;
                        sd.MaxRange = GeneralLib.StrToLng(GeneralLib.LIndex(buf2, 1));
                    }
                }

                // 回数
                ret = Strings.InStr(buf, ",");
                if (ret == 0)
                {
                    throw reader.InvalidDataException(@sname + "の消費ENの設定が抜けています。", data_name);
                }

                buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                buf  = Strings.Mid(buf, ret + 1);
                if (buf2 != "-")
                {
                    if (Information.IsNumeric(buf2))
                    {
                        sd.Stock = GeneralLib.MinLng(Conversions.ToInteger(buf2), 99);
                    }
                    else
                    {
                        SRC.AddDataError(reader.InvalidData(@sname + "の回数の設定が間違っています。", data_name));
                        if (GeneralLib.LLength(buf2) > 1)
                        {
                            buf      = GeneralLib.LIndex(buf2, 2) + "," + buf;
                            sd.Stock = GeneralLib.StrToLng(GeneralLib.LIndex(buf2, 1));
                        }
                    }
                }

                // 消費EN
                ret = Strings.InStr(buf, ",");
                if (ret == 0)
                {
                    throw reader.InvalidDataException(@sname + "の必要気力の設定が抜けています。", data_name);
                }

                buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                buf  = Strings.Mid(buf, ret + 1);
                if (buf2 != "-")
                {
                    if (Information.IsNumeric(buf2))
                    {
                        sd.ENConsumption = GeneralLib.MinLng(Conversions.ToInteger(buf2), 999);
                    }
                    else
                    {
                        SRC.AddDataError(reader.InvalidData(@sname + "の消費ENの設定が間違っています。", data_name));
                        if (GeneralLib.LLength(buf2) > 1)
                        {
                            buf = GeneralLib.LIndex(buf2, 2) + "," + buf;
                            sd.ENConsumption = GeneralLib.StrToLng(GeneralLib.LIndex(buf2, 1));
                        }
                    }
                }

                // 必要気力
                ret = Strings.InStr(buf, ",");
                if (ret == 0)
                {
                    throw reader.InvalidDataException(@sname + "のアビリティ属性の設定が抜けています。", data_name);
                }

                buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                buf  = Strings.Mid(buf, ret + 1);
                if (buf2 != "-")
                {
                    if (Information.IsNumeric(buf2))
                    {
                        int n = Conversions.ToInteger(buf2);
                        if (n > 1000)
                        {
                            n = 1000;
                        }
                        else if (n < 0)
                        {
                            n = 0;
                        }

                        sd.NecessaryMorale = n;
                    }
                    else
                    {
                        SRC.AddDataError(reader.InvalidData(@sname + "の必要気力の設定が間違っています。", data_name));
                        if (GeneralLib.LLength(buf2) > 1)
                        {
                            buf = GeneralLib.LIndex(buf2, 2) + "," + buf;
                            sd.NecessaryMorale = GeneralLib.StrToLng(GeneralLib.LIndex(buf2, 1));
                        }
                    }
                }

                // アビリティ属性
                buf = Strings.Trim(buf);
                if (Strings.Len(buf) == 0)
                {
                    SRC.AddDataError(reader.InvalidData(@sname + "のアビリティ属性の設定が間違っています。", data_name));
                }

                if (Strings.Right(buf, 1) == ")")
                {
                    // 必要技能
                    ret = Strings.InStr(buf, "> ");
                    if (ret > 0)
                    {
                        if (ret > 0)
                        {
                            sd.NecessarySkill = Strings.Mid(buf, ret + 2);
                            buf = Strings.Trim(Strings.Left(buf, ret + 1));
                            ret = Strings.InStr(sd.NecessarySkill, "(");
                            sd.NecessarySkill = Strings.Mid(sd.NecessarySkill, ret + 1, Strings.Len(sd.NecessarySkill) - ret - 1);
                        }
                    }
                    else
                    {
                        ret = Strings.InStr(buf, "(");
                        if (ret > 0)
                        {
                            sd.NecessarySkill = Strings.Trim(Strings.Mid(buf, ret + 1, Strings.Len(buf) - ret - 1));
                            buf = Strings.Trim(Strings.Left(buf, ret - 1));
                        }
                    }
                }

                if (Strings.Right(buf, 1) == ">")
                {
                    // 必要条件
                    ret = Strings.InStr(buf, "<");
                    if (ret > 0)
                    {
                        sd.NecessaryCondition = Strings.Trim(Strings.Mid(buf, ret + 1, Strings.Len(buf) - ret - 1));
                        buf = Strings.Trim(Strings.Left(buf, ret - 1));
                    }
                }

                sd.Class = buf;
                if (sd.Class == "-")
                {
                    sd.Class = "";
                }

                if (Strings.InStr(sd.Class, "Lv") > 0)
                {
                    SRC.AddDataError(reader.InvalidData(@sname + "の属性のレベル指定が間違っています。", data_name));
                }
                line_buf = reader.GetLine();
            }

            return(line_buf);
        }
Example #13
0
        // ラベルの検索
        public int SearchLabel(string lname, int start = -1)
        {
            // ラベルの各要素をあらかじめ解析
            // XXX Indexがずれていて辛い。
            string[] litem;
            int      llen = GeneralLib.ListSplit(lname, out litem);

            // XXX 死にたい
            litem = (new string[] { "" }).Concat(litem).ToArray();

            // ラベルの種類を判定
            LabelType ltype;
            var       lnum         = new string[5];
            var       is_unit      = new bool[5];
            var       is_num       = new bool[5];
            var       is_condition = new bool[5];
            var       revrersible  = false;

            switch (litem[1] ?? "")
            {
            case "プロローグ":
            {
                ltype = LabelType.PrologueEventLabel;
                break;
            }

            case "スタート":
            {
                ltype = LabelType.StartEventLabel;
                break;
            }

            case "エピローグ":
            {
                ltype = LabelType.EpilogueEventLabel;
                break;
            }

            case "ターン":
                ltype = LabelType.TurnEventLabel;
                if (Information.IsNumeric(litem[2]))
                {
                    is_num[2] = true;
                }
                lnum[2] = GeneralLib.StrToLng(litem[2]).ToString();
                break;

            case "損傷率":
                ltype      = LabelType.DamageEventLabel;
                is_unit[2] = true;
                is_num[3]  = true;
                lnum[3]    = GeneralLib.StrToLng(litem[3]).ToString();
                break;

            case "破壊":
            case "マップ攻撃破壊":
                ltype      = LabelType.DestructionEventLabel;
                is_unit[2] = true;
                break;

            case "全滅":
                ltype = LabelType.TotalDestructionEventLabel;
                break;

            case "攻撃":
                ltype       = LabelType.AttackEventLabel;
                revrersible = true;
                is_unit[2]  = true;
                is_unit[3]  = true;
                break;

            case "攻撃後":
                ltype       = LabelType.AfterAttackEventLabel;
                revrersible = true;
                is_unit[2]  = true;
                is_unit[3]  = true;
                break;

            case "会話":
                ltype      = LabelType.TalkEventLabel;
                is_unit[2] = true;
                is_unit[3] = true;
                break;

            case "接触":
                ltype       = LabelType.ContactEventLabel;
                revrersible = true;
                is_unit[2]  = true;
                is_unit[3]  = true;
                break;

            case "進入":
                ltype      = LabelType.EnterEventLabel;
                is_unit[2] = true;
                if (llen == 4)
                {
                    is_num[3] = true;
                    is_num[4] = true;
                    lnum[3]   = GeneralLib.StrToLng(litem[3]).ToString();
                    lnum[4]   = GeneralLib.StrToLng(litem[4]).ToString();
                }
                break;

            case "脱出":
                ltype      = LabelType.EscapeEventLabel;
                is_unit[2] = true;
                break;

            case "収納":
                ltype      = LabelType.LandEventLabel;
                is_unit[2] = true;
                break;

            case "使用":
                ltype      = LabelType.UseEventLabel;
                is_unit[2] = true;
                break;

            case "使用後":
                ltype      = LabelType.AfterUseEventLabel;
                is_unit[2] = true;
                break;

            case "変形":
                ltype      = LabelType.TransformEventLabel;
                is_unit[2] = true;
                break;

            case "合体":
                ltype      = LabelType.CombineEventLabel;
                is_unit[2] = true;
                break;

            case "分離":
                ltype      = LabelType.SplitEventLabel;
                is_unit[2] = true;
                break;

            case "行動終了":
                ltype      = LabelType.FinishEventLabel;
                is_unit[2] = true;
                break;

            case "レベルアップ":
                ltype      = LabelType.LevelUpEventLabel;
                is_unit[2] = true;
                break;

            case "勝利条件":
                ltype = LabelType.RequirementEventLabel;
                break;

            case "再開":
                ltype = LabelType.ResumeEventLabel;
                break;

            case "マップコマンド":
                ltype           = LabelType.MapCommandEventLabel;
                is_condition[3] = true;
                break;

            case "ユニットコマンド":
                ltype           = LabelType.UnitCommandEventLabel;
                is_condition[4] = true;
                break;

            case "特殊効果":
                ltype = LabelType.EffectEventLabel;
                break;

            default:
                ltype = LabelType.NormalLabel;
                break;
            }

            // 各ラベルについて一致しているかチェック
            foreach (LabelData lab in colEventLabelList.List)
            {
                // ラベルの種類が一致している?
                if (ltype != lab.Name)
                {
                    continue;
                }

                // ClearEventされていない?
                if (!lab.Enable)
                {
                    continue;
                }

                // 検索開始行より後ろ?
                if (lab.EventDataId < start)
                {
                    continue;
                }

                // パラメータ数が一致している?
                if (llen != lab.CountPara())
                {
                    if (ltype != LabelType.MapCommandEventLabel && ltype != LabelType.UnitCommandEventLabel)
                    {
                        continue;
                    }
                }

                // 各パラメータが一致している?
                var reversed = false;
                var isMatch  = IsMatch(ltype, lab, litem, lnum, is_unit, is_num, is_condition, reversed);
                if (!isMatch && revrersible)
                {
                    // 対象と相手を入れ替えたイベントラベルが存在するか判定
                    var lname2 = litem[1] + " " + GeneralLib.ListIndex(lab.Data, 3) + " " + GeneralLib.ListIndex(lab.Data, 2);
                    if (lab.AsterNum > 0)
                    {
                        lname2 = "*" + lname2;
                    }

                    if (FindLabel(lname2) == 0)
                    {
                        // 対象と相手を入れ替えて判定し直す
                        reversed = true;
                        isMatch  = IsMatch(ltype, lab, litem, lnum, is_unit, is_num, is_condition, reversed);
                    }
                }
                if (!isMatch)
                {
                    continue;
                }

                // ここまでたどり付けばラベルは一致している
                SRC.LogDebug("Found", lab.Name.ToString(), lab.Data);

                // 対象と相手を入れ替えて一致した場合はグローバル変数も入れ替え
                if (reversed)
                {
                    var tmp_u = SelectedUnitForEvent;
                    SelectedUnitForEvent   = SelectedTargetForEvent;
                    SelectedTargetForEvent = tmp_u;
                }

                return(lab.EventDataId);
            }

            return(-1);
        }