Beispiel #1
0
        // 同調率
        public int SynchroRate()
        {
            int SynchroRateRet = default;
            int lv;

            if (!IsSkillAvailable("同調率"))
            {
                return(SynchroRateRet);
            }

            // 同調率基本値
            SynchroRateRet = (int)SkillLevel("同調率", ref_mode: "");

            // レベルによる増加分
            lv = GeneralLib.MinLng(Level, 100);
            if (IsSkillAvailable("同調率成長"))
            {
                SynchroRateRet = (int)(SynchroRateRet + lv * (10d + SkillLevel("同調率成長", ref_mode: "")) / 10L);
            }
            else
            {
                SynchroRateRet = SynchroRateRet + lv;
            }

            return(SynchroRateRet);
        }
Beispiel #2
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);
        }
Beispiel #3
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);
        }
Beispiel #4
0
        // 「先頭から選択」ボタンをクリック
        private void cmdSelectAll_Click(object eventSender, EventArgs eventArgs)
        {
            short i;

            lstItems.Visible = false;
            var loopTo = (short)lstItems.Items.Count;

            for (i = 1; i <= loopTo; i++)
            {
                ItemFlag[i - 1] = false;
                Microsoft.VisualBasic.Compatibility.VB6.Support.SetItemString(lstItems, i - 1, " " + Strings.Mid(Microsoft.VisualBasic.Compatibility.VB6.Support.GetItemString(lstItems, i - 1), 2));
            }

            var loopTo1 = (short)GeneralLib.MinLng(GUI.MaxListItem, lstItems.Items.Count);

            for (i = 1; i <= loopTo1; i++)
            {
                if (!ItemFlag[i - 1])
                {
                    ItemFlag[i - 1] = true;
                    Microsoft.VisualBasic.Compatibility.VB6.Support.SetItemString(lstItems, i - 1, "○" + Strings.Mid(Microsoft.VisualBasic.Compatibility.VB6.Support.GetItemString(lstItems, i - 1), 2));
                }
            }

            lstItems.TopIndex = 0;
            lstItems.Visible  = true;
            SelectedItemNum   = 0;
            var loopTo2 = (short)(lstItems.Items.Count - 1);

            for (i = 0; i <= loopTo2; i++)
            {
                if (ItemFlag[i])
                {
                    SelectedItemNum = (short)(SelectedItemNum + 1);
                }
            }

            lblNumber.Text = Microsoft.VisualBasic.Compatibility.VB6.Support.Format(SelectedItemNum) + "/" + Microsoft.VisualBasic.Compatibility.VB6.Support.Format(GUI.MaxListItem);
            if (SelectedItemNum > 0 & SelectedItemNum <= GUI.MaxListItem)
            {
                if (!cmdFinish.Enabled)
                {
                    cmdFinish.Enabled = true;
                }
            }
            else if (cmdFinish.Enabled)
            {
                cmdFinish.Enabled = false;
            }
        }
Beispiel #5
0
        public void Init(SRC src, ListBoxArgs args)
        {
            SRC  = src;
            Text = args.lb_caption;

            _lstItems.DataSource    = args.Items;
            _lstItems.DisplayMember = "TextWithFlag";

            // 先頭に表示するアイテムを設定
            if (SRC.GUI.TopItem > 0)
            {
                if (_lstItems.TopIndex != SRC.GUI.TopItem - 1)
                {
                    _lstItems.TopIndex = GeneralLib.MinLng(SRC.GUI.TopItem, _lstItems.Items.Count) - 1;
                }
            }
        }
Beispiel #6
0
        public void ShowItems(frmMain MainForm, ListBoxArgs args)
        {
            ListBoxItems = args.Items;
            HasFlag      = args.HasFlag;
            var list       = args.Items;
            var lb_caption = args.lb_caption;
            var lb_info    = args.lb_info;
            var lb_mode    = args.lb_mode;

            // コメントウィンドウの処理
            if (Strings.InStr(lb_mode, "コメント") > 0)
            {
                if (!txtComment.Enabled)
                {
                    txtComment.Enabled = true;
                    txtComment.Visible = true;
                    txtComment.Width   = labCaption.Width;
                    txtComment.Text    = "";
                    txtComment.Top     = lstItems.Top + lstItems.Height + 5;
                    Height             = Height + 40;
                }
            }
            else if (txtComment.Enabled)
            {
                txtComment.Enabled = false;
                txtComment.Visible = false;
                Height             = Height - 40;
            }

            // キャプション
            Text = lb_caption;
            if (HasFlag)
            {
                labCaption.Text = "  " + lb_info;
            }
            else
            {
                labCaption.Text = lb_info;
            }

            // リストボックスにアイテムを追加
            lstItems.Visible = false;
            lstItems.Items.Clear();
            if (HasFlag)
            {
                var itemTexts = list.Select(x => x.ListItemFlag ? $"×{x.Text}" : $"  {x.Text}");
                foreach (var text in itemTexts)
                {
                    lstItems.Items.Add(text);
                }

                // XXX 後でクリアしてるから意味ないのでは?
                //i = (short)Information.UBound(list);
                //while (i > 0)
                //{
                //    if (!ListItemFlag[i])
                //    {
                //        lstItems.SelectedIndex = i - 1;
                //        break;
                //    }

                //    i = (short)(i - 1);
                //}
            }
            else
            {
                foreach (var text in list.Select(x => x.Text))
                {
                    lstItems.Items.Add(text);
                }
            }

            lstItems.SelectedIndex = -1;
            lstItems.Visible       = true;

            //// コメント付きのアイテム?
            //if (Information.UBound(ListItemComment) != Information.UBound(list))
            //{
            //    Array.Resize(ListItemComment, Information.UBound(list) + 1);
            //}

            // 先頭のアイテムを設定
            if (GUI.TopItem > 0)
            {
                if (lstItems.TopIndex != GUI.TopItem - 1)
                {
                    lstItems.TopIndex = GeneralLib.MaxLng(GeneralLib.MinLng(GUI.TopItem - 1, lstItems.Items.Count - 1), 0);
                }
                lstItems.SelectedIndex = Math.Min(lstItems.Items.Count, GUI.TopItem) - 1;
            }
            else if (lstItems.Items.Count > 0)
            {
                lstItems.SelectedIndex = 0;
            }

            // コメントウィンドウの表示
            if (txtComment.Enabled)
            {
                txtComment.Text = SelectedItem?.ListItemComment;
            }

            // 最小化されている場合は戻しておく
            if (WindowState != FormWindowState.Normal)
            {
                WindowState = FormWindowState.Normal;
                Show();
            }

            // 表示位置を設定
            // メインが表示されているのに画面中央に持っていかれると違和感があるので、
            // メインが表示されているときはそちらを基準にする
            if (MainForm.Visible)
            {
                if (HorizontalSize == "S")
                {
                    Left = MainForm.Left;
                }
                else
                {
                    Left = Math.Max(
                        MainForm.Left,
                        MainForm.Left + (MainForm.Width - Width) / 2);
                }
            }
            else
            {
                Left = (Screen.PrimaryScreen.Bounds.Width - Width) / 2;
            }

            if (MainForm.Visible)
            {
                if (MainForm.WindowState != FormWindowState.Minimized &&
                    VerticalSize == "M" &&
                    Strings.InStr(lb_mode, "中央表示") == 0)
                {
                    Top = MainForm.Top + MainForm.Height - Height;
                }
                else
                {
                    Top = Math.Max(
                        MainForm.Top,
                        MainForm.Top + (MainForm.Height - Height) / 2);
                }
            }
            else
            {
                Top = (Screen.PrimaryScreen.Bounds.Height - Height) / 2;
            }

            // XXX この辺からは親にいたほうがしっくりくる
            Commands.SelectedItem = 0;
            GUI.IsFormClicked     = false;
            Application.DoEvents();

            // リストボックスを表示
            if (Strings.InStr(lb_mode, "表示のみ") > 0)
            {
                // 表示のみを行う
                GUI.IsMordal = false;
                Show();
                lstItems.Focus();
                //SetWindowPos(Handle.ToInt32(), -1, 0, 0, 0, 0, 0x3);
                Refresh();
                //return ListBoxRet;
            }
            else if (Strings.InStr(lb_mode, "連続表示") > 0)
            {
                // 選択が行われてもリストボックスを閉じない
                GUI.IsMordal = false;
                if (!Visible)
                {
                    Show();
                    //SetWindowPos(Handle.ToInt32(), -1, 0, 0, 0, 0, 0x3);
                    lstItems.Focus();
                }

                if (Strings.InStr(lb_mode, "カーソル移動") > 0)
                {
                    if (SRC.AutoMoveCursor)
                    {
                        GUI.MoveCursorPos("ダイアログ");
                    }
                }

                while (!GUI.IsFormClicked)
                {
                    Application.DoEvents();
                    //// 右ボタンでのダブルクリックの実現
                    //if ((GetAsyncKeyState(RButtonID) && 0x8000) == 0)
                    //{
                    //    is_rbutton_released = true;
                    //}
                    //else if (is_rbutton_released)
                    //{
                    //    IsFormClicked = true;
                    //}

                    Thread.Sleep(50);
                }
            }
            else
            {
                // 選択が行われた時点でリストボックスを閉じる
                GUI.IsMordal = false;
                Show();
                //SetWindowPos(Handle.ToInt32(), -1, 0, 0, 0, 0, 0x3);
                lstItems.Focus();
                if (Strings.InStr(lb_mode, "カーソル移動") > 0)
                {
                    if (SRC.AutoMoveCursor)
                    {
                        GUI.MoveCursorPos("ダイアログ");
                    }
                }

                while (!GUI.IsFormClicked)
                {
                    Application.DoEvents();
                    //// 右ボタンでのダブルクリックの実現
                    //if ((GetAsyncKeyState(RButtonID) && 0x8000) == 0)
                    //{
                    //    is_rbutton_released = true;
                    //}
                    //else if (is_rbutton_released)
                    //{
                    //    IsFormClicked = true;
                    //}

                    Thread.Sleep(50);
                }

                Hide();
                if (Strings.InStr(lb_mode, "カーソル移動") > 0 &&
                    Strings.InStr(lb_mode, "カーソル移動(行きのみ)") == 0)
                {
                    if (SRC.AutoMoveCursor)
                    {
                        GUI.RestoreCursorPos();
                    }
                }

                if (txtComment.Enabled)
                {
                    txtComment.Enabled = false;
                    txtComment.Visible = false;
                    Height             = Height - 40;
                }
            }
        }
