Esempio n. 1
0
        // 「アビリティ一覧」コマンド
        private void AbilityListCommand()
        {
            LogDebug();

            GUI.LockGUI();
            while (true)
            {
                var currentAbility = GUI.AbilityListBox(SelectedUnit, new UnitAbilityList(AbilityListMode.List, SelectedUnit), Expression.Term("アビリティ", SelectedUnit) + "一覧", "一覧");
                if (currentAbility == null)
                {
                    SelectedAbility = 0;
                    // キャンセル
                    if (SRC.AutoMoveCursor)
                    {
                        GUI.RestoreCursorPos();
                    }

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

                SelectedAbility = currentAbility.AbilityNo();
                // 指定されたアビリティの属性一覧を作成
                {
                    var list   = new List <string>();
                    var i      = 0;
                    var u      = SelectedUnit;
                    var aclass = currentAbility.Data.Class;
                    while (i <= Strings.Len(aclass))
                    {
                        i = (i + 1);
                        var buf    = GeneralLib.GetClassBundle(aclass, ref i);
                        var atype  = "";
                        var alevel = "";

                        // 非表示?
                        if (buf == "|")
                        {
                            break;
                        }

                        // M属性
                        if (Strings.Mid(aclass, i, 1) == "M")
                        {
                            i   = (i + 1);
                            buf = buf + Strings.Mid(aclass, i, 1);
                        }

                        // レベル指定
                        if (Strings.Mid(aclass, i + 1, 1) == "L")
                        {
                            i = (i + 2);
                            var c = Strings.Mid(aclass, i, 1);
                            while (Information.IsNumeric(c) || c == "." || c == "-")
                            {
                                alevel = alevel + c;
                                i      = (i + 1);
                                c      = Strings.Mid(aclass, i, 1);
                            }

                            i = (i - 1);
                        }

                        // 属性の名称
                        atype = Help.AttributeName(SelectedUnit, buf);
                        if (Strings.Len(atype) > 0)
                        {
                            if (Strings.Len(alevel) > 0)
                            {
                                list.Add(GeneralLib.RightPaddedString(buf + "L" + alevel, 8) + atype + "レベル" + alevel);
                            }
                            else
                            {
                                list.Add(GeneralLib.RightPaddedString(buf, 8) + atype);
                            }
                        }
                    }

                    if (!Map.IsStatusView)
                    {
                        list.Add("射程範囲");
                    }

                    if (list.Count > 0)
                    {
                        GUI.TopItem = 1;
                        while (true)
                        {
                            if (list.Count == 1 && list[0] == "射程範囲")
                            {
                                i = 1;
                            }
                            else
                            {
                                i = GUI.ListBox(new ListBoxArgs
                                {
                                    lb_caption = "アビリティ属性一覧",
                                    Items      = list.Select(x => new ListBoxItem(x)).ToList(),
                                    lb_info    = "属性    効果",
                                    lb_mode    = "連続表示",
                                });
                            }

                            if (i == 0)
                            {
                                // キャンセル
                                break;
                            }
                            else if (list[i - 1] == "射程範囲")
                            {
                                GUI.CloseListBox();

                                // 武器の射程を求めておく
                                var min_range = currentAbility.AbilityMinRange();
                                var max_range = currentAbility.AbilityMaxRange();
                                // 射程範囲表示
                                if ((max_range == 1 || currentAbility.IsAbilityClassifiedAs("P")) && !currentAbility.IsAbilityClassifiedAs("Q"))
                                {
                                    Map.AreaInReachable(SelectedUnit, max_range, u.Party + "の敵");
                                }
                                else if (currentAbility.IsAbilityClassifiedAs("M直"))
                                {
                                    Map.AreaInCross(u.x, u.y, min_range, max_range);
                                }
                                else if (currentAbility.IsAbilityClassifiedAs("M拡"))
                                {
                                    Map.AreaInWideCross(u.x, u.y, min_range, max_range);
                                }
                                else if (currentAbility.IsAbilityClassifiedAs("M扇"))
                                {
                                    Map.AreaInSectorCross(u.x, u.y, min_range, max_range, (int)currentAbility.AbilityLevel("M扇"));
                                }
                                else if (currentAbility.IsAbilityClassifiedAs("M全") || currentAbility.IsAbilityClassifiedAs("M線"))
                                {
                                    Map.AreaInRange(u.x, u.y, max_range, min_range, "すべて");
                                }
                                else if (currentAbility.IsAbilityClassifiedAs("M投"))
                                {
                                    max_range = ((int)(max_range + currentAbility.AbilityLevel("M投")));
                                    min_range = ((int)(min_range - currentAbility.AbilityLevel("M投")));
                                    min_range = GeneralLib.MaxLng(min_range, 1);
                                    Map.AreaInRange(u.x, u.y, max_range, min_range, "すべて");
                                }
                                else if (currentAbility.IsAbilityClassifiedAs("M移"))
                                {
                                    Map.AreaInMoveAction(SelectedUnit, max_range);
                                }
                                else
                                {
                                    Map.AreaInRange(u.x, u.y, max_range, min_range, u.Party + "の敵");
                                }

                                GUI.Center(u.x, u.y);
                                GUI.MaskScreen();

                                // 先行入力されていたクリックイベントを解消
                                GUI.DoEvents();
                                WaitClickMode     = true;
                                GUI.IsFormClicked = false;

                                // クリックされるまで待つ
                                while (!GUI.IsFormClicked)
                                {
                                    GUI.Sleep(25);
                                    if (GUI.IsRButtonPressed(true))
                                    {
                                        break;
                                    }
                                }

                                GUI.RedrawScreen();
                                if (list.Count == 1)
                                {
                                    break;
                                }
                            }
                            else
                            {
                                // 指定された属性の解説を表示
                                GUI.CloseListBox();
                                Help.AttributeHelp(SelectedUnit, GeneralLib.LIndex(list[i - 1], 1), currentAbility.AbilityNo(), true);
                            }
                        }
                    }
                }
            }
        }