Beispiel #7
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);
        }
Beispiel #8
0
        protected override int ExecInternal()
        {
            Pilot p = null;
            int   num;

            switch (ArgNum)
            {
            case 3:
            {
                p   = GetArgAsPilot(2);
                num = GetArgAsLong(3);
                break;
            }

            case 2:
            {
                var u = Event.SelectedUnitForEvent;
                if (u.CountPilot() > 0)
                {
                    p = u.Pilots.First();
                }

                num = GetArgAsLong(2);
                break;
            }

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

            if (p != null)
            {
                var hp_ratio = 0d;
                var en_ratio = 0d;
                if (p.Unit is object)
                {
                    {
                        var u = p.Unit;
                        hp_ratio = 100 * u.HP / (double)u.MaxHP;
                        en_ratio = 100 * u.EN / (double)u.MaxEN;
                    }
                }

                if (Expression.IsOptionDefined("レベル限界突破"))
                {
                    p.Level = GeneralLib.MinLng(GeneralLib.MaxLng(p.Level + num, 1), 999);
                }
                else
                {
                    p.Level = GeneralLib.MinLng(GeneralLib.MaxLng(p.Level + num, 1), 99);
                }

                // 闘争本能入手?
                if (p.IsSkillAvailable("闘争本能"))
                {
                    if (p.MinMorale > 100)
                    {
                        if (p.Morale == p.MinMorale)
                        {
                            p.Morale = ((int)(p.MinMorale + 5d * p.SkillLevel("闘争本能", ref_mode: "")));
                        }
                    }
                    else if (p.Morale == 100)
                    {
                        p.Morale = ((int)(100d + 5d * p.SkillLevel("闘争本能", ref_mode: "")));
                    }
                }

                // SP&霊力をアップデート
                p.SP    = p.SP;
                p.Plana = p.Plana;
                if (p.Unit is object)
                {
                    {
                        var u = p.Unit;
                        u.Update();
                        u.HP = (int)(u.MaxHP * hp_ratio / 100d);
                        u.EN = (int)(u.MaxEN * en_ratio / 100d);
                    }

                    SRC.PList.UpdateSupportMod(p.Unit);
                }
            }

            return(EventData.NextID);
        }
Beispiel #9
0
        // 「アビリティ」コマンドを開始
        // is_item=True の場合は「アイテム」コマンドによる使い捨てアイテムのアビリティ
        private void StartAbilityCommand(bool is_item = false)
        {
            string cap;

            GUI.LockGUI();

            // 使用するアビリティを選択
            if (is_item)
            {
                cap = "アイテム選択";
            }
            else
            {
                cap = Expression.Term("アビリティ", SelectedUnit) + "選択";
            }

            UnitAbility unitAbility;

            if (CommandState == "コマンド選択")
            {
                unitAbility = GUI.AbilityListBox(SelectedUnit, new UnitAbilityList(AbilityListMode.BeforeMove, SelectedUnit), cap, "移動前", is_item);
            }
            else
            {
                unitAbility = GUI.AbilityListBox(SelectedUnit, new UnitAbilityList(AbilityListMode.AfterMove, SelectedUnit), cap, "移動後", is_item);
            }

            // キャンセル
            if (unitAbility == null)
            {
                SelectedAbility = 0;
                if (SRC.AutoMoveCursor)
                {
                    GUI.RestoreCursorPos();
                }

                CancelCommand();
                GUI.UnlockGUI();
                return;
            }
            SelectedAbility = unitAbility.AbilityNo();

            var currentUnit = SelectedUnit;

            // アビリティ専用BGMがあればそれを演奏
            if (currentUnit.IsFeatureAvailable("アビリティBGM"))
            {
                var BGM = currentUnit.Features.Where(x => x.Name == "アビリティBGM")
                          .Where(x => GeneralLib.LIndex(x.Data, 1) == unitAbility.Data.Name)
                          .Select(x => Sound.SearchMidiFile(Strings.Mid(x.Data, Strings.InStr(x.Data, " ") + 1)))
                          .FirstOrDefault();
                if (!string.IsNullOrEmpty(BGM))
                {
                    Sound.ChangeBGM(BGM);
                }
            }

            // 射程0のアビリティはその場で実行
            if (unitAbility.Data.MaxRange == 0)
            {
                SelectedTarget = SelectedUnit;

                // 変身アビリティであるか判定
                var is_transformation = unitAbility.Data.Effects.Any(x => x.EffectType == "変身");

                SelectedAbilityName = unitAbility.Data.Name;

                // 使用イベント
                Event.HandleEvent("使用", SelectedUnit.MainPilot().ID, SelectedAbilityName);
                if (SRC.IsScenarioFinished)
                {
                    SRC.IsScenarioFinished = false;
                    GUI.UnlockGUI();
                    return;
                }

                if (SRC.IsCanceled)
                {
                    SRC.IsCanceled = false;
                    WaitCommand();
                    return;
                }

                // アビリティを実行
                SelectedUnit.ExecuteAbility(unitAbility, SelectedUnit);
                SelectedUnit = SelectedUnit.CurrentForm();
                GUI.CloseMessageForm();

                // 破壊イベント
                {
                    var withBlock1 = SelectedUnit;
                    if (withBlock1.Status == "破壊")
                    {
                        if (withBlock1.CountPilot() > 0)
                        {
                            Event.HandleEvent("破壊", withBlock1.MainPilot().ID);
                            if (SRC.IsScenarioFinished)
                            {
                                SRC.IsScenarioFinished = false;
                                GUI.UnlockGUI();
                                return;
                            }

                            if (SRC.IsCanceled)
                            {
                                SRC.IsCanceled = false;
                                GUI.UnlockGUI();
                                return;
                            }
                        }

                        WaitCommand();
                        return;
                    }
                }

                // 使用後イベント
                {
                    var withBlock2 = SelectedUnit;
                    if (withBlock2.CountPilot() > 0)
                    {
                        Event.HandleEvent("使用後", withBlock2.MainPilot().ID, SelectedAbilityName);
                        if (SRC.IsScenarioFinished)
                        {
                            SRC.IsScenarioFinished = false;
                            GUI.UnlockGUI();
                            return;
                        }

                        if (SRC.IsCanceled)
                        {
                            SRC.IsCanceled = false;
                            GUI.UnlockGUI();
                            return;
                        }
                    }
                }

                // 変身アビリティの場合は行動終了しない
                if (!is_transformation || CommandState == "移動後コマンド選択")
                {
                    WaitCommand();
                }
                else
                {
                    if (SelectedUnit.Status == "出撃")
                    {
                        // カーソル自動移動
                        if (SRC.AutoMoveCursor)
                        {
                            GUI.MoveCursorPos("ユニット選択", SelectedUnit);
                        }

                        Status.DisplayUnitStatus(SelectedUnit);
                    }
                    else
                    {
                        Status.ClearUnitStatus();
                    }

                    CommandState = "ユニット選択";
                    GUI.UnlockGUI();
                }

                return;
            }

            // アビリティの射程を求めておく
            var min_range = unitAbility.AbilityMinRange();
            var max_range = unitAbility.AbilityMaxRange();

            {
                // マップ型アビリティかどうかで今後のコマンド処理の進行の仕方が異なる
                if (is_item)
                {
                    if (unitAbility.IsAbilityClassifiedAs("M"))
                    {
                        SelectedCommand = "マップアイテム";
                    }
                    else
                    {
                        SelectedCommand = "アイテム";
                    }
                }
                else
                {
                    if (unitAbility.IsAbilityClassifiedAs("M"))
                    {
                        SelectedCommand = "マップアビリティ";
                    }
                    else
                    {
                        SelectedCommand = "アビリティ";
                    }
                }


                // アビリティの効果範囲を設定
                if (unitAbility.IsAbilityClassifiedAs("M直"))
                {
                    Map.AreaInCross(currentUnit.x, currentUnit.y, min_range, max_range);
                }
                else if (unitAbility.IsAbilityClassifiedAs("M拡"))
                {
                    Map.AreaInWideCross(currentUnit.x, currentUnit.y, min_range, max_range);
                }
                else if (unitAbility.IsAbilityClassifiedAs("M扇"))
                {
                    Map.AreaInSectorCross(currentUnit.x, currentUnit.y, min_range, max_range, (int)unitAbility.AbilityLevel("M扇"));
                }
                else if (unitAbility.IsAbilityClassifiedAs("M移"))
                {
                    Map.AreaInMoveAction(SelectedUnit, max_range);
                }
                else
                {
                    Map.AreaInRange(currentUnit.x, currentUnit.y, max_range, min_range, "すべて");
                }

                // 射程1の合体技はパートナーで相手を取り囲んでいないと使用できない
                if (unitAbility.IsAbilityClassifiedAs("合") && !unitAbility.IsAbilityClassifiedAs("M") && unitAbility.Data.MaxRange == 1)
                {
                    foreach (var t in Map.AdjacentUnit(currentUnit))
                    {
                        if (currentUnit.IsAlly(t))
                        {
                            var partners = unitAbility.CombinationPartner(t.x, t.y);
                            if (partners.Count == 0)
                            {
                                Map.MaskData[t.x, t.y] = true;
                            }
                        }
                    }
                }
            }

            // ユニットがいるマスの処理
            if (!unitAbility.IsAbilityClassifiedAs("M投") &&
                !unitAbility.IsAbilityClassifiedAs("M線") &&
                !unitAbility.IsAbilityClassifiedAs("M移"))
            {
                var loopTo2 = GeneralLib.MinLng(currentUnit.x + max_range, Map.MapWidth);
                for (var i = GeneralLib.MaxLng(currentUnit.x - max_range, 1); i <= loopTo2; i++)
                {
                    var loopTo3 = GeneralLib.MinLng(currentUnit.y + max_range, Map.MapHeight);
                    for (var j = GeneralLib.MaxLng(currentUnit.y - max_range, 1); j <= loopTo3; j++)
                    {
                        if (!Map.MaskData[i, j])
                        {
                            var t = Map.MapDataForUnit[i, j];
                            if (t is object)
                            {
                                // 有効?
                                if (unitAbility.IsAbilityEffective(t))
                                {
                                    Map.MaskData[i, j] = false;
                                }
                                else
                                {
                                    Map.MaskData[i, j] = true;
                                }
                            }
                        }
                    }
                }
            }

            // 支援専用アビリティは自分には使用できない
            if (!Map.MaskData[currentUnit.x, currentUnit.y])
            {
                if (unitAbility.IsAbilityClassifiedAs("援"))
                {
                    Map.MaskData[currentUnit.x, currentUnit.y] = true;
                }
            }

            if (!Expression.IsOptionDefined("大型マップ"))
            {
                GUI.Center(currentUnit.x, currentUnit.y);
            }

            GUI.MaskScreen();

            if (CommandState == "コマンド選択")
            {
                CommandState = "ターゲット選択";
            }
            else
            {
                CommandState = "移動後ターゲット選択";
            }

            // カーソル自動移動を行う?
            if (!SRC.AutoMoveCursor)
            {
                GUI.UnlockGUI();
                return;
            }

            // 自分から最も近い味方ユニットを探す
            {
                Unit t = null;
                foreach (Unit u in SRC.UList.Items)
                {
                    if (u.Status == "出撃" && u.Party == "味方")
                    {
                        if (Map.MaskData[u.x, u.y] == false && !ReferenceEquals(u, SelectedUnit))
                        {
                            if (t is null)
                            {
                                t = u;
                            }
                            else if (Math.Pow(Math.Abs((SelectedUnit.x - u.x)), 2d) + Math.Pow(Math.Abs((SelectedUnit.y - u.y)), 2d) < Math.Pow(Math.Abs((SelectedUnit.x - t.x)), 2d) + Math.Pow(Math.Abs((SelectedUnit.y - t.y)), 2d))
                            {
                                t = u;
                            }
                        }
                    }
                }

                // 適当がユニットがなければ自分自身を選択
                if (t is null)
                {
                    t = SelectedUnit;
                }

                // カーソルを移動
                GUI.MoveCursorPos("ユニット選択", t);

                // ターゲットのステータスを表示
                if (!ReferenceEquals(SelectedUnit, t))
                {
                    Status.DisplayUnitStatus(t);
                }
            }
            GUI.UnlockGUI();
        }
Beispiel #10
0
 // 資金の量を変更する
 public void IncrMoney(int earnings)
 {
     Money = GeneralLib.MinLng(Money + earnings, 999999999);
     Money = GeneralLib.MaxLng(Money, 0);
 }
Beispiel #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);
        }
Beispiel #12
0
        // reader から1つユニットを読み込む。
        // 返却したUnitDataはリストに追加されている状態。
        private UnitData LoadUnit(SrcDataReader reader, UnitData lastUd)
        {
            UnitData ud = null;

            try
            {
                int    ret;
                string buf, buf2;
                var    line_buf = "";

                // 空行をスキップ
                while (reader.HasMore && string.IsNullOrEmpty(line_buf))
                {
                    line_buf = reader.GetLine();
                }
                if (lastUd != null)
                {
                    lastUd.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);
                }

                // 名称
                string data_name;
                ret = Strings.InStr(line_buf, ",");
                if (ret > 0)
                {
                    data_name = Strings.Trim(Strings.Left(line_buf, ret - 1));
                    buf       = Strings.Mid(line_buf, ret + 1);
                }
                else
                {
                    data_name = line_buf;
                    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 (IsDefined(data_name))
                {
                    ud = Item(data_name);
                    ud.Clear();
                }
                else
                {
                    ud = Add(data_name);
                }
                // 読み仮名
                ret = Strings.InStr(buf, ",");
                if (ret > 0)
                {
                    throw reader.InvalidDataException(@"読み仮名の後に余分なデータが指定されています。", data_name);
                }
                ud.KanaName = buf;

                // 愛称, 読み仮名, ユニットクラス, パイロット数, アイテム数
                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 > 4)
                {
                    throw reader.InvalidDataException(@"余分な「,」があります。", data_name);
                }

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

                ret         = Strings.InStr(line_buf, ",");
                buf2        = Strings.Trim(Strings.Left(line_buf, ret - 1));
                buf         = Strings.Mid(line_buf, ret + 1);
                ud.Nickname = buf2;

                // 読み仮名
                if (comma_num == 4)
                {
                    ret         = Strings.InStr(buf, ",");
                    buf2        = Strings.Trim(Strings.Left(buf, ret - 1));
                    buf         = Strings.Mid(buf, ret + 1);
                    ud.KanaName = buf2;
                }
                else
                {
                    ud.KanaName = GeneralLib.StrToHiragana(ud.Nickname);
                }

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

                // パイロット数
                ret  = Strings.InStr(buf, ",");
                buf2 = Strings.Trim(Strings.Left(buf, ret - 1));
                buf  = Strings.Mid(buf, ret + 1);
                if (Strings.Left(buf2, 1) != "(")
                {
                    if (Information.IsNumeric(buf2))
                    {
                        ud.PilotNum = GeneralLib.MinLng(Conversions.ToInteger(buf2), 99);
                    }
                    else
                    {
                        SRC.AddDataError(reader.InvalidData(@"パイロット数の設定が間違っています。", data_name));
                        ud.PilotNum = 1;
                    }
                    if (ud.PilotNum < 1)
                    {
                        SRC.AddDataError(reader.InvalidData(@"パイロット数の設定が間違っています。", data_name));
                        ud.PilotNum = 1;
                    }
                }
                else
                {
                    if (Strings.Right(buf2, 1) != ")")
                    {
                        throw reader.InvalidDataException(@"パイロット数の設定が間違っています。", data_name);
                    }

                    buf2 = Strings.Mid(buf2, 2, Strings.Len(buf2) - 2);
                    if (Information.IsNumeric(buf2))
                    {
                        ud.PilotNum = GeneralLib.MinLng(Conversions.ToInteger(buf2), 99);
                    }
                    else
                    {
                        SRC.AddDataError(reader.InvalidData(@"パイロット数の設定が間違っています。", data_name));
                        ud.PilotNum = 1;
                    }

                    if (ud.PilotNum < 1)
                    {
                        SRC.AddDataError(reader.InvalidData(@"パイロット数の設定が間違っています。", data_name));
                        ud.PilotNum = 1;
                    }

                    // XXX 何で負数にしてるの?
                    ud.PilotNum = -ud.PilotNum;
                }

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

                if (Information.IsNumeric(buf))
                {
                    ud.ItemNum = GeneralLib.MinLng(Conversions.ToInteger(buf), 99);
                }
                else
                {
                    SRC.AddDataError(reader.InvalidData(@"アイテム数の設定が間違っています。", data_name));
                    ud.ItemNum = 4;
                }

                // 移動可能地形, 移動力, サイズ, 修理費, 経験値
                line_buf = reader.GetLine();

                // 移動可能地形
                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))
                {
                    ud.Transportation = buf2;
                }
                else
                {
                    SRC.AddDataError(reader.InvalidData(@"移動可能地形の設定が間違っています。", data_name));
                    ud.Transportation = "陸";
                }

                // 移動力
                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))
                {
                    ud.Speed = GeneralLib.MinLng(Conversions.ToInteger(buf2), 99);
                }
                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);
                switch (buf2 ?? "")
                {
                case "XL":
                case "LL":
                case "L":
                case "M":
                case "S":
                case "SS":
                {
                    ud.Size = buf2;
                    break;
                }

                default:
                {
                    SRC.AddDataError(reader.InvalidData(@"サイズの設定が間違っています。", data_name));
                    ud.Size = "M";
                    break;
                }
                }

                // 修理費
                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))
                {
                    ud.Value = GeneralLib.MinLng(Conversions.ToInteger(buf2), 9999999);
                }
                else
                {
                    SRC.AddDataError(reader.InvalidData(@"修理費の設定が間違っています。", data_name));
                }

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

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

                // 特殊能力データ
                line_buf = LoadFeatureOuter(data_name, ud, reader, SRC);

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

                buf2 = Strings.Trim(Strings.Left(line_buf, ret - 1));
                buf  = Strings.Mid(line_buf, ret + 1);
                if (Information.IsNumeric(buf2))
                {
                    ud.HP = GeneralLib.MinLng(Conversions.ToInteger(buf2), 9999999);
                }
                else
                {
                    SRC.AddDataError(reader.InvalidData(@"最大HPの設定が間違っています。", data_name));
                    ud.HP = 1000;
                }

                // 最大EN
                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))
                {
                    ud.EN = GeneralLib.MinLng(Conversions.ToInteger(buf2), 9999);
                }
                else
                {
                    SRC.AddDataError(reader.InvalidData(@"最大ENの設定が間違っています。", data_name));
                    ud.EN = 100;
                }

                // 装甲
                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))
                {
                    ud.Armor = GeneralLib.MinLng(Conversions.ToInteger(buf2), 99999);
                }
                else
                {
                    SRC.AddDataError(reader.InvalidData(@"装甲の設定が間違っています。", data_name));
                }

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

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

                // 地形適応, ビットマップ
                line_buf = reader.GetLine();

                // 地形適応
                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 (Strings.Len(buf2) == 4)
                {
                    ud.Adaption = buf2;
                }
                else
                {
                    SRC.AddDataError(reader.InvalidData(@"地形適応の設定が間違っています。", data_name));
                    ud.Adaption = "AAAA";
                }

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

                if (Strings.LCase(Strings.Right(buf, 4)) == ".bmp")
                {
                    ud.Bitmap = buf;
                }
                else
                {
                    SRC.AddDataError(reader.InvalidData(@"ビットマップの設定が間違っています。", data_name));
                    ud.IsBitmapMissing = true;
                }

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

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

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

                // アビリティデータ
                line_buf = LoadAbility(data_name, ud, reader, SRC);
            }
            finally
            {
                if (ud != null)
                {
                    ud.Raw = reader.RawData;
                    reader.ClearRawData();
                }
            }
            return(ud);
        }
Beispiel #13
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);
        }
Beispiel #14
0
        // 能力値を更新
        public void Update()
        {
            // TODO Impl Update
            //    short skill_num;
            //    var skill_name = new string[65];
            //    var skill_data = new SkillData[65];
            //    short i, j;
            //    double lv;
            //    SkillData sd;

            #region // 現在のレベルで使用可能な特殊能力の一覧を作成

            // 以前の一覧を削除
            colSkill.Clear();

            // パイロットデータを参照しながら使用可能な特殊能力を検索
            var effectiveSkills = new List <SkillData>();
            foreach (SkillData sd in Data.Skills)
            {
                if (Level >= sd.NecessaryLevel)
                {
                    SkillData registerd;
                    // 既に登録済み?
                    if (sd.Name == "SP消費減少" || sd.Name == "スペシャルパワー自動発動" || sd.Name == "ハンター")
                    {
                        // これらの特殊能力は同種の能力を複数持つことが出来る
                        // ただしデータ指定まで同一であれば同じ能力と見なす
                        registerd = effectiveSkills.FirstOrDefault(x => x.Name == sd.Name && x.StrData == x.StrData);
                    }
                    else
                    {
                        registerd = effectiveSkills.FirstOrDefault(x => x.Name == sd.Name);
                    }

                    if (registerd == null)
                    {
                        // 未登録
                        effectiveSkills.Add(sd);
                    }
                    else if (sd.NecessaryLevel > registerd.NecessaryLevel)
                    {
                        // 登録済みである場合は習得レベルが高いものを優先
                        effectiveSkills.Remove(registerd);
                        effectiveSkills.Add(sd);
                    }
                }
            }

            // TODO Impl SetSkillコマンドで付加された特殊能力を検索
            //    // SetSkillコマンドで付加された特殊能力を検索
            //    string sname, alist, sdata;
            //    string buf;
            //    if (Expression.IsGlobalVariableDefined("Ability(" + ID + ")"))
            //    {

            //        // UPGRADE_WARNING: オブジェクト GlobalVariableList.Item().StringValue の既定プロパティを解決できませんでした。 詳細については、'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' をクリックしてください。
            //        alist = Conversions.ToString(Event.GlobalVariableList["Ability(" + ID + ")"].StringValue);
            //        var loopTo3 = GeneralLib.LLength(alist);
            //        for (i = 1; i <= loopTo3; i++)
            //        {
            //            sname = GeneralLib.LIndex(alist, i);
            //            // UPGRADE_WARNING: オブジェクト GlobalVariableList.Item().StringValue の既定プロパティを解決できませんでした。 詳細については、'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' をクリックしてください。
            //            buf = Conversions.ToString(Event.GlobalVariableList["Ability(" + ID + "," + sname + ")"].StringValue);
            //            sdata = GeneralLib.ListTail(buf, 2);

            //            // 既に登録済み?
            //            if (sname == "SP消費減少" || sname == "スペシャルパワー自動発動" || sname == "ハンター")
            //            {
            //                // これらの特殊能力は同種の能力を複数持つことが出来る
            //                var loopTo4 = skill_num;
            //                for (j = 1; j <= loopTo4; j++)
            //                {
            //                    if ((sname ?? "") == (skill_name[j] ?? ""))
            //                    {
            //                        if ((sdata ?? "") == (skill_data[j].StrData ?? ""))
            //                        {
            //                            // ただしデータ指定まで同一であれば同じ能力と見なす
            //                            break;
            //                        }
            //                    }
            //                }
            //            }
            //            else
            //            {
            //                var loopTo5 = skill_num;
            //                for (j = 1; j <= loopTo5; j++)
            //                {
            //                    if ((sname ?? "") == (skill_name[j] ?? ""))
            //                    {
            //                        break;
            //                    }
            //                }
            //            }

            //            if (j > skill_num)
            //            {
            //                // 未登録
            //                skill_num = j;
            //                skill_name[j] = sname;
            //            }

            //            if (GeneralLib.StrToDbl(GeneralLib.LIndex(buf, 1)) == 0d)
            //            {
            //                // レベル0の場合は能力を封印
            //                // UPGRADE_NOTE: オブジェクト skill_data() をガベージ コレクトするまでこのオブジェクトを破棄することはできません。 詳細については、'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6E35BFF6-CD74-4B09-9689-3E1A43DF8969"' をクリックしてください。
            //                skill_data[j] = null;
            //            }
            //            else
            //            {
            //                // PDListのデータを書き換えるわけにはいかないので
            //                // アビリティデータを新規に作成
            //                sd = new SkillData();
            //                sd.Name = sname;
            //                sd.Level = GeneralLib.StrToDbl(GeneralLib.LIndex(buf, 1));
            //                if (sd.Level == -1)
            //                {
            //                    sd.Level = Constants.DEFAULT_LEVEL;
            //                }

            //                sd.StrData = GeneralLib.ListTail(buf, 2);
            //                skill_data[j] = sd;
            //            }
            //        }
            //    }

            //    // 属性使用不能状態の際、対応する技能を封印する。
            //    if (Unit is object)
            //    {
            //        var loopTo6 = skill_num;
            //        for (j = 1; j <= loopTo6; j++)
            //        {
            //            if (skill_data[j] is object)
            //            {
            //                if (Unit.ConditionLifetime(skill_data[j].Name + "使用不能") > 0)
            //                {
            //                    // UPGRADE_NOTE: オブジェクト skill_data() をガベージ コレクトするまでこのオブジェクトを破棄することはできません。 詳細については、'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6E35BFF6-CD74-4B09-9689-3E1A43DF8969"' をクリックしてください。
            //                    skill_data[j] = null;
            //                }
            //            }
            //        }
            //    }

            // 使用可能な特殊能力を登録
            {
                var i = 0;
                foreach (var sd in effectiveSkills)
                {
                    i++;
                    switch (sd.Name ?? "")
                    {
                    case "SP消費減少":
                    case "スペシャルパワー自動発動":
                    case "ハンター":
                        if (colSkill.ContainsKey(sd.Name))
                        {
                            colSkill.Add(sd, sd.Name + ":" + i);
                        }
                        else
                        {
                            colSkill.Add(sd, sd.Name);
                        }
                        break;

                    default:
                        colSkill.Add(sd, sd.Name);
                        break;
                    }
                }
            }
            #endregion

            // これから下は能力値の計算

            #region 基本値
            InfightBase   = Data.Infight;
            ShootingBase  = Data.Shooting;
            HitBase       = Data.Hit;
            DodgeBase     = Data.Dodge;
            TechniqueBase = Data.Technique;
            IntuitionBase = Data.Intuition;
            Adaption      = Data.Adaption;

            // レベルによる追加分
            var lv = Level + SkillLevel("追加レベル", "");
            if (Expression.IsOptionDefined("攻撃力低成長"))
            {
                InfightBase  = (InfightBase + (int)(lv * (1d + 2d * SkillLevel("格闘成長", ""))) / 2);
                ShootingBase = (ShootingBase + (int)(lv * (1d + 2d * SkillLevel("射撃成長", ""))) / 2);
            }
            else
            {
                InfightBase  = (InfightBase + (int)(lv * (1d + SkillLevel("格闘成長", ""))));
                ShootingBase = (ShootingBase + (int)(lv * (1d + SkillLevel("射撃成長", ""))));
            }

            HitBase       = (HitBase + (int)(lv * (2d + SkillLevel("命中成長", ""))));
            DodgeBase     = (DodgeBase + (int)(lv * (2d + SkillLevel("回避成長", ""))));
            TechniqueBase = (TechniqueBase + (int)(lv * (1d + SkillLevel("技量成長", ""))));
            IntuitionBase = (IntuitionBase + (int)(lv * (1d + SkillLevel("反応成長", ""))));

            // 能力UP
            InfightBase   = (InfightBase + (int)SkillLevel("格闘UP", ""));
            ShootingBase  = (ShootingBase + (int)SkillLevel("射撃UP", ""));
            HitBase       = (HitBase + (int)SkillLevel("命中UP", ""));
            DodgeBase     = (DodgeBase + (int)SkillLevel("回避UP", ""));
            TechniqueBase = (TechniqueBase + (int)SkillLevel("技量UP", ""));
            IntuitionBase = (IntuitionBase + (int)SkillLevel("反応UP", ""));

            // 能力DOWN
            InfightBase   = (InfightBase - (int)SkillLevel("格闘DOWN", ""));
            ShootingBase  = (ShootingBase - (int)SkillLevel("射撃DOWN", ""));
            HitBase       = (HitBase - (int)SkillLevel("命中DOWN", ""));
            DodgeBase     = (DodgeBase - (int)SkillLevel("回避DOWN", ""));
            TechniqueBase = (TechniqueBase - (int)SkillLevel("技量DOWN", ""));
            IntuitionBase = (IntuitionBase - (int)SkillLevel("反応DOWN", ""));

            // 上限を超えないように
            InfightBase   = GeneralLib.MinLng(InfightBase, 9999);
            ShootingBase  = GeneralLib.MinLng(ShootingBase, 9999);
            HitBase       = GeneralLib.MinLng(HitBase, 9999);
            DodgeBase     = GeneralLib.MinLng(DodgeBase, 9999);
            TechniqueBase = GeneralLib.MinLng(TechniqueBase, 9999);
            IntuitionBase = GeneralLib.MinLng(IntuitionBase, 9999);
            #endregion

            // これから下は特殊能力による修正値の計算

            // まずは修正値を初期化
            InfightMod   = 0;
            ShootingMod  = 0;
            HitMod       = 0;
            DodgeMod     = 0;
            TechniqueMod = 0;
            IntuitionMod = 0;

            #region パイロット用特殊能力による修正
            lv = SkillLevel("超感覚", "");
            if (lv > 0d)
            {
                HitMod   = (int)(HitMod + 2d * lv + 3d);
                DodgeMod = (int)(DodgeMod + 2d * lv + 3d);
            }

            lv = SkillLevel("知覚強化", "");
            if (lv > 0d)
            {
                HitMod   = (int)(HitMod + 2d * lv + 3d);
                DodgeMod = (int)(DodgeMod + 2d * lv + 3d);
            }

            lv = SkillLevel("念力", "");
            if (lv > 0d)
            {
                HitMod   = (int)(HitMod + 2d * lv + 3d);
                DodgeMod = (int)(DodgeMod + 2d * lv + 3d);
            }

            lv       = SkillLevel("超反応", "");
            HitMod   = (int)(HitMod + 2d * lv);
            DodgeMod = (int)(DodgeMod + 2d * lv);

            if (IsSkillAvailable("サイボーグ"))
            {
                HitMod   = (HitMod + 5);
                DodgeMod = (DodgeMod + 5);
            }

            if (IsSkillAvailable("悟り"))
            {
                HitMod   = (HitMod + 10);
                DodgeMod = (DodgeMod + 10);
            }

            if (IsSkillAvailable("超能力"))
            {
                HitMod   = (HitMod + 5);
                DodgeMod = (DodgeMod + 5);
            }
            #endregion

            #region これから下はユニットによる修正値の計算
            //    // ユニットに乗っていない?
            //    if (Unit is null)
            //    {
            //        goto SkipUnitMod;
            //    }

            //    var padaption = new short[5];
            //    {
            //        var withBlock4 = Unit;
            //        // クイックセーブ処理などで実際には乗っていない場合
            //        if (withBlock4.CountPilot() == 0)
            //        {
            //            return;
            //        }

            //        // サブパイロット&サポートパイロットによるサポート
            //        if (ReferenceEquals(this, withBlock4.MainPilot()) && withBlock4.Status == "出撃")
            //        {
            //            var loopTo9 = withBlock4.CountPilot();
            //            for (i = 2; i <= loopTo9; i++)
            //            {
            //                {
            //                    var withBlock5 = withBlock4.Pilot(i);
            //                    InfightMod = (InfightMod + 2d * withBlock5.SkillLevel("格闘サポート", ref_mode: ""));
            //                    if (HasMana())
            //                    {
            //                        ShootingMod = (ShootingMod + 2d * withBlock5.SkillLevel("魔力サポート", ref_mode: ""));
            //                    }
            //                    else
            //                    {
            //                        ShootingMod = (ShootingMod + 2d * withBlock5.SkillLevel("射撃サポート", ref_mode: ""));
            //                    }

            //                    HitMod = (HitMod + 3d * withBlock5.SkillLevel("サポート", ref_mode: ""));
            //                    HitMod = (HitMod + 2d * withBlock5.SkillLevel("命中サポート", ref_mode: ""));
            //                    DodgeMod = (DodgeMod + 3d * withBlock5.SkillLevel("サポート", ref_mode: ""));
            //                    DodgeMod = (DodgeMod + 2d * withBlock5.SkillLevel("回避サポート", ref_mode: ""));
            //                    TechniqueMod = (TechniqueMod + 2d * withBlock5.SkillLevel("技量サポート", ref_mode: ""));
            //                    IntuitionMod = (IntuitionMod + 2d * withBlock5.SkillLevel("反応サポート", ref_mode: ""));
            //                }
            //            }

            //            var loopTo10 = withBlock4.CountSupport();
            //            for (i = 1; i <= loopTo10; i++)
            //            {
            //                {
            //                    var withBlock6 = withBlock4.Support(i);
            //                    InfightMod = (InfightMod + 2d * withBlock6.SkillLevel("格闘サポート", ref_mode: ""));
            //                    if (HasMana())
            //                    {
            //                        ShootingMod = (ShootingMod + 2d * withBlock6.SkillLevel("魔力サポート", ref_mode: ""));
            //                    }
            //                    else
            //                    {
            //                        ShootingMod = (ShootingMod + 2d * withBlock6.SkillLevel("射撃サポート", ref_mode: ""));
            //                    }

            //                    HitMod = (HitMod + 3d * withBlock6.SkillLevel("サポート", ref_mode: ""));
            //                    HitMod = (HitMod + 2d * withBlock6.SkillLevel("命中サポート", ref_mode: ""));
            //                    DodgeMod = (DodgeMod + 3d * withBlock6.SkillLevel("サポート", ref_mode: ""));
            //                    DodgeMod = (DodgeMod + 2d * withBlock6.SkillLevel("回避サポート", ref_mode: ""));
            //                    TechniqueMod = (TechniqueMod + 2d * withBlock6.SkillLevel("技量サポート", ref_mode: ""));
            //                    IntuitionMod = (IntuitionMod + 2d * withBlock6.SkillLevel("反応サポート", ref_mode: ""));
            //                }
            //            }

            //            if (withBlock4.IsFeatureAvailable("追加サポート"))
            //            {
            //                {
            //                    var withBlock7 = withBlock4.AdditionalSupport();
            //                    InfightMod = (InfightMod + 2d * withBlock7.SkillLevel("格闘サポート", ref_mode: ""));
            //                    if (HasMana())
            //                    {
            //                        ShootingMod = (ShootingMod + 2d * withBlock7.SkillLevel("魔力サポート", ref_mode: ""));
            //                    }
            //                    else
            //                    {
            //                        ShootingMod = (ShootingMod + 2d * withBlock7.SkillLevel("射撃サポート", ref_mode: ""));
            //                    }

            //                    HitMod = (HitMod + 3d * withBlock7.SkillLevel("サポート", ref_mode: ""));
            //                    HitMod = (HitMod + 2d * withBlock7.SkillLevel("命中サポート", ref_mode: ""));
            //                    DodgeMod = (DodgeMod + 3d * withBlock7.SkillLevel("サポート", ref_mode: ""));
            //                    DodgeMod = (DodgeMod + 2d * withBlock7.SkillLevel("回避サポート", ref_mode: ""));
            //                    TechniqueMod = (TechniqueMod + 2d * withBlock7.SkillLevel("技量サポート", ref_mode: ""));
            //                    IntuitionMod = (IntuitionMod + 2d * withBlock7.SkillLevel("反応サポート", ref_mode: ""));
            //                }
            //            }
            //        }

            //        // ユニット&アイテムによる強化
            //        var loopTo11 = withBlock4.CountFeature();
            //        for (i = 1; i <= loopTo11; i++)
            //        {
            //            switch (withBlock4.Feature(i) ?? "")
            //            {
            //                case "格闘強化":
            //                    {
            //                        string localFeatureData() { object argIndex1 = i; var ret = withBlock4.FeatureData(argIndex1); return ret; }

            //                        string localLIndex() { string arglist = hs2cde20588fb24d85bea5cf26fad46fbc(); var ret = GeneralLib.LIndex(arglist, 2); return ret; }

            //                        int localStrToLng() { string argexpr = hsc0c629727e364218a343e72f775d5378(); var ret = GeneralLib.StrToLng(argexpr); return ret; }

            //                        if (Morale >= localStrToLng())
            //                        {
            //                            double localFeatureLevel() { object argIndex1 = i; var ret = withBlock4.FeatureLevel(argIndex1); return ret; }

            //                            InfightMod = (InfightMod + 5d * localFeatureLevel());
            //                        }

            //                        break;
            //                    }

            //                case "射撃強化":
            //                    {
            //                        string localFeatureData1() { object argIndex1 = i; var ret = withBlock4.FeatureData(argIndex1); return ret; }

            //                        string localLIndex1() { string arglist = hs8f37be02bf88436e950e311a12d5b37e(); var ret = GeneralLib.LIndex(arglist, 2); return ret; }

            //                        int localStrToLng1() { string argexpr = hs75f1e2fd554a46828757d5c3791b5757(); var ret = GeneralLib.StrToLng(argexpr); return ret; }

            //                        if (Morale >= localStrToLng1())
            //                        {
            //                            double localFeatureLevel1() { object argIndex1 = i; var ret = withBlock4.FeatureLevel(argIndex1); return ret; }

            //                            ShootingMod = (ShootingMod + 5d * localFeatureLevel1());
            //                        }

            //                        break;
            //                    }

            //                case "命中強化":
            //                    {
            //                        string localFeatureData2() { object argIndex1 = i; var ret = withBlock4.FeatureData(argIndex1); return ret; }

            //                        string localLIndex2() { string arglist = hs11e93ac1f3284a4f93380ee6473c818c(); var ret = GeneralLib.LIndex(arglist, 2); return ret; }

            //                        int localStrToLng2() { string argexpr = hsa2ad2f0f65c84d6f8292a2b9a1fd3fd3(); var ret = GeneralLib.StrToLng(argexpr); return ret; }

            //                        if (Morale >= localStrToLng2())
            //                        {
            //                            double localFeatureLevel2() { object argIndex1 = i; var ret = withBlock4.FeatureLevel(argIndex1); return ret; }

            //                            HitMod = (HitMod + 5d * localFeatureLevel2());
            //                        }

            //                        break;
            //                    }

            //                case "回避強化":
            //                    {
            //                        string localFeatureData3() { object argIndex1 = i; var ret = withBlock4.FeatureData(argIndex1); return ret; }

            //                        string localLIndex3() { string arglist = hsacf802b5acb245cfbca1d3ca09fa7324(); var ret = GeneralLib.LIndex(arglist, 2); return ret; }

            //                        int localStrToLng3() { string argexpr = hs9f2075d9bdc24b7f9cf3f7845c40a78a(); var ret = GeneralLib.StrToLng(argexpr); return ret; }

            //                        if (Morale >= localStrToLng3())
            //                        {
            //                            double localFeatureLevel3() { object argIndex1 = i; var ret = withBlock4.FeatureLevel(argIndex1); return ret; }

            //                            DodgeMod = (DodgeMod + 5d * localFeatureLevel3());
            //                        }

            //                        break;
            //                    }

            //                case "技量強化":
            //                    {
            //                        string localFeatureData4() { object argIndex1 = i; var ret = withBlock4.FeatureData(argIndex1); return ret; }

            //                        string localLIndex4() { string arglist = hs3db15ab6c56047db9b6236f45e649ebd(); var ret = GeneralLib.LIndex(arglist, 2); return ret; }

            //                        int localStrToLng4() { string argexpr = hsd8d478d12f3941fca4b635b001945700(); var ret = GeneralLib.StrToLng(argexpr); return ret; }

            //                        if (Morale >= localStrToLng4())
            //                        {
            //                            double localFeatureLevel4() { object argIndex1 = i; var ret = withBlock4.FeatureLevel(argIndex1); return ret; }

            //                            TechniqueMod = (TechniqueMod + 5d * localFeatureLevel4());
            //                        }

            //                        break;
            //                    }

            //                case "反応強化":
            //                    {
            //                        string localFeatureData5() { object argIndex1 = i; var ret = withBlock4.FeatureData(argIndex1); return ret; }

            //                        string localLIndex5() { string arglist = hs0419ff33196e4e48af748fdce12580b1(); var ret = GeneralLib.LIndex(arglist, 2); return ret; }

            //                        int localStrToLng5() { string argexpr = hsabf5cf29dc0446c781dea0167fb94b44(); var ret = GeneralLib.StrToLng(argexpr); return ret; }

            //                        if (Morale >= localStrToLng5())
            //                        {
            //                            double localFeatureLevel5() { object argIndex1 = i; var ret = withBlock4.FeatureLevel(argIndex1); return ret; }

            //                            IntuitionMod = (IntuitionMod + 5d * localFeatureLevel5());
            //                        }

            //                        break;
            //                    }
            //            }
            //        }

            //        // 地形適応変更
            //        if (withBlock4.IsFeatureAvailable("パイロット地形適応変更"))
            //        {
            //            for (i = 1; i <= 4; i++)
            //            {
            //                switch (Strings.Mid(Adaption, i, 1) ?? "")
            //                {
            //                    case "S":
            //                        {
            //                            padaption[i] = 5;
            //                            break;
            //                        }

            //                    case "A":
            //                        {
            //                            padaption[i] = 4;
            //                            break;
            //                        }

            //                    case "B":
            //                        {
            //                            padaption[i] = 3;
            //                            break;
            //                        }

            //                    case "C":
            //                        {
            //                            padaption[i] = 2;
            //                            break;
            //                        }

            //                    case "D":
            //                        {
            //                            padaption[i] = 1;
            //                            break;
            //                        }

            //                    case "E":
            //                    case "-":
            //                        {
            //                            padaption[i] = 0;
            //                            break;
            //                        }
            //                }
            //            }

            //            // 地形適応変更能力による修正
            //            var loopTo12 = withBlock4.CountFeature();
            //            for (i = 1; i <= loopTo12; i++)
            //            {
            //                if (withBlock4.Feature(i) == "パイロット地形適応変更")
            //                {
            //                    for (j = 1; j <= 4; j++)
            //                    {
            //                        string localFeatureData8() { object argIndex1 = i; var ret = withBlock4.FeatureData(argIndex1); return ret; }

            //                        string localLIndex8() { string arglist = hsb8c32b5b97d840f1a1974442798ae710(); var ret = GeneralLib.LIndex(arglist, j); return ret; }

            //                        if (GeneralLib.StrToLng(localLIndex8()) >= 0)
            //                        {
            //                            // 修正値がプラスのとき
            //                            if (padaption[j] < 4)
            //                            {
            //                                string localFeatureData6() { object argIndex1 = i; var ret = withBlock4.FeatureData(argIndex1); return ret; }

            //                                string localLIndex6() { string arglist = hs8f1b1c4829bf4c8ea402eb72f2930e63(); var ret = GeneralLib.LIndex(arglist, j); return ret; }

            //                                int localStrToLng6() { string argexpr = hsdf089849003448bebc02763c21e401ad(); var ret = GeneralLib.StrToLng(argexpr); return ret; }

            //                                padaption[j] = (padaption[j] + localStrToLng6());
            //                                // 地形適応はAより高くはならない
            //                                if (padaption[j] > 4)
            //                                {
            //                                    padaption[j] = 4;
            //                                }
            //                            }
            //                        }
            //                        else
            //                        {
            //                            // 修正値がマイナスのときは本来の地形適応が"A"以上でも処理を行なう
            //                            string localFeatureData7() { object argIndex1 = i; var ret = withBlock4.FeatureData(argIndex1); return ret; }

            //                            string localLIndex7() { string arglist = hs8e6f6c053bcd4824a879080031dfde79(); var ret = GeneralLib.LIndex(arglist, j); return ret; }

            //                            int localStrToLng7() { string argexpr = hs210e4a3c7ff64bf2865702c94fd878d3(); var ret = GeneralLib.StrToLng(argexpr); return ret; }

            //                            padaption[j] = (padaption[j] + localStrToLng7());
            //                        }
            //                    }
            //                }
            //            }

            //            Adaption = "";
            //            for (i = 1; i <= 4; i++)
            //            {
            //                switch (padaption[i])
            //                {
            //                    case var @case when @case >= 5:
            //                        {
            //                            Adaption = Adaption + "S";
            //                            break;
            //                        }

            //                    case 4:
            //                        {
            //                            Adaption = Adaption + "A";
            //                            break;
            //                        }

            //                    case 3:
            //                        {
            //                            Adaption = Adaption + "B";
            //                            break;
            //                        }

            //                    case 2:
            //                        {
            //                            Adaption = Adaption + "C";
            //                            break;
            //                        }

            //                    case 1:
            //                        {
            //                            Adaption = Adaption + "D";
            //                            break;
            //                        }

            //                    case var case1 when case1 <= 0:
            //                        {
            //                            Adaption = Adaption + "-";
            //                            break;
            //                        }
            //                }
            //            }
            //        }
            //    }

            //    // 気力の値を気力上限・気力下限の範囲にする
            //    SetMorale(Morale);
            //SkipUnitMod:
            //    ;
            #endregion

            // 基本値と修正値の合計から実際の能力値を算出
            Infight   = GeneralLib.MinLng((InfightBase + InfightMod) + InfightMod2, 9999);
            Shooting  = GeneralLib.MinLng((ShootingBase + ShootingMod) + ShootingMod2, 9999);
            Hit       = GeneralLib.MinLng((HitBase + HitMod) + HitMod2, 9999);
            Dodge     = GeneralLib.MinLng((DodgeBase + DodgeMod) + DodgeMod2, 9999);
            Technique = GeneralLib.MinLng((TechniqueBase + TechniqueMod) + TechniqueMod2, 9999);
            Intuition = GeneralLib.MinLng((IntuitionBase + IntuitionMod) + IntuitionMod2, 9999);
        }
Beispiel #15
0
        public void MoveUnitBitmap(Unit u, int x1, int y1, int x2, int y2, int wait_time0, int division)
        {
            int start_time = 0;
            int cur_time   = 0;
            int wait_time  = wait_time0 / division;

            SaveScreen();

            using (var unitImage = new Bitmap(MapCellPx, MapCellPx))
            {
                // ユニット画像を作成
                using (var g = Graphics.FromImage(unitImage))
                {
                    DrawUnit(g, Map.CellAtPoint(u.x, u.y), u, new Rectangle(0, 0, unitImage.Width, unitImage.Height));
                }

                // 移動の始点を設定
                var xx = GUI.MapToPixelX(x1);
                var yy = GUI.MapToPixelY(y1);
                var vx = 0;
                var vy = 0;

                // 背景上の画像をまず消去
                // (既に移動している場合を除く)
                if (ReferenceEquals(u, Map.MapDataForUnit[x1, y1]))
                {
                    EraseUnitBitmap(x1, y1, false);
                }

                // 最初の移動方向を設定
                if (Math.Abs((x2 - x1)) > Math.Abs((y2 - y1)))
                {
                    if (x2 > x1)
                    {
                        vx = 1;
                    }
                    else
                    {
                        vx = -1;
                    }

                    vy = 0;
                }
                else
                {
                    if (y2 > y1)
                    {
                        vy = 1;
                    }
                    else
                    {
                        vy = -1;
                    }

                    vx = 0;
                }

                if (wait_time > 0)
                {
                    start_time = GeneralLib.timeGetTime();
                }

                // 移動の描画
                var loopTo = (division * GeneralLib.MaxLng(Math.Abs((x2 - x1)), Math.Abs((y2 - y1))));
                for (var i = 1; i <= loopTo; i++)
                {
                    using (var g = Graphics.FromImage(MainDoubleBuffer))
                    {
                        // 画像を消去
                        var sourceRect = new Rectangle(xx, yy, MapCellPx, MapCellPx);
                        g.DrawImage(MainBuffer, sourceRect, sourceRect, GraphicsUnit.Pixel);

                        // 座標を移動
                        xx = (xx + MapCellPx * vx / division);
                        yy = (yy + MapCellPx * vy / division);

                        // 画像を描画
                        g.DrawImage(unitImage, xx, yy);
                    }
                    UpdataMain();

                    if (wait_time > 0)
                    {
                        do
                        {
                            Application.DoEvents();
                            cur_time = GeneralLib.timeGetTime();
                        }while (start_time + wait_time > cur_time);
                        start_time = cur_time;
                    }
                }

                // 2回目の移動方向を設定
                if (Math.Abs((x2 - x1)) > Math.Abs((y2 - y1)))
                {
                    if (y2 > y1)
                    {
                        vy = 1;
                    }
                    else
                    {
                        vy = -1;
                    }

                    vx = 0;
                }
                else
                {
                    if (x2 > x1)
                    {
                        vx = 1;
                    }
                    else
                    {
                        vx = -1;
                    }

                    vy = 0;
                }

                // 移動の描画
                var loopTo1 = (division * GeneralLib.MinLng(Math.Abs((x2 - x1)), Math.Abs((y2 - y1))));
                for (var i = 1; i <= loopTo1; i++)
                {
                    using (var g = Graphics.FromImage(MainDoubleBuffer))
                    {
                        // 画像を消去
                        var sourceRect = new Rectangle(xx, yy, MapCellPx, MapCellPx);
                        g.DrawImage(MainBuffer, sourceRect, sourceRect, GraphicsUnit.Pixel);

                        // 座標を移動
                        xx = (xx + MapCellPx * vx / division);
                        yy = (yy + MapCellPx * vy / division);

                        // 画像を描画
                        g.DrawImage(unitImage, xx, yy);
                    }

                    UpdataMain();

                    if (wait_time > 0)
                    {
                        do
                        {
                            Application.DoEvents();
                            cur_time = GeneralLib.timeGetTime();
                        }while (start_time + wait_time > cur_time);
                        start_time = cur_time;
                    }
                }
            }

            // 画面が書き換えられたことを記録
            GUI.ScreenIsSaved = false;
        }