Beispiel #1
0
Datei: Time.cs Projekt: 7474/SRC
        protected override ValueType InvokeInternal(SRC SRC, ValueType etype, string[] @params, int pcount, bool[] is_term, out string str_result, out double num_result)
        {
            str_result = "";
            num_result = 0d;

            switch (pcount)
            {
            case 1:
            {
                var      buf = SRC.Expression.GetValueAsString(@params[1], is_term[1]);
                DateTime dt;
                if (Conversions.TryToDateTime(buf, out dt))
                {
                    num_result = dt.Second;
                }
                else
                {
                    num_result = 0d;
                }

                break;
            }

            case 0:
            {
                num_result = Conversions.GetNow().Second;
                break;
            }
            }

            if (etype == ValueType.StringType)
            {
                str_result = GeneralLib.FormatNum(num_result);
                return(ValueType.StringType);
            }
            else
            {
                return(ValueType.NumericType);
            }
        }
Beispiel #2
0
        // Flashファイルからイベントを取得
        // Flashのアクションの「GetURL」で
        // 1.「URL」に"FSCommand:"
        // 2.「ターゲット」に「サブルーチン名 [引数1 [引数2 […]]」
        // を指定すると、そのアクションが実行されたときに
        // ターゲットのサブルーチンが実行される。
        // サブルーチンを実行している間、Flashの再生は停止する。
        public static void GetEvent(string fpara)
        {
            var    buf = default(string);
            short  i, j;
            string funcname, funcpara;
            var    etype      = default(Expression.ValueType);
            var    str_result = default(string);
            var    num_result = default(double);

            // 再生を一時停止
            // UPGRADE_WARNING: オブジェクト frmMain.FlashObject.StopMovie の既定プロパティを解決できませんでした。 詳細については、'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' をクリックしてください。
            My.MyProject.Forms.frmMain.FlashObject.StopMovie();
            funcname = "";
            funcpara = "";

            // 念のためにFlashから渡されたパラメータ全てを解析
            // 一番最初に見つかった文字列を、呼び出すサブルーチン名とする
            if (string.IsNullOrEmpty(funcname))
            {
                funcname = GeneralLib.ListIndex(ref fpara, 1);
                buf      = GeneralLib.ListTail(ref fpara, 2);
            }
            // サブルーチンの引数を記録
            var loopTo = GeneralLib.ListLength(ref buf);

            for (j = 1; j <= loopTo; j++)
            {
                funcpara = funcpara + ", " + GeneralLib.ListIndex(ref buf, j);
            }

            // サブルーチン名と引数から、Call関数の呼び出しの文字列を生成
            buf = "Call(" + funcname + funcpara + ")";
            // 式として生成した文字列を実行
            Expression.CallFunction(ref buf, ref etype, ref str_result, ref num_result);

            // 再生を再開
            // UPGRADE_WARNING: オブジェクト frmMain.FlashObject.PlayMovie の既定プロパティを解決できませんでした。 詳細については、'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' をクリックしてください。
            My.MyProject.Forms.frmMain.FlashObject.PlayMovie();
        }
Beispiel #3
0
        // ユニットの同調率
        public double SyncLevel(bool no_limit = false)
        {
            double SyncLevelRet = default;

            if (CountPilot() == 0)
            {
                return(SyncLevelRet);
            }

            SyncLevelRet = MainPilot().SynchroRate();

            // シンクロドライブレベルによる制限
            if (IsFeatureAvailable("シンクロドライブ") && !no_limit)
            {
                if (IsFeatureLevelSpecified("シンクロドライブ"))
                {
                    SyncLevelRet = GeneralLib.MinDbl(SyncLevelRet, FeatureLevel("シンクロドライブ"));
                }
            }

            return(SyncLevelRet);
        }
Beispiel #4
0
        protected override int ExecInternal()
        {
            Unit u;

            switch (ArgNum)
            {
            case 1:
            {
                u = Event.SelectedUnitForEvent;
                break;
            }

            case 2:
            {
                u = GetArgAsUnit(2);
                break;
            }

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

            if (!u.IsFeatureAvailable("分離"))
            {
                throw new EventErrorException(this, u.Name + "は分離できません");
            }

            u.Split();

            // 分離形態の1番目のユニットをメインユニットに設定
            var su = SRC.UList.Item(GeneralLib.LIndex(u.FeatureData("分離"), 2));

            // 変数のアップデート
            // XXX 元はSavedStateは更新していなかったけれど更新してる
            UpdateSelectedState(u, su);

            return(EventData.NextID);
        }
Beispiel #5
0
Datei: List.cs Projekt: 7474/SRC
        protected override ValueType InvokeInternal(SRC SRC, ValueType etype, string[] @params, int pcount, bool[] is_term, out string str_result, out double num_result)
        {
            str_result = "";
            num_result = 0d;

            var buf  = SRC.Expression.GetValueAsString(@params[1], is_term[1]);
            var buf2 = SRC.Expression.GetValueAsString(@params[2], is_term[2]);
            var num  = pcount < 3 ? 1 : SRC.Expression.GetValueAsLong(@params[3], is_term[3]);
            var num2 = GeneralLib.ListLength(buf);

            for (var i = num; i <= num2; i++)
            {
                if (GeneralLib.ListIndex(buf, i) == buf2)
                {
                    if (etype == ValueType.StringType)
                    {
                        str_result = SrcFormatter.Format(i);
                        return(ValueType.StringType);
                    }
                    else
                    {
                        num_result = i;
                        return(ValueType.NumericType);
                    }
                }
            }

            if (etype == ValueType.StringType)
            {
                str_result = "0";
                return(ValueType.StringType);
            }
            else
            {
                num_result = 0d;
                return(ValueType.NumericType);
            }
        }
Beispiel #6
0
Datei: Unit.cs Projekt: 7474/SRC
        protected override ValueType InvokeInternal(SRC SRC, Units.Unit unit, ValueType etype, string[] @params, int pcount, bool[] is_term, out string str_result, out double num_result)
        {
            str_result = "";
            num_result = 0d;

            var cname = pcount == 1
                ? SRC.Expression.GetValueAsString(@params[1], is_term[1])
                : SRC.Expression.GetValueAsString(@params[2], is_term[2]);

            if (unit?.IsConditionSatisfied(cname) ?? false)
            {
                num_result = 1d;
            }
            if (etype == ValueType.StringType)
            {
                str_result = GeneralLib.FormatNum(num_result);
                return(ValueType.StringType);
            }
            else
            {
                return(ValueType.NumericType);
            }
        }
Beispiel #7
0
        public MainWindow()
        {
            InitializeComponent();

            // set wrapper using builder
            m_GeneralLib = new GeneralLib(

                new ConfigurationBuilder()
                .FileName("temp.txt")
                .Counter(10)
                .FunctionMap(new Dictionary <string, byte>()
            {
                { "ParamName_1", 1 },
                { "ParamName_2", 2 }
            }
                             )
                );

            // register to callback
            m_GeneralLib.Register(OnBufferReady);


            lbl.Content = String.Format("Buffer id: {0}", m_BufferId);
        }
Beispiel #8
0
        // 属性 aname に対して特殊効果無効化属性を持つか?
        public bool SpecialEffectImmune(string aname)
        {
            bool SpecialEffectImmuneRet = default;

            // 全属性に有効な場合
            if (GeneralLib.InStrNotNest(strSpecialEffectImmune, "全") > 0)
            {
                SpecialEffectImmuneRet = true;
                return(SpecialEffectImmuneRet);
            }

            if (Strings.Len(aname) == 0)
            {
                return(SpecialEffectImmuneRet);
            }

            if (GeneralLib.InStrNotNest(strSpecialEffectImmune, aname) > 0)
            {
                SpecialEffectImmuneRet = true;
                return(SpecialEffectImmuneRet);
            }

            // 無効化や弱点と違い、クリティカル率のみなので
            // 「火」に対する防御特性が「弱火」のクリティカル率に影響する点について
            // 直接関数内に記述できる。
            if (Strings.Left(aname, 1) == "弱" || Strings.Left(aname, 1) == "効")
            {
                if (GeneralLib.InStrNotNest(strSpecialEffectImmune, aname) > 0)
                {
                    SpecialEffectImmuneRet = true;
                    return(SpecialEffectImmuneRet);
                }
            }

            return(SpecialEffectImmuneRet);
        }
Beispiel #9
0
        protected override ValueType InvokeInternal(SRC SRC, Pilots.Pilot pilot, ValueType etype, string[] @params, int pcount, bool[] is_term, out string str_result, out double num_result)
        {
            str_result = "";
            num_result = 0d;
            var name = pcount == 1
                ? SRC.Expression.GetValueAsString(@params[1], is_term[1])
                : SRC.Expression.GetValueAsString(@params[2], is_term[2]);

            // エリアスが定義されている?
            if (SRC.ALDList.IsDefined(name))
            {
                name = SRC.ALDList.Item(name).ReplaceTypeName(name);
            }
            num_result = pilot?.SkillLevel(name) ?? 0d;
            if (etype == ValueType.StringType)
            {
                str_result = GeneralLib.FormatNum(num_result);
                return(ValueType.StringType);
            }
            else
            {
                return(ValueType.NumericType);
            }
        }
Beispiel #10
0
Datei: List.cs Projekt: 7474/SRC
        protected override ValueType InvokeInternal(SRC SRC, ValueType etype, string[] @params, int pcount, bool[] is_term, out string str_result, out double num_result)
        {
            num_result = 0d;

            str_result = GeneralLib.ListIndex(
                SRC.Expression.GetValueAsString(@params[1], is_term[1]),
                SRC.Expression.GetValueAsLong(@params[2], is_term[2]));

            // 全体が()で囲まれている場合は()を外す
            if (Strings.Left(str_result, 1) == "(" && Strings.Right(str_result, 1) == ")")
            {
                str_result = Strings.Mid(str_result, 2, Strings.Len(str_result) - 2);
            }

            if (etype == ValueType.StringType)
            {
                return(ValueType.StringType);
            }
            else
            {
                num_result = GeneralLib.StrToDbl(str_result);
                return(ValueType.NumericType);
            }
        }
Beispiel #11
0
Datei: Unit.cs Projekt: 7474/SRC
        protected override ValueType InvokeInternal(SRC SRC, Units.Unit unit, ValueType etype, string[] @params, int pcount, bool[] is_term, out string str_result, out double num_result)
        {
            str_result = "";
            num_result = 0d;

            num_result = unit?.CountItem() ?? 0d;
            if (pcount == 1)
            {
                var pname = SRC.Expression.GetValueAsString(@params[1], is_term[1]);
                if (pname == "未装備")
                {
                    num_result = SRC.IList.List.Count(itm => itm.Unit == null && itm.Exist);
                }
            }
            if (etype == ValueType.StringType)
            {
                str_result = GeneralLib.FormatNum(num_result);
                return(ValueType.StringType);
            }
            else
            {
                return(ValueType.NumericType);
            }
        }
Beispiel #12
0
        // 「特殊能力一覧」コマンド
        private void FeatureListCommand()
        {
            LogDebug();

            GUI.LockGUI();

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

            var currentUnit = SelectedUnit;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            CommandState = "ユニット選択";
            GUI.UnlockGUI();
        }
Beispiel #13
0
        // アビリティに効果を追加
        public void SetEffect(ref string elist)
        {
            short         j, i, k;
            string        buf;
            AbilityEffect dat;
            string        elevel, etype, edata;

            GeneralLib.TrimString(ref elist);
            var loopTo = GeneralLib.ListLength(ref elist);

            for (i = 1; i <= loopTo; i++)
            {
                dat = NewAbilityEffect();
                buf = GeneralLib.ListIndex(ref elist, i);
                j   = (short)Strings.InStr(buf, "Lv");
                k   = (short)Strings.InStr(buf, "=");
                if (j > 0 & (k == 0 | j < k))
                {
                    // レベル指定のある効果(データ指定があるものを含む)
                    dat.Name = Strings.Left(buf, j - 1);
                    if (k > 0)
                    {
                        // データ指定があるもの
                        dat.Level = Conversions.ToDouble(Strings.Mid(buf, j + 2, k - (j + 2)));
                        buf       = Strings.Mid(buf, k + 1);
                        if (Strings.Left(buf, 1) == "\"")
                        {
                            buf = Strings.Mid(buf, 2, Strings.Len(buf) - 2);
                        }

                        j = (short)Strings.InStr(buf, "Lv");
                        k = (short)Strings.InStr(buf, "=");
                        if (j > 0 & (k == 0 | j < k))
                        {
                            // データ指定内にレベル指定がある
                            etype = Strings.Left(buf, j - 1);
                            if (k > 0)
                            {
                                elevel = Strings.Mid(buf, j + 2, k - (j + 2));
                                edata  = Strings.Mid(buf, k + 1);
                            }
                            else
                            {
                                elevel = Strings.Mid(buf, j + 2);
                                edata  = "";
                            }
                        }
                        else if (k > 0)
                        {
                            // データ指定内にデータ指定がある
                            etype  = Strings.Left(buf, k - 1);
                            elevel = "";
                            edata  = Strings.Mid(buf, k + 1);
                        }
                        else
                        {
                            // 単純なデータ指定
                            etype  = buf;
                            elevel = "";
                            edata  = "";
                        }

                        if (dat.Name == "付加" & string.IsNullOrEmpty(elevel))
                        {
                            elevel = Microsoft.VisualBasic.Compatibility.VB6.Support.Format(SRC.DEFAULT_LEVEL);
                        }

                        dat.Data = Strings.Trim(etype + " " + elevel + " " + edata);
                    }
                    else
                    {
                        // データ指定がないもの
                        dat.Level = Conversions.ToDouble(Strings.Mid(buf, j + 2));
                    }
                }
                else if (k > 0)
                {
                    // データ指定を含む効果
                    dat.Name = Strings.Left(buf, k - 1);
                    buf      = Strings.Mid(buf, k + 1);
                    if (Strings.Asc(buf) == 34) // "
                    {
                        buf = Strings.Mid(buf, 2, Strings.Len(buf) - 2);
                    }

                    j = (short)Strings.InStr(buf, "Lv");
                    k = (short)Strings.InStr(buf, "=");
                    if (dat.Name == "解説")
                    {
                        // 解説の指定
                        etype  = buf;
                        elevel = "";
                        edata  = "";
                    }
                    else if (j > 0)
                    {
                        // データ指定内にレベル指定がある
                        etype = Strings.Left(buf, j - 1);
                        if (k > 0)
                        {
                            elevel = Strings.Mid(buf, j + 2, k - (j + 2));
                            edata  = Strings.Mid(buf, k + 1);
                        }
                        else
                        {
                            elevel = Strings.Mid(buf, j + 2);
                            edata  = "";
                        }
                    }
                    else if (k > 0)
                    {
                        // データ指定内にデータ指定がある
                        etype  = Strings.Left(buf, k - 1);
                        elevel = "";
                        edata  = Strings.Mid(buf, k + 1);
                    }
                    else
                    {
                        // 単純なデータ指定
                        etype  = buf;
                        elevel = "";
                        edata  = "";
                    }

                    if (dat.Name == "付加" & string.IsNullOrEmpty(elevel))
                    {
                        elevel = Microsoft.VisualBasic.Compatibility.VB6.Support.Format(SRC.DEFAULT_LEVEL);
                    }

                    dat.Data = Strings.Trim(etype + " " + elevel + " " + edata);
                }
                else
                {
                    // 効果名のみ
                    dat.Name = buf;
                }

                j = 1;
                foreach (AbilityEffect dat2 in colEffects)
                {
                    if ((dat.Name ?? "") == (dat2.Name ?? ""))
                    {
                        j = (short)(j + 1);
                    }
                }

                if (j == 1)
                {
                    colEffects.Add(dat, dat.Name);
                }
                else
                {
                    colEffects.Add(dat, dat.Name + Microsoft.VisualBasic.Compatibility.VB6.Support.Format(j));
                }
            }
        }
        public void Insert(string Description,string Type,string ExternalRef,DateTime? DateAdded,bool? Valid)
        {
            GeneralLib item = new GeneralLib();

            item.Description = Description;

            item.Type = Type;

            item.ExternalRef = ExternalRef;

            item.DateAdded = DateAdded;

            item.Valid = Valid;

            item.Save(UserName);
        }
Beispiel #15
0
        // スペシャルパワーコマンドを開始
        private void StartSpecialPowerCommand()
        {
            GUI.LockGUI();
            SelectedCommand = "スペシャルパワー";
            {
                var u = SelectedUnit;

                // スペシャルパワーを使用可能なパイロットの一覧を作成
                var pilots    = u.PilotsHaveSpecialPower();
                var listItems = pilots.Select(p =>
                {
                    return(new ListBoxItem
                    {
                        Text = GeneralLib.RightPaddedString(p.get_Nickname(false), 17)
                               + GeneralLib.RightPaddedString($"{p.SP}/{p.MaxSP}", 8)
                               + string.Join("", Enumerable.Range(1, p.CountSpecialPower).Select(i =>
                        {
                            var sname = p.get_SpecialPower(i);
                            if (p.SP >= p.SpecialPowerCost(sname))
                            {
                                return SRC.SPDList.Item(sname).ShortName;
                            }
                            else
                            {
                                return "";
                            }
                        })),
                    });
                }).ToList();

                GUI.TopItem = 1;
                int i;
                if (pilots.Count > 1)
                {
                    // どのパイロットを使うか選択
                    if (Expression.IsOptionDefined("等身大基準"))
                    {
                        i = GUI.ListBox(new ListBoxArgs
                        {
                            Items      = listItems,
                            HasFlag    = false,
                            lb_caption = "キャラクター選択",
                            lb_info    = "キャラクター     " + Expression.Term("SP", SelectedUnit, 2) + "/Max" + Expression.Term("SP", SelectedUnit, 2),
                            lb_mode    = "連続表示,カーソル移動"
                        });
                    }
                    else
                    {
                        i = GUI.ListBox(new ListBoxArgs
                        {
                            Items      = listItems,
                            HasFlag    = false,
                            lb_caption = "パイロット選択",
                            lb_info    = "パイロット       " + Expression.Term("SP", SelectedUnit, 2) + "/Max" + Expression.Term("SP", SelectedUnit, 2),
                            lb_mode    = "連続表示,カーソル移動"
                        });
                    }
                }
                else
                {
                    // 一人しかいないので選択の必要なし
                    i = 1;
                }

                // 誰もスペシャルパワーを使えなければキャンセル
                if (i == 0)
                {
                    GUI.CloseListBox();
                    if (SRC.AutoMoveCursor)
                    {
                        GUI.RestoreCursorPos();
                    }

                    GUI.UnlockGUI();
                    CancelCommand();
                    return;
                }

                // スペシャルパワーを使うパイロットを設定
                SelectedPilot = pilots[i - 1];
                // そのパイロットのステータスを表示
                if (pilots.Count > 1)
                {
                    Status.DisplayPilotStatus(SelectedPilot);
                }
            }

            {
                var p = SelectedPilot;
                // 使用可能なスペシャルパワーの一覧を作成
                var spList = p.SpecialPowerNames.Select(sname =>
                {
                    var cost = p.SpecialPowerCost(sname);
                    var spd  = SRC.SPDList.Item(sname);

                    return(new ListBoxItem
                    {
                        Text = GeneralLib.RightPaddedString(sname, 13) + GeneralLib.LeftPaddedString("" + cost, 3) + " " + spd.Comment,
                        ListItemFlag = p.SP < cost || !p.IsSpecialPowerUseful(sname),
                    });
                }).ToList();

                // どのコマンドを使用するかを選択
                GUI.TopItem = 1;
                var i = GUI.ListBox(new ListBoxArgs
                {
                    Items      = spList,
                    HasFlag    = true,
                    lb_caption = Expression.Term("スペシャルパワー", SelectedUnit) + "選択",
                    lb_info    = "名称         消費" + Expression.Term("SP", SelectedUnit) + "(" + p.get_Nickname(false) + " " + Expression.Term("SP", SelectedUnit) + "=" + SrcFormatter.Format(p.SP) + "/" + SrcFormatter.Format(p.MaxSP) + ")",
                    lb_mode    = "カーソル移動(行きのみ)"
                });
                // キャンセル
                if (i == 0)
                {
                    Status.DisplayUnitStatus(SelectedUnit);
                    // カーソル自動移動
                    if (SRC.AutoMoveCursor)
                    {
                        GUI.MoveCursorPos("ユニット選択", SelectedUnit);
                    }

                    GUI.UnlockGUI();
                    CancelCommand();
                    return;
                }

                // 使用するスペシャルパワーを設定
                SelectedSpecialPower = SelectedPilot.get_SpecialPower(i);
            }

            // 味方スペシャルパワー実行の効果により他のパイロットが持っているスペシャルパワーを
            // 使う場合は記録しておき、後で消費SPを倍にする必要がある
            // TODO Impl 夢
            //if (SRC.SPDList.Item(SelectedSpecialPower).EffectType(1) == "味方スペシャルパワー実行")
            if (false)
            {
                //// スペシャルパワー一覧
                //list = new string[1];
                //var loopTo6 = SRC.SPDList.Count();
                //for (i = 1; i <= loopTo6; i++)
                //{
                //    {
                //        var withBlock5 = SRC.SPDList.Item(i);
                //        if (withBlock5.EffectType(1) != "味方スペシャルパワー実行" && withBlock5.intName != "非表示")
                //        {
                //            Array.Resize(list, Information.UBound(list) + 1 + 1);
                //            Array.Resize(strkey_list, Information.UBound(list) + 1);
                //            list[Information.UBound(list)] = withBlock5.Name;
                //            strkey_list[Information.UBound(list)] = withBlock5.KanaName;
                //        }
                //    }
                //}

                //GUI.ListItemFlag = new bool[Information.UBound(list) + 1];

                //// ソート
                //var loopTo7 = (Information.UBound(strkey_list) - 1);
                //for (i = 1; i <= loopTo7; i++)
                //{
                //    max_item = i;
                //    max_str = strkey_list[i];
                //    var loopTo8 = Information.UBound(strkey_list);
                //    for (j = (i + 1); j <= loopTo8; j++)
                //    {
                //        if (Strings.StrComp(strkey_list[j], max_str, (CompareMethod)1) == -1)
                //        {
                //            max_item = j;
                //            max_str = strkey_list[j];
                //        }
                //    }

                //    if (max_item != i)
                //    {
                //        buf = list[i];
                //        list[i] = list[max_item];
                //        list[max_item] = buf;
                //        buf = strkey_list[i];
                //        strkey_list[i] = max_str;
                //        strkey_list[max_item] = buf;
                //    }
                //}

                //// スペシャルパワーを使用可能なパイロットがいるかどうかを判定
                //var loopTo9 = Information.UBound(list);
                //for (i = 1; i <= loopTo9; i++)
                //{
                //    GUI.ListItemFlag[i] = true;
                //    foreach (Pilot currentP in SRC.PList)
                //    {
                //        p = currentP;
                //        if (p.Party == "味方")
                //        {
                //            if (p.Unit is object)
                //            {
                //                if (p.Unit.Status == "出撃" && !p.Unit.IsConditionSatisfied("憑依"))
                //                {
                //                    // 本当に乗っている?
                //                    found = false;
                //                    {
                //                        var withBlock6 = p.Unit;
                //                        if (ReferenceEquals(p, withBlock6.MainPilot()))
                //                        {
                //                            found = true;
                //                        }
                //                        else
                //                        {
                //                            var loopTo10 = withBlock6.CountPilot();
                //                            for (j = 2; j <= loopTo10; j++)
                //                            {
                //                                Pilot localPilot1() { object argIndex1 = j; var ret = withBlock6.Pilot(argIndex1); return ret; }

                //                                if (ReferenceEquals(p, localPilot1()))
                //                                {
                //                                    found = true;
                //                                    break;
                //                                }
                //                            }

                //                            var loopTo11 = withBlock6.CountSupport();
                //                            for (j = 1; j <= loopTo11; j++)
                //                            {
                //                                Pilot localSupport() { object argIndex1 = j; var ret = withBlock6.Support(argIndex1); return ret; }

                //                                if (ReferenceEquals(p, localSupport()))
                //                                {
                //                                    found = true;
                //                                    break;
                //                                }
                //                            }

                //                            if (ReferenceEquals(p, withBlock6.AdditionalSupport()))
                //                            {
                //                                found = true;
                //                            }
                //                        }
                //                    }

                //                    if (found)
                //                    {
                //                        if (p.IsSpecialPowerAvailable(list[i]))
                //                        {
                //                            GUI.ListItemFlag[i] = false;
                //                            break;
                //                        }
                //                    }
                //                }
                //            }
                //        }
                //    }
                //}

                //// 各スペシャルパワーが使用可能か判定
                //{
                //    var withBlock7 = SelectedPilot;
                //    var loopTo12 = Information.UBound(list);
                //    for (i = 1; i <= loopTo12; i++)
                //    {
                //        if (!GUI.ListItemFlag[i] && withBlock7.SP >= 2 * withBlock7.SpecialPowerCost(list[i]))
                //        {
                //            if (!withBlock7.IsSpecialPowerUseful(list[i]))
                //            {
                //                GUI.ListItemFlag[i] = true;
                //            }
                //        }
                //        else
                //        {
                //            GUI.ListItemFlag[i] = true;
                //        }
                //    }
                //}

                //// スペシャルパワーの解説を設定
                //GUI.ListItemComment = new string[Information.UBound(list) + 1];
                //var loopTo13 = Information.UBound(list);
                //for (i = 1; i <= loopTo13; i++)
                //{
                //    SpecialPowerData localItem4() { var tmp = list; object argIndex1 = tmp[i]; var ret = SRC.SPDList.Item(argIndex1); return ret; }

                //    GUI.ListItemComment[i] = localItem4().Comment;
                //}

                //// 検索するスペシャルパワーを選択
                //GUI.TopItem = 1;
                //ret = GUI.MultiColumnListBox(Expression.Term(argtname7, u: argu) + "検索", list, true);
                //if (ret == 0)
                //{
                //    SelectedSpecialPower = "";
                //    CancelCommand();
                //    GUI.UnlockGUI();
                //    return;
                //}

                //// スペシャルパワー使用メッセージ
                //if (SelectedUnit.IsMessageDefined(SelectedSpecialPower))
                //{
                //    GUI.OpenMessageForm(u1: null1, u2: null2);
                //    SelectedUnit.PilotMessage(SelectedSpecialPower, msg_mode: "");
                //    GUI.CloseMessageForm();
                //}

                //SelectedSpecialPower = list[ret];
                //WithDoubleSPConsumption = true;
            }
            else
            {
                WithDoubleSPConsumption = false;
            }

            var sd = SRC.SPDList.Item(SelectedSpecialPower);

            // ターゲットを選択する必要があるスペシャルパワーの場合
            switch (sd.TargetType ?? "")
            {
            case "味方":
            case "敵":
            case "任意":
            {
                // マップ上のユニットからターゲットを選択する
                GUI.OpenMessageForm(null, null);
                GUI.DisplaySysMessage(SelectedPilot.get_Nickname(false) + "は" + SelectedSpecialPower + "を使った。;" + "ターゲットを選んでください。");
                GUI.CloseMessageForm();

                // ターゲットのエリアを設定
                for (var i = 1; i <= Map.MapWidth; i++)
                {
                    for (var j = 1; j <= Map.MapHeight; j++)
                    {
                        Map.MaskData[i, j] = true;
                        var u = Map.MapDataForUnit[i, j];
                        if (u is null)
                        {
                            goto NextLoop;
                        }

                        // 陣営が合っている?
                        switch (sd.TargetType ?? "")
                        {
                        case "味方":
                        {
                            {
                                var withBlock8 = u;
                                if (withBlock8.Party != "味方" && withBlock8.Party0 != "味方" && withBlock8.Party != "NPC" && withBlock8.Party0 != "NPC")
                                {
                                    goto NextLoop;
                                }
                            }

                            break;
                        }

                        case "敵":
                        {
                            {
                                var withBlock9 = u;
                                if (withBlock9.Party == "味方" && withBlock9.Party0 == "味方" || withBlock9.Party == "NPC" && withBlock9.Party0 == "NPC")
                                {
                                    goto NextLoop;
                                }
                            }

                            break;
                        }
                        }

                        // スペシャルパワーを適用可能?
                        if (!sd.Effective(SelectedPilot, u))
                        {
                            goto NextLoop;
                        }

                        Map.MaskData[i, j] = false;
NextLoop:
                        ;
                    }
                }

                GUI.MaskScreen();
                CommandState = "ターゲット選択";
                GUI.UnlockGUI();
                return;
            }

            case "破壊味方":
            {
                // 破壊された味方ユニットの中からターゲットを選択する
                GUI.OpenMessageForm(null, null);
                GUI.DisplaySysMessage(SelectedPilot.get_Nickname(false) + "は" + SelectedSpecialPower + "を使った。;" + "復活させるユニットを選んでください。");
                GUI.CloseMessageForm();

                // 破壊された味方ユニットのリストを作成
                var units = SRC.UList.Items
                            .Where(u => u.Party0 == "味方" && u.Status == "破壊" && (u.CountPilot() > 0 || u.Data.PilotNum == 0))
                            .Select(u => new ListBoxItem
                    {
                        Text = GeneralLib.RightPaddedString(u.Nickname, 28)
                               + GeneralLib.RightPaddedString(u.MainPilot().get_Nickname(false), 18)
                               + GeneralLib.LeftPaddedString(SrcFormatter.Format(u.MainPilot().Level), 3),
                        ListItemID = u.ID,
                    }).ToList();

                GUI.TopItem = 1;
                var ret = GUI.ListBox(new ListBoxArgs
                    {
                        Items      = units,
                        lb_caption = "ユニット選択",
                        lb_info    = "ユニット名                  パイロット     レベル",
                        lb_mode    = "",
                    });

                if (ret == 0)
                {
                    GUI.UnlockGUI();
                    CancelCommand();
                    return;
                }

                SelectedTarget = SRC.UList.Item(units[ret - 1].ListItemID);
                break;
            }
            }

            // 自爆を選択した場合は確認を取る
            if (sd.IsEffectAvailable("自爆"))
            {
                var ret = GUI.Confirm("自爆させますか?", "自爆", GuiConfirmOption.OkCancel | GuiConfirmOption.Question);
                if (ret == GuiDialogResult.Ok)
                {
                    GUI.UnlockGUI();
                    return;
                }
            }

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

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

            // スペシャルパワーを使用
            if (WithDoubleSPConsumption)
            {
                SelectedPilot.UseSpecialPower(SelectedSpecialPower, 2d);
            }
            else
            {
                SelectedPilot.UseSpecialPower(SelectedSpecialPower);
            }

            SelectedUnit = SelectedUnit.CurrentForm();

            // カーソル自動移動
            if (SRC.AutoMoveCursor)
            {
                GUI.MoveCursorPos("ユニット選択", SelectedUnit);
            }

            // ステータスウィンドウを更新
            Status.DisplayUnitStatus(SelectedUnit);

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

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

            SelectedSpecialPower = "";
            GUI.UnlockGUI();
            CommandState = "ユニット選択";
        }
Beispiel #16
0
        // ユニット u に乗ることができるかどうか
        public bool IsAbleToRide(Unit u)
        {
            // 汎用ユニットは必要技能を満たせばOK
            if (u.Class == "汎用")
            {
                goto CheckNecessarySkill;
            }

            // 人間ユニット指定を除いて判定
            string uclass;

            if (Strings.Left(u.Class, 1) == "(" && Strings.Right(u.Class, 1) == ")")
            {
                uclass = Strings.Mid(u.Class, 2, Strings.Len(u.Class) - 2);
            }
            else
            {
                uclass = u.Class;
            }

            // サポートかどうかをまず判定しておく
            if (IsSupport(u))
            {
                // 必要技能をチェックする
                goto CheckNecessarySkill;
            }

            // ユニットクラスは複数設定可能
            foreach (var pclass in GeneralLib.ToL(Class))
            {
                if (uclass == pclass ||
                    uclass == (pclass + "(" + get_Nickname(false) + "専用)") ||
                    uclass == (pclass + "(" + Name + "専用)") ||
                    uclass == (pclass + "(" + Sex + "専用)"))
                {
                    // 必要技能をチェックする
                    goto CheckNecessarySkill;
                }
            }

            // クラスが合わない
            return(false);

CheckNecessarySkill:
            ;


            // 必要技能&不必要技能をチェック

            // 両能力を持っていない場合はチェック不要
            if (!u.IsFeatureAvailable("必要技能") && !u.IsFeatureAvailable("不必要技能"))
            {
                return(true);
            }

            foreach (var fd in u.Features.Where(fd => fd.Name == "必要技能"))
            {
                if (!u.IsNecessarySkillSatisfied(fd.Data, this))
                {
                    return(false);
                }
            }
            foreach (var fd in u.Features.Where(fd => fd.Name == "不必要技能"))
            {
                if (u.IsNecessarySkillSatisfied(fd.Data, this))
                {
                    return(false);
                }
            }
            return(true);
        }
Beispiel #17
0
        // メッセージデータをファイルからロード
        public void Load(ref string fname)
        {
            short       FileNumber;
            short       ret;
            int         line_num;
            var         line_buf = default(string);
            MessageData md;
            var         is_effect = default(bool);
            string      sname, msg;
            string      data_name;
            string      err_msg;

            // 特殊効果データor戦闘アニメデータか?
            if (Strings.InStr(Strings.LCase(fname), "effect.txt") > 0 | Strings.InStr(Strings.LCase(fname), "animation.txt") > 0)
            {
                is_effect = true;
            }
            ;
#error Cannot convert OnErrorGoToStatementSyntax - see comment for details

            /* Cannot convert OnErrorGoToStatementSyntax, CONVERSION ERROR: Conversion for OnErrorGoToLabelStatement not implemented, please report this issue in 'On Error GoTo ErrorHandler' at character 2904
             *
             *
             * Input:
             *
             *      On Error GoTo ErrorHandler
             *
             */
            FileNumber = (short)FileSystem.FreeFile();
            FileSystem.FileOpen(FileNumber, fname, OpenMode.Input, OpenAccess.Read);
            line_num = 0;
            while (true)
            {
                data_name = "";
                do
                {
                    if (FileSystem.EOF((int)FileNumber))
                    {
                        FileSystem.FileClose((int)FileNumber);
                        return;
                    }

                    GeneralLib.GetLine(ref FileNumber, ref line_buf, ref line_num);
                }while (Strings.Len(line_buf) == 0);
                if (Strings.InStr(line_buf, ",") > 0)
                {
                    err_msg = "名称の設定が抜けています。";
                    ;
#error Cannot convert ErrorStatementSyntax - see comment for details

                    /* Cannot convert ErrorStatementSyntax, CONVERSION ERROR: Conversion for ErrorStatement not implemented, please report this issue in 'Error(0)' at character 3656
                     *
                     *
                     * Input:
                     *              Error(0)
                     *
                     */
                }

                data_name = line_buf;
                if (Strings.InStr(data_name, " ") > 0)
                {
                    err_msg = "名称に半角スペースは使用出来ません。";
                    ;
#error Cannot convert ErrorStatementSyntax - see comment for details

                    /* Cannot convert ErrorStatementSyntax, CONVERSION ERROR: Conversion for ErrorStatement not implemented, please report this issue in 'Error(0)' at character 3827
                     *
                     *
                     * Input:
                     *              Error(0)
                     *
                     */
                }

                if (Strings.InStr(data_name, "(") > 0 | Strings.InStr(data_name, ")") > 0)
                {
                    err_msg = "名称に全角括弧は使用出来ません。";
                    ;
#error Cannot convert ErrorStatementSyntax - see comment for details

                    /* Cannot convert ErrorStatementSyntax, CONVERSION ERROR: Conversion for ErrorStatement not implemented, please report this issue in 'Error(0)' at character 4027
                     *
                     *
                     * Input:
                     *              Error(0)
                     *
                     */
                }

                if (Strings.InStr(data_name, "\"") > 0)
                {
                    err_msg = "名称に\"は使用出来ません。";
                    ;
#error Cannot convert ErrorStatementSyntax - see comment for details

                    /* Cannot convert ErrorStatementSyntax, CONVERSION ERROR: Conversion for ErrorStatement not implemented, please report this issue in 'Error(0)' at character 4160
                     *
                     *
                     * Input:
                     *              Error(0)
                     *
                     */
                }

                // 重複して定義されたデータの場合
                object argIndex3 = (object)data_name;
                if (IsDefined(ref argIndex3))
                {
                    if (!is_effect)
                    {
                        // パイロットメッセージの場合は後から定義されたものを優先
                        object argIndex1 = (object)data_name;
                        Delete(ref argIndex1);
                        md = Add(ref data_name);
                    }
                    else
                    {
                        // 特殊効果データの場合は既存のものに追加
                        object argIndex2 = (object)data_name;
                        md = Item(ref argIndex2);
                    }
                }
                else
                {
                    md = Add(ref data_name);
                }

                GeneralLib.GetLine(ref FileNumber, ref line_buf, ref line_num);
                while (Strings.Len(line_buf) > 0)
                {
                    ret = (short)Strings.InStr(line_buf, ",");
                    if ((int)ret < 2)
                    {
                        ;
#error Cannot convert ErrorStatementSyntax - see comment for details

                        /* Cannot convert ErrorStatementSyntax, CONVERSION ERROR: Conversion for ErrorStatement not implemented, please report this issue in 'Error(0)' at character 4751
                         *
                         *
                         * Input:
                         *                      Error(0)
                         *
                         */
                    }

                    sname = Strings.Left(line_buf, (int)ret - 1);
                    msg   = Strings.Trim(Strings.Mid(line_buf, (int)ret + 1));
                    if (Strings.Len(sname) == 0)
                    {
                        err_msg = "シチュエーションの指定が抜けています。";
                        ;
#error Cannot convert ErrorStatementSyntax - see comment for details

                        /* Cannot convert ErrorStatementSyntax, CONVERSION ERROR: Conversion for ErrorStatement not implemented, please report this issue in 'Error(0)' at character 5091
                         *
                         *
                         * Input:
                         *                      Error(0)
                         *
                         */
                    }

                    md.AddMessage(ref sname, ref msg);
                    if (FileSystem.EOF((int)FileNumber))
                    {
                        FileSystem.FileClose((int)FileNumber);
                        return;
                    }

                    GeneralLib.GetLine(ref FileNumber, ref line_buf, ref line_num);
                }
            }

ErrorHandler:
            ;

            // エラー処理
            if (line_num == 0)
            {
                string argmsg = fname + "が開けません。";
                GUI.ErrorMessage(ref argmsg);
            }
            else
            {
                FileSystem.FileClose((int)FileNumber);
                string argmsg1 = "";
                GUI.DataErrorMessage(ref argmsg1, ref fname, (short)line_num, ref line_buf, ref data_name);
            }

            SRC.TerminateSRC();
        }
Beispiel #18
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);
                            }
                        }
                    }
                }
            }
        }
Beispiel #19
0
        protected override int ExecInternal()
        {
            if (ArgNum == 1)
            {
                throw new EventErrorException(this, "Printコマンドの引数の数が違います");
            }

            // TODO ファイル出力例外処理
            var f   = SRC.FileHandleManager.Get(GetArgAsLong(2));
            var msg = GeneralLib.ListTail(EventData.Data, 3);

            if (Strings.Right(msg, 1) != ";")
            {
                if (Strings.Left(msg, 1) != "`" || Strings.Right(msg, 1) != "`")
                {
                    if (Strings.Left(msg, 2) == "$(")
                    {
                        if (Strings.Right(msg, 1) == ")")
                        {
                            msg = Expression.GetValueAsString(Strings.Mid(msg, 3, Strings.Len(msg) - 3));
                        }
                    }
                    else if (GeneralLib.ListLength(msg) == 1)
                    {
                        msg = Expression.GetValueAsString(msg);
                    }

                    Expression.ReplaceSubExpression(ref msg);
                }
                else
                {
                    msg = Strings.Mid(msg, 2, Strings.Len(msg) - 2);
                }

                f.Writer.WriteLine(msg);
            }
            else
            {
                msg = Strings.Left(msg, Strings.Len(msg) - 1);
                if (Strings.Left(msg, 1) != "`" || Strings.Right(msg, 1) != "`")
                {
                    if (Strings.Left(msg, 2) == "$(")
                    {
                        if (Strings.Right(msg, 1) == ")")
                        {
                            msg = Expression.GetValueAsString(Strings.Mid(msg, 3, Strings.Len(msg) - 3));
                        }
                    }
                    else if (GeneralLib.ListLength(msg) == 1)
                    {
                        msg = Expression.GetValueAsString(msg);
                    }

                    Expression.ReplaceSubExpression(ref msg);
                }
                else
                {
                    msg = Strings.Mid(msg, 2, Strings.Len(msg) - 2);
                }

                f.Writer.WriteLine(msg);
            }

            return(EventData.NextID);
        }
Beispiel #20
0
        // ユニット u のシチュエーション msg_situation におけるメッセージを選択
        public string SelectMessage(ref string msg_situation, [Optional, DefaultParameterValue(null)] ref Unit u)
        {
            string SelectMessageRet = default;

            string[] situations;
            string[] sub_situations;
            short[]  list0;
            short    list0_num;

            short[] tlist;
            short   tlist_num;

            short[] list;
            short   list_num;
            short   j, i, k;
            bool    found;
            var     t = default(Unit);
            short   w, tw;

            // 配列領域確保
            list0 = new short[301];
            tlist = new short[101];
            list  = new short[201];

            // シチュエーションを設定
            switch (msg_situation ?? "")
            {
            case "格闘":
            case "射撃":
            {
                situations    = new string[3];
                situations[2] = "攻撃";
                break;
            }

            case "格闘(命中)":
            case "射撃(命中)":
            {
                situations    = new string[3];
                situations[2] = "攻撃(命中)";
                break;
            }

            case "格闘(回避)":
            case "射撃(回避)":
            {
                situations    = new string[3];
                situations[2] = "攻撃(回避)";
                break;
            }

            case "格闘(とどめ)":
            case "射撃(とどめ)":
            {
                situations    = new string[3];
                situations[2] = "攻撃(とどめ)";
                break;
            }

            case "格闘(クリティカル)":
            case "射撃(クリティカル)":
            {
                situations    = new string[3];
                situations[2] = "攻撃(クリティカル)";
                break;
            }

            case "格闘(反撃)":
            case "射撃(反撃)":
            {
                situations    = new string[3];
                situations[2] = "攻撃(反撃)";
                break;
            }

            case "格闘(命中)(反撃)":
            case "射撃(命中)(反撃)":
            {
                situations    = new string[3];
                situations[2] = "攻撃(命中)(反撃)";
                break;
            }

            case "格闘(回避)(反撃)":
            case "射撃(回避)(反撃)":
            {
                situations    = new string[3];
                situations[2] = "攻撃(回避)(反撃)";
                break;
            }

            case "格闘(とどめ)(反撃)":
            case "射撃(とどめ)(反撃)":
            {
                situations    = new string[3];
                situations[2] = "攻撃(とどめ)(反撃)";
                break;
            }

            case "格闘(クリティカル)(反撃)":
            case "射撃(クリティカル)(反撃)":
            {
                situations    = new string[3];
                situations[2] = "攻撃(クリティカル)(反撃)";
                break;
            }

            default:
            {
                situations = new string[2];
                break;
            }
            }

            situations[1] = msg_situation;

            // メッセージの候補リスト第一次審査
            list0_num = 0;
            var loopTo = intMessageNum;

            for (i = 1; i <= loopTo; i++)
            {
                var loopTo1 = (short)Information.UBound(situations);
                for (j = 1; j <= loopTo1; j++)
                {
                    if ((Strings.Left(strSituation[i], Strings.Len(situations[j])) ?? "") == (situations[j] ?? ""))
                    {
                        list0_num = (short)(list0_num + 1);
                        if (list0_num > Information.UBound(list0))
                        {
                            Array.Resize(ref list0, list0_num + 1);
                        }

                        list0[list0_num] = i;
                        break;
                    }
                }
            }

            if (list0_num == 0)
            {
                return(SelectMessageRet);
            }

            // 最初に相手限定のシチュエーションのみで検索
            if (u is null)
            {
                goto SkipMessagesWithTarget;
            }

            if (ReferenceEquals(u, Commands.SelectedUnit))
            {
                t = Commands.SelectedTarget;
            }
            else if (ReferenceEquals(u, Commands.SelectedTarget))
            {
                t = Commands.SelectedUnit;
            }

            if (t is null)
            {
                goto SkipMessagesWithTarget;
            }

            // 相手限定メッセージのリストを作成
            tlist_num = 0;
            var loopTo2 = list0_num;

            for (i = 1; i <= loopTo2; i++)
            {
                if (Strings.InStr(strSituation[list0[i]], "(対") > 0)
                {
                    tlist_num = (short)(tlist_num + 1);
                    if (tlist_num > Information.UBound(tlist))
                    {
                        Array.Resize(ref tlist, tlist_num + 1);
                    }

                    tlist[tlist_num] = list0[i];
                }
            }

            if (tlist_num == 0)
            {
                // 相手限定メッセージがない
                goto SkipMessagesWithTarget;
            }

            // 自分自身にアビリティを使う場合は必ず「(対自分)」を優先
            if (ReferenceEquals(t, u))
            {
                list_num = 0;
                var loopTo3 = tlist_num;
                for (i = 1; i <= loopTo3; i++)
                {
                    var loopTo4 = (short)Information.UBound(situations);
                    for (j = 1; j <= loopTo4; j++)
                    {
                        if ((strSituation[tlist[i]] ?? "") == (situations[j] + "(対自分)" ?? ""))
                        {
                            list_num = (short)(list_num + 1);
                            if (list_num > Information.UBound(list))
                            {
                                Array.Resize(ref list, list_num + 1);
                            }

                            list[list_num] = tlist[i];
                            break;
                        }
                    }
                }

                if (list_num > 0)
                {
                    SelectMessageRet = strMessage[list[GeneralLib.Dice(list_num)]];
                    return(SelectMessageRet);
                }
            }

            string wclass, ch;

            {
                var withBlock = t;
                if (withBlock.Status != "出撃")
                {
                    goto SkipMessagesWithTarget;
                }

                sub_situations = new string[9];
                // 対パイロット名称
                sub_situations[1] = "(対" + withBlock.MainPilot().Name + ")";
                // 対パイロット愛称
                sub_situations[2] = "(対" + withBlock.MainPilot().get_Nickname(false) + ")";
                // 対ユニット名称
                sub_situations[3] = "(対" + withBlock.Name + ")";
                // 対ユニット愛称
                sub_situations[4] = "(対" + withBlock.Nickname + ")";
                // 対ユニットクラス
                sub_situations[5] = "(対" + withBlock.Class0 + ")";
                // 対ユニットサイズ
                sub_situations[6] = "(対" + withBlock.Size + ")";
                // 対地形名
                sub_situations[7] = "(対" + Map.TerrainName(withBlock.x, withBlock.y) + ")";
                // 対エリア
                sub_situations[8] = "(対" + withBlock.Area + ")";

                // 対メッセージクラス
                string argfname = "メッセージクラス";
                if (withBlock.IsFeatureAvailable(ref argfname))
                {
                    Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                    object argIndex1 = "メッセージクラス";
                    sub_situations[Information.UBound(sub_situations)] = "(対" + withBlock.FeatureData(ref argIndex1) + ")";
                }

                // 対性別
                switch (withBlock.MainPilot().Sex ?? "")
                {
                case "男性":
                {
                    Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                    sub_situations[Information.UBound(sub_situations)] = "(対男性)";
                    break;
                }

                case "女性":
                {
                    Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                    sub_situations[Information.UBound(sub_situations)] = "(対女性)";
                    break;
                }
                }

                // 対特殊能力
                {
                    var withBlock1 = withBlock.MainPilot();
                    var loopTo5    = withBlock1.CountSkill();
                    for (i = 1; i <= loopTo5; i++)
                    {
                        Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                        string localSkillName0()
                        {
                            object argIndex1 = i; var ret = withBlock1.SkillName0(ref argIndex1); return(ret);
                        }

                        sub_situations[Information.UBound(sub_situations)] = "(対" + localSkillName0() + ")";
                        if (sub_situations[Information.UBound(sub_situations)] == "(対非表示)")
                        {
                            string localSkill()
                            {
                                object argIndex1 = i; var ret = withBlock1.Skill(ref argIndex1); return(ret);
                            }

                            sub_situations[Information.UBound(sub_situations)] = "(対" + localSkill() + ")";
                        }
                    }
                }

                var loopTo6 = withBlock.CountFeature();
                for (i = 1; i <= loopTo6; i++)
                {
                    Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                    string localFeatureName0()
                    {
                        object argIndex1 = i; var ret = withBlock.FeatureName0(ref argIndex1); return(ret);
                    }

                    sub_situations[Information.UBound(sub_situations)] = "(対" + localFeatureName0() + ")";
                    if (sub_situations[Information.UBound(sub_situations)] == "(対)")
                    {
                        string localFeature()
                        {
                            object argIndex1 = i; var ret = withBlock.Feature(ref argIndex1); return(ret);
                        }

                        sub_situations[Information.UBound(sub_situations)] = "(対" + localFeature() + ")";
                    }
                }

                // 対弱点
                if (Strings.Len(withBlock.strWeakness) > 0)
                {
                    var loopTo7 = (short)Strings.Len(withBlock.strWeakness);
                    for (i = 1; i <= loopTo7; i++)
                    {
                        Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                        sub_situations[Information.UBound(sub_situations)] = "(対弱点=" + GeneralLib.GetClassBundle(ref withBlock.strWeakness, ref i) + ")";
                    }
                }

                // 対有効
                if (Strings.Len(withBlock.strEffective) > 0)
                {
                    var loopTo8 = (short)Strings.Len(withBlock.strEffective);
                    for (i = 1; i <= loopTo8; i++)
                    {
                        Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                        sub_situations[Information.UBound(sub_situations)] = "(対有効=" + GeneralLib.GetClassBundle(ref withBlock.strEffective, ref i) + ")";
                    }
                }

                // 対ザコ
                if (Strings.InStr(withBlock.MainPilot().Name, "(ザコ)") > 0 & (u.MainPilot().Technique > withBlock.MainPilot().Technique | u.HP > withBlock.HP / 2))
                {
                    Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                    sub_situations[Information.UBound(sub_situations)] = "(対ザコ)";
                }

                // 対強敵
                if (withBlock.BossRank >= 0 | Strings.InStr(withBlock.MainPilot().Name, "(ザコ)") == 0 & u.MainPilot().Technique <= withBlock.MainPilot().Technique)
                {
                    Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                    sub_situations[Information.UBound(sub_situations)] = "(対強敵)";
                }

                // 自分が使用する武器をチェック
                w = 0;
                if (ReferenceEquals(Commands.SelectedUnit, u))
                {
                    if (0 < Commands.SelectedWeapon & Commands.SelectedWeapon <= u.CountWeapon())
                    {
                        w = Commands.SelectedWeapon;
                    }
                }
                else if (ReferenceEquals(Commands.SelectedTarget, u))
                {
                    if (0 < Commands.SelectedTWeapon & Commands.SelectedTWeapon <= u.CountWeapon())
                    {
                        w = Commands.SelectedTWeapon;
                    }
                }

                if (w > 0)
                {
                    // 対瀕死
                    if (withBlock.HP <= u.Damage(w, ref t, u.Party == "味方"))
                    {
                        Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                        sub_situations[Information.UBound(sub_situations)] = "(対瀕死)";
                    }

                    switch (u.HitProbability(w, ref t, u.Party == "味方"))
                    {
                    case var @case when @case < 50:
                    {
                        // 対高回避率
                        Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                        sub_situations[Information.UBound(sub_situations)] = "(対高回避率)";
                        break;
                    }

                    case var case1 when case1 >= 100:
                    {
                        // 対低回避率
                        Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                        sub_situations[Information.UBound(sub_situations)] = "(対低回避率)";
                        break;
                    }
                    }
                }

                // 相手が使用する武器をチェック
                tw = 0;
                if (ReferenceEquals(Commands.SelectedUnit, t))
                {
                    if (0 < Commands.SelectedWeapon & Commands.SelectedWeapon <= withBlock.CountWeapon())
                    {
                        tw = Commands.SelectedWeapon;
                    }
                }
                else if (ReferenceEquals(Commands.SelectedTarget, t))
                {
                    if (0 < Commands.SelectedTWeapon & Commands.SelectedTWeapon <= withBlock.CountWeapon())
                    {
                        tw = Commands.SelectedTWeapon;
                    }
                }

                if (tw > 0)
                {
                    // 対武器名
                    Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                    sub_situations[Information.UBound(sub_situations)] = "(対" + withBlock.Weapon(tw).Name + ")";

                    // 対武器属性
                    wclass = withBlock.WeaponClass(tw);
                    var loopTo9 = (short)Strings.Len(wclass);
                    for (i = 1; i <= loopTo9; i++)
                    {
                        ch = GeneralLib.GetClassBundle(ref wclass, ref i);
                        switch (ch ?? "")
                        {
                        case var case2 when 0.ToString() <= case2 && case2 <= 127.ToString():
                        {
                            break;
                        }

                        default:
                        {
                            Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                            sub_situations[Information.UBound(sub_situations)] = "(対" + ch + "属性)";
                            break;
                        }
                        }
                    }

                    switch (withBlock.HitProbability(tw, ref u, withBlock.Party == "味方"))
                    {
                    case var case3 when case3 > 75:
                    {
                        // 対高命中率
                        Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                        sub_situations[Information.UBound(sub_situations)] = "(対高命中率)";
                        break;
                    }

                    case var case4 when case4 < 25:
                    {
                        // 対低命中率
                        Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                        sub_situations[Information.UBound(sub_situations)] = "(対低命中率)";
                        break;
                    }
                    }
                }
            }

            // 定義されている相手限定メッセージのうち、状況に合ったメッセージを抜き出す
            list_num = 0;
            var loopTo10 = tlist_num;

            for (i = 1; i <= loopTo10; i++)
            {
                found = false;
                var loopTo11 = (short)Information.UBound(situations);
                for (j = 1; j <= loopTo11; j++)
                {
                    var loopTo12 = (short)Information.UBound(sub_situations);
                    for (k = 1; k <= loopTo12; k++)
                    {
                        if ((strSituation[tlist[i]] ?? "") == (situations[j] + sub_situations[k] ?? ""))
                        {
                            found = true;
                            break;
                        }
                    }

                    if (found)
                    {
                        break;
                    }
                }

                if (found)
                {
                    list_num = (short)(list_num + 1);
                    if (list_num > Information.UBound(list))
                    {
                        Array.Resize(ref list, list_num + 1);
                    }

                    list[list_num] = tlist[i];
                }
            }

            // 状況に合った相手限定メッセージが一つでもあれば、その中からメッセージを選択
            if (list_num > 0)
            {
                SelectMessageRet = strMessage[list[GeneralLib.Dice(list_num)]];
                if (GeneralLib.Dice(2) == 1 | Strings.InStr(msg_situation, "(とどめ)") > 0 | msg_situation == "挑発" | msg_situation == "脱力" | msg_situation == "魅惑" | msg_situation == "威圧" | (u.Party ?? "") == (t.Party ?? ""))
                {
                    return(SelectMessageRet);
                }
            }

SkipMessagesWithTarget:
            ;


            // 次にサブシチュエーションなしとユニット限定のサブシチュエーションで検索
            if (u is object)
            {
                sub_situations    = new string[4];
                sub_situations[1] = "(" + u.Name + ")";
                sub_situations[2] = "(" + u.Nickname0 + ")";
                sub_situations[3] = "(" + u.Class0 + ")";
                switch (msg_situation ?? "")
                {
                case "格闘":
                case "射撃":
                case "格闘(反撃)":
                case "射撃(反撃)":
                {
                    if (ReferenceEquals(Commands.SelectedUnit, u))
                    {
                        // 自分が使用する武器をチェック
                        if (0 < Commands.SelectedWeapon & Commands.SelectedWeapon <= u.CountWeapon())
                        {
                            Array.Resize(ref sub_situations, 5);
                            sub_situations[4] = "(" + u.WeaponNickname(Commands.SelectedWeapon) + ")";
                        }
                    }

                    break;
                }
                }

                string argfname1 = "メッセージクラス";
                if (u.IsFeatureAvailable(ref argfname1))
                {
                    Array.Resize(ref sub_situations, Information.UBound(sub_situations) + 1 + 1);
                    object argIndex2 = "メッセージクラス";
                    sub_situations[Information.UBound(sub_situations)] = "(" + u.FeatureData(ref argIndex2) + ")";
                }
            }
            else
            {
                sub_situations = new string[1];
            }

            // 上で見つかったメッセージリストの中からシチュエーションに合ったメッセージを抜き出す
            list_num = 0;
            var loopTo13 = list0_num;

            for (i = 1; i <= loopTo13; i++)
            {
                found = false;
                var loopTo14 = (short)Information.UBound(situations);
                for (j = 1; j <= loopTo14; j++)
                {
                    if ((strSituation[list0[i]] ?? "") == (situations[j] ?? ""))
                    {
                        found = true;
                        break;
                    }

                    var loopTo15 = (short)Information.UBound(sub_situations);
                    for (k = 1; k <= loopTo15; k++)
                    {
                        if ((strSituation[list0[i]] ?? "") == (situations[j] + sub_situations[k] ?? ""))
                        {
                            found = true;
                            break;
                        }
                    }

                    if (found)
                    {
                        break;
                    }
                }

                if (found)
                {
                    list_num = (short)(list_num + 1);
                    if (list_num > Information.UBound(list))
                    {
                        Array.Resize(ref list, list_num + 1);
                    }

                    list[list_num] = list0[i];
                }
            }

            // シチュエーションに合ったメッセージが見つかれば、その中からメッセージを選択
            if (list_num > 0)
            {
                SelectMessageRet = strMessage[list[GeneralLib.Dice(list_num)]];
            }

            return(SelectMessageRet);
        }
Beispiel #21
0
        // デフォルトの戦闘アニメデータを定義
        public void AddDefaultAnimation()
        {
            MessageData md;

            // アニメデータが用意されていない場合は Data\System\animation.txt を読み込む
            if (Count() == 0)
            {
                string argfname1 = SRC.AppPath + @"Data\System\animation.txt";
                if (GeneralLib.FileExists(ref argfname1))
                {
                    string argfname = SRC.AppPath + @"Data\System\animation.txt";
                    Load(ref argfname);
                }
            }

            object argIndex2 = "汎用";

            if (IsDefined(ref argIndex2))
            {
                object argIndex1 = "汎用";
                md = Item(ref argIndex1);
            }
            else
            {
                string argmname = "汎用";
                md = Add(ref argmname);
            }

            string arglname = "戦闘アニメ_回避発動";

            if (Event_Renamed.FindNormalLabel(ref arglname) > 0)
            {
                string argmsg_situation = "回避";
                Unit   argu             = null;
                if (string.IsNullOrEmpty(md.SelectMessage(ref argmsg_situation, u: ref argu)))
                {
                    string argsit = "回避";
                    string argmsg = "回避";
                    md.AddMessage(ref argsit, ref argmsg);
                }
            }

            string arglname1 = "戦闘アニメ_切り払い発動";

            if (Event_Renamed.FindNormalLabel(ref arglname1) > 0)
            {
                string argmsg_situation1 = "切り払い";
                Unit   argu1             = null;
                if (string.IsNullOrEmpty(md.SelectMessage(ref argmsg_situation1, u: ref argu1)))
                {
                    string argsit1 = "切り払い";
                    string argmsg1 = "切り払い";
                    md.AddMessage(ref argsit1, ref argmsg1);
                }
            }

            string arglname2 = "戦闘アニメ_迎撃発動";

            if (Event_Renamed.FindNormalLabel(ref arglname2) > 0)
            {
                string argmsg_situation2 = "迎撃";
                Unit   argu2             = null;
                if (string.IsNullOrEmpty(md.SelectMessage(ref argmsg_situation2, u: ref argu2)))
                {
                    string argsit2 = "迎撃";
                    string argmsg2 = "迎撃";
                    md.AddMessage(ref argsit2, ref argmsg2);
                }
            }

            string arglname3 = "戦闘アニメ_ダミー発動";

            if (Event_Renamed.FindNormalLabel(ref arglname3) > 0)
            {
                string argmsg_situation3 = "ダミー";
                Unit   argu3             = null;
                if (string.IsNullOrEmpty(md.SelectMessage(ref argmsg_situation3, u: ref argu3)))
                {
                    string argsit3 = "ダミー";
                    string argmsg3 = "ダミー";
                    md.AddMessage(ref argsit3, ref argmsg3);
                }
            }

            string arglname4 = "戦闘アニメ_修理装置発動";

            if (Event_Renamed.FindNormalLabel(ref arglname4) > 0)
            {
                string argmsg_situation4 = "修理";
                Unit   argu4             = null;
                if (string.IsNullOrEmpty(md.SelectMessage(ref argmsg_situation4, u: ref argu4)))
                {
                    string argsit4 = "修理";
                    string argmsg4 = "修理装置";
                    md.AddMessage(ref argsit4, ref argmsg4);
                }
            }

            string arglname5 = "戦闘アニメ_補給装置発動";

            if (Event_Renamed.FindNormalLabel(ref arglname5) > 0)
            {
                string argmsg_situation5 = "補給";
                Unit   argu5             = null;
                if (string.IsNullOrEmpty(md.SelectMessage(ref argmsg_situation5, u: ref argu5)))
                {
                    string argsit5 = "補給";
                    string argmsg5 = "補給装置";
                    md.AddMessage(ref argsit5, ref argmsg5);
                }
            }

            string arglname6 = "戦闘アニメ_終了発動";

            if (Event_Renamed.FindNormalLabel(ref arglname6) > 0)
            {
                string argmsg_situation6 = "終了";
                Unit   argu6             = null;
                if (string.IsNullOrEmpty(md.SelectMessage(ref argmsg_situation6, u: ref argu6)))
                {
                    string argsit6 = "終了";
                    string argmsg6 = "終了";
                    md.AddMessage(ref argsit6, ref argmsg6);
                }
            }
        }
Beispiel #22
0
        protected override int ExecInternal()
        {
            //            short unum;
            //            short ux, uy;
            //            var uclass = default(string);
            //            string buf, opt = default;
            //            short j, i, num;
            //            int tmp;
            //            int min_value;
            //            short max_item;
            //            int max_value;
            //            int[] lv_list;
            //            string[] list;
            //            short ret;
            //            bool without_refresh;
            //            bool without_animation;
            var opt = "";
            var num = ArgNum;

            for (var i = 5; i <= num; i++)
            {
                switch (GetArgAsString(i) ?? "")
                {
                case "密集":
                    opt = opt + " 出撃";
                    break;

                case "非同期":
                    opt = opt + " 非同期";
                    break;

                case "アニメ非表示":
                    opt = opt + " アニメ非表示";
                    break;
                }
            }
            if (Strings.InStr(opt, "出撃") <= 0)
            {
                opt = opt + " 部隊配置";
            }

            if (num < 4)
            {
                throw new EventErrorException(this, "Organizeコマンドの引数の数が違います");
            }

            var unum = GetArgAsLong(2);

            if (unum < 1)
            {
                throw new EventErrorException(this, "ユニット数が不正です");
            }

            var ux = GetArgAsLong(3);

            if (ux < 1)
            {
                ux = 1;
            }
            else if (ux > Map.MapWidth)
            {
                ux = Map.MapWidth;
            }

            var uy = GetArgAsLong(4);

            if (uy < 1)
            {
                uy = 1;
            }
            else if (uy > Map.MapHeight)
            {
                uy = Map.MapHeight;
            }

            var uclass = "";

            if (num < 5)
            {
                uclass = "全て";
            }
            else
            {
                var loopTo1 = num;
                for (var i = 5; i <= num; i++)
                {
                    uclass = uclass + " " + GetArgAsString(i);
                }
                uclass = Strings.Trim(uclass);
            }

Beginning:
            ;

            var units = SRC.UList.Items
                        .Where(u => !(u.Party0 != "味方" || u.Status != "待機" || u.CountPilot() == 0))
                        // パイロット数のチェック
                        .Where(u => !((u.Data.PilotNum == 1 || Math.Abs(u.Data.PilotNum) == 2) && u.CountPilot() < Math.Abs(u.Data.PilotNum) && !u.IsFeatureAvailable("1人乗り可能")))
                        .Where(u =>
            {
                var td = Map.Terrain(1, 1);
                switch (td.Class)
                {
                case "宇宙":
                case "月面":
                    if (u.get_Adaption(4) == 0)
                    {
                        return(false);
                    }

                    break;

                default:
                    // 宇宙専用ユニットは宇宙でしか活動できない
                    if (u.Transportation == "宇宙")
                    {
                        return(false);
                    }

                    // 空中マップか?
                    if (td.Name == "空" &&
                        Map.Terrain((Map.MapWidth / 2), (Map.MapHeight / 2)).Name == "空" &&
                        Map.Terrain(Map.MapWidth, Map.MapHeight).Name == "空")
                    {
                        if (!u.IsTransAvailable("空"))
                        {
                            return(false);
                        }
                    }

                    break;
                }
                return(true);
            })
                        .Where(u =>
            {
                switch (uclass)
                {
                case "全て":
                case "":
                    break;

                // 全てのユニット
                case "通常ユニット":
                    if (u.IsFeatureAvailable("母艦"))
                    {
                        return(false);
                    }
                    break;

                case "母艦ユニット":
                    if (!u.IsFeatureAvailable("母艦"))
                    {
                        return(false);
                    }
                    break;

                case "LL":
                    if (u.Size == "XL")
                    {
                        return(false);
                    }
                    break;

                case "L":
                    if (u.Size == "XL" || u.Size == "LL")
                    {
                        return(false);
                    }
                    break;

                case "M":
                    if (u.Size == "XL" || u.Size == "LL" || u.Size == "L")
                    {
                        return(false);
                    }
                    break;

                case "S":
                    if (u.Size == "XL" || u.Size == "LL" || u.Size == "L" || u.Size == "M")
                    {
                        return(false);
                    }
                    break;

                case "SS":
                    if (u.Size == "XL" || u.Size == "LL" || u.Size == "L" || u.Size == "M" || u.Size == "S")
                    {
                        return(false);
                    }
                    break;

                default:
                    // ユニットクラス指定した場合
                    // 指定されたクラスに該当するか
                    return(GeneralLib.ToL(uclass).Any(x => x == u.Class0));
                }
                return(true);
            })
                        .ToList();

            if (!units.Any())
            {
                return(EventData.NextID);
            }

            // レベルの一覧と最大値・最小値を求める
            var min_value = units.Min(u => u.MainPilot().Level + u.MainPilot().Exp);
            var max_value = units.Max(u => u.MainPilot().Level + u.MainPilot().Exp);

            // レベルにばらつきがある時にのみレベルでソート
            if (min_value != max_value)
            {
                units = units.OrderByDescending(u => u.MainPilot().Level + u.MainPilot().Exp).ToList();
            }
            var list = units
                       .Select(u =>
            {
                var msg = "";
                if (Expression.IsOptionDefined("等身大基準"))
                {
                    msg = u.Nickname0
                          + Strings.Space(GeneralLib.MaxLng(52 - Strings.LenB(u.Nickname0), 1))
                          + GeneralLib.LeftPaddedString("" + u.MainPilot().Level, 2);
                }
                else
                {
                    msg = u.Nickname0
                          + Strings.Space(GeneralLib.MaxLng(36 - Strings.LenB(u.Nickname0), 1))
                          + u.MainPilot().get_Nickname(false)
                          + Strings.Space(GeneralLib.MaxLng(17 - Strings.LenB(u.MainPilot().get_Nickname(false)), 1))
                          + GeneralLib.LeftPaddedString("" + u.MainPilot().Level, 2);
                }
                return(new ListBoxItem(msg, u.ID));
            }).ToList();

            int ret;

            do
            {
                string info;
                if (Expression.IsOptionDefined("等身大基準"))
                {
                    info = "ユニット                                            Lv";
                }
                else
                {
                    info = "ユニット                            パイロット       Lv";
                }

                ret = GUI.MultiSelectListBox(new ListBoxArgs
                {
                    lb_caption = "出撃ユニット選択",
                    lb_info    = info,
                    Items      = list,
                }, unum);
                if (ret == 0)
                {
                    Commands.CommandState = "ユニット選択";
                    GUI.UnlockGUI();
                    Commands.ViewMode = true;
                    while (Commands.ViewMode)
                    {
                        GUI.Sleep(50);
                    }

                    GUI.LockGUI();
                    goto Beginning;
                }
            }while (ret == 0);
            if (Strings.InStr(opt, "非同期") > 0)
            {
                GUI.Center(ux, uy);
                GUI.RefreshScreen();
            }

            foreach (var u in list.Where(x => x.ListItemFlag)
                     .Select(x => SRC.UList.Item(x.ListItemID)))
            {
                u.UsedAction        = 0;
                u.UsedSupportAttack = 0;
                u.UsedSupportGuard  = 0;
                u.UsedSyncAttack    = 0;
                u.UsedCounterAttack = 0;
                u.StandBy(ux, uy, opt);
            }

            SRC.UList.CheckAutoHyperMode();

            return(EventData.NextID);
        }
Beispiel #23
0
        // パイロットがユニット u のサポートかどうか
        public bool IsSupport(Unit u)
        {
            if (u.IsFeatureAvailable("ダミーユニット"))
            {
                // ダミーユニットの場合はサポートパイロットも通常のパイロットとして扱う
                return(false);
            }

            // サポート指定が存在する?
            if (GeneralLib.InStrNotNest(Class, "サポート)") == 0)
            {
                return(false);
            }

            if (u.CountPilot() == 0)
            {
                // パイロットが乗っていないユニットの場合は通常パイロットを優先
                foreach (var pclass in GeneralLib.ToL(Class))
                {
                    var uclass = u.Class;
                    if (uclass == pclass ||
                        uclass == (pclass + "(" + get_Nickname(false) + "専用)") ||
                        uclass == (pclass + "(" + Name + "専用)") ||
                        uclass == (pclass + "(" + Sex + "専用)"))
                    {
                        // 通常のパイロットとして搭乗可能であればサポートでないとみなす
                        return(false);
                    }
                }
            }
            else
            {
                // 通常のパイロットとして搭乗している?
                if (u.Pilots.Contains(this))
                {
                    return(false);
                }
            }

            {
                var uclass = u.Class0;
                // 通常のサポート?
                foreach (var pclass in GeneralLib.ToL(Class))
                {
                    if ((uclass + "(サポート)" ?? "") == pclass)
                    {
                        return(true);
                    }
                }

                // パイロットが乗っていないユニットの場合はここで終了
                if (u.CountPilot() == 0)
                {
                    return(false);
                }

                // 専属サポート?
                var p = u.MainPilot();
                foreach (var pclass in GeneralLib.ToL(Class))
                {
                    if (pclass == (uclass + "(" + p.Name + "専属サポート)") ||
                        pclass == (uclass + "(" + p.get_Nickname(false) + "専属サポート)") ||
                        pclass == (uclass + "(" + p.Sex + "専属サポート)"))
                    {
                        return(true);
                    }
                    foreach (var sname in p.Skills.Select(skill => skill.Name))
                    {
                        if (pclass == (uclass + "(" + sname + "専属サポート)" ?? ""))
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
Beispiel #24
0
        // 特殊能力を追加
        public void AddSkill(ref string sname, double slevel, string sdata, short lv)
        {
            SkillData sd;
            short     i;

            ;

            // データ定義が省略されている場合は前回と同じ物を使う
            if ((last_sname ?? "") == (sname ?? "") & Strings.Len(sdata) == 0)
            {
                sdata = last_sdata;
            }

            last_sname = sname;
            last_sdata = sdata;

            // エリアスが定義されている?
            object argIndex2 = sname;

            if (SRC.ALDList.IsDefined(ref argIndex2))
            {
                if (GeneralLib.LIndex(ref sdata, 1) != "解説")
                {
                    object argIndex1 = sname;
                    {
                        var withBlock = SRC.ALDList.Item(ref argIndex1);
                        var loopTo    = withBlock.Count;
                        for (i = 1; i <= loopTo; i++)
                        {
                            // エリアスの定義に従って特殊能力定義を置き換える
                            sd      = new SkillData();
                            sd.Name = withBlock.get_AliasType(i);
                            string localLIndex()
                            {
                                string arglist = withBlock.get_AliasData(i); var ret = GeneralLib.LIndex(ref arglist, 1); withBlock.get_AliasData(i) = arglist; return(ret);
                            }

                            if (localLIndex() == "解説")
                            {
                                if (!string.IsNullOrEmpty(sdata))
                                {
                                    sd.Name = GeneralLib.LIndex(ref sdata, 1);
                                }
                            }

                            if (withBlock.get_AliasLevelIsPlusMod(i))
                            {
                                if (slevel == SRC.DEFAULT_LEVEL)
                                {
                                    slevel = 1d;
                                }

                                sd.Level = slevel + withBlock.get_AliasLevel(i);
                            }
                            else if (withBlock.get_AliasLevelIsMultMod(i))
                            {
                                if (slevel == SRC.DEFAULT_LEVEL)
                                {
                                    slevel = 1d;
                                }

                                sd.Level = slevel * withBlock.get_AliasLevel(i);
                            }
                            else if (slevel != SRC.DEFAULT_LEVEL)
                            {
                                sd.Level = slevel;
                            }
                            else
                            {
                                sd.Level = withBlock.get_AliasLevel(i);
                            }

                            sd.StrData = withBlock.get_AliasData(i);
                            if (!string.IsNullOrEmpty(sdata))
                            {
                                string localLIndex1()
                                {
                                    string arglist = withBlock.get_AliasData(i); var ret = GeneralLib.LIndex(ref arglist, 1); withBlock.get_AliasData(i) = arglist; return(ret);
                                }

                                if (withBlock.get_AliasData(i) != "非表示" & localLIndex1() != "解説")
                                {
                                    string localListTail()
                                    {
                                        string arglist = withBlock.get_AliasData(i); var ret = GeneralLib.ListTail(ref arglist, 2); withBlock.get_AliasData(i) = arglist; return(ret);
                                    }

                                    sd.StrData = Strings.Trim(sdata + " " + localListTail());
                                }
                            }

                            if (withBlock.get_AliasLevelIsPlusMod(i) | withBlock.get_AliasLevelIsMultMod(i))
                            {
                                sd.StrData = sd.StrData + "Lv" + Microsoft.VisualBasic.Compatibility.VB6.Support.Format(slevel);
                            }

                            sd.NecessaryLevel = lv;
                            colSkill.Add(sd, sname + Microsoft.VisualBasic.Compatibility.VB6.Support.Format(colSkill.Count));
                        }
                    }

                    return;
                }
            }

            // 特殊能力を登録
            sd                = new SkillData();
            sd.Name           = sname;
            sd.Level          = slevel;
            sd.StrData        = sdata;
            sd.NecessaryLevel = lv;
            colSkill.Add(sd, sname + Microsoft.VisualBasic.Compatibility.VB6.Support.Format(colSkill.Count));
        }
Beispiel #25
0
 public static T Dice <T>(this IList <T> list)
 {
     return(list[GeneralLib.Dice(list.Count) - 1]);
 }
Beispiel #26
0
        // 指定したレベルでの特殊能力Nameの名称
        public string SkillName(short lv, ref string sname)
        {
            string SkillNameRet = default;
            short  lv2;

            SkillNameRet = sname;
            lv2          = 0;
            foreach (SkillData sd in colSkill)
            {
                if ((sname ?? "") == (sd.Name ?? ""))
                {
                    if (sd.NecessaryLevel > lv)
                    {
                        break;
                    }

                    if (sd.NecessaryLevel > lv2)
                    {
                        lv2 = sd.NecessaryLevel;
                        if (Strings.Len(sd.StrData) > 0)
                        {
                            SkillNameRet = GeneralLib.LIndex(ref sd.StrData, 1);
                            switch (SkillNameRet ?? "")
                            {
                            case "非表示":
                            {
                                return(SkillNameRet);
                            }

                            case "解説":
                            {
                                SkillNameRet = "非表示";
                                return(SkillNameRet);
                            }
                            }

                            if (sname == "階級")
                            {
                                goto NextLoop;
                            }
                        }
                        else
                        {
                            SkillNameRet = sname;
                        }

                        if (sname != "同調率" & sname != "霊力")
                        {
                            if (sd.Level != SRC.DEFAULT_LEVEL & Strings.InStr(SkillNameRet, "Lv") == 0)
                            {
                                SkillNameRet = SkillNameRet + "Lv" + Microsoft.VisualBasic.Compatibility.VB6.Support.Format(sd.Level);
                            }
                        }
                    }
                }

NextLoop:
                ;
            }

            // レベル非表示用の括弧を削除
            if (Strings.Left(SkillNameRet, 1) == "(")
            {
                SkillNameRet = Strings.Mid(SkillNameRet, 2, Strings.Len(SkillNameRet) - 2);
            }

            return(SkillNameRet);
        }
        public void Update(int Id,string Description,string Type,string ExternalRef,DateTime? DateAdded,bool? Valid)
        {
            GeneralLib item = new GeneralLib();
            item.MarkOld();
            item.IsLoaded = true;

            item.Id = Id;

            item.Description = Description;

            item.Type = Type;

            item.ExternalRef = ExternalRef;

            item.DateAdded = DateAdded;

            item.Valid = Valid;

            item.Save(UserName);
        }
Beispiel #28
0
        // 特殊能力の名称
        public string FeatureName(Unit unit)
        {
            FeatureData fd = this;

            // 非表示の能力
            switch (fd.Name ?? "")
            {
            case "ノーマルモード":
            case "パーツ合体":
            case "換装":
            case "制限時間":
            case "制御不可":
            case "主形態":
            case "他形態":
            case "合体制限":
            case "格闘武器":
            case "迎撃武器":
            case "合体技":
            case "変形技":
            case "ランクアップ":
            case "追加パイロット":
            case "暴走時パイロット":
            case "追加サポート":
            case "装備個所":
            case "ハードポイント":
            case "武器クラス":
            case "防具クラス":
            case "BGM":
            case "武器BGM":
            case "アビリティBGM":
            case "合体BGM":
            case "分離BGM":
            case "変形BGM":
            case "ハイパーモードBGM":
            case "ユニット画像":
            case "パイロット画像":
            case "パイロット愛称":
            case "パイロット読み仮名":
            case "性別":
            case "性格変更":
            case "吸収":
            case "無効化":
            case "耐性":
            case "弱点":
            case "有効":
            case "特殊効果無効化":
            case "アイテム所有":
            case "レアアイテム所有":
            case "ラーニング可能技":
            case "改造費修正":
            case "最大改造数":
            case "パイロット能力付加":
            case "パイロット能力強化":
            case "非表示":
            case "攻撃属性":
            case "射程延長":
            case "武器強化":
            case "命中率強化":
            case "CT率強化":
            case "特殊効果発動率強化":
            case "必要技能":
            case "不必要技能":
            case "ダミーユニット":
            case "地形ユニット":
            case "召喚解除コマンド名":
            case "変身解除コマンド名":
            case "1人乗り可能":
            case "特殊効果":
            case "戦闘アニメ":
            case "パイロット地形適応変更":
            case "メッセージクラス":
            case "用語名":
            case "発光":
                // ユニット用特殊能力
                return("");

            case "愛称変更":
            case "読み仮名変更":
            case "サイズ変更":
            case "地形適応変更":
            case "地形適応固定変更":
            case "空中移動":
            case "陸上移動":
            case "水中移動":
            case "宇宙移動":
            case "地中移動":
            case "修理費修正":
            case "経験値修正":
            case "最大弾数増加":
            case "EN消費減少":
            case "V-UP":
            case "大型アイテム":
            case "呪い":
                // アイテム用特殊能力
                return("");
            }

            // 拡大画像能力は「拡大画像(文字列)」といった指定もあるので他の非表示能力と異なる
            // 判定方法を使う
            if (Strings.InStr(fd.Name, "拡大画像") == 1)
            {
                return("");
            }

            string resultName;

            if (Strings.Len(fd.StrData) > 0)
            {
                // 別名の指定あり
                resultName = GeneralLib.ListIndex(fd.StrData, 1);
                if (resultName == "非表示" || resultName == "解説")
                {
                    resultName = "";
                }
            }
            else if (fd.Level == Constants.DEFAULT_LEVEL)
            {
                // レベル指定なし
                resultName = fd.Name;
            }
            else if (fd.Level >= 0d)
            {
                // レベル指定あり
                resultName = fd.Name + "Lv" + SrcFormatter.Format(fd.Level);
                if (fd.Name == "射撃強化")
                {
                    if (unit.CountPilot() > 0)
                    {
                        if (unit.MainPilot().HasMana())
                        {
                            resultName = "魔力強化Lv" + SrcFormatter.Format(fd.Level);
                        }
                    }
                }
            }
            else
            {
                // マイナスのレベル指定
                switch (fd.Name ?? "")
                {
                case "格闘強化":
                    resultName = "格闘低下" + "Lv" + SrcFormatter.Format(Math.Abs(fd.Level));
                    break;

                case "射撃強化":
                    resultName = "射撃低下" + "Lv" + SrcFormatter.Format(Math.Abs(fd.Level));
                    if (unit.CountPilot() > 0)
                    {
                        if (unit.MainPilot().HasMana())
                        {
                            resultName = "魔力低下Lv" + SrcFormatter.Format(Math.Abs(fd.Level));
                        }
                    }

                    break;

                case "命中強化":
                    resultName = "命中低下" + "Lv" + SrcFormatter.Format(Math.Abs(fd.Level));
                    break;

                case "回避強化":
                    resultName = "回避低下" + "Lv" + SrcFormatter.Format(Math.Abs(fd.Level));
                    break;

                case "技量強化":
                    resultName = "技量低下" + "Lv" + SrcFormatter.Format(Math.Abs(fd.Level));
                    break;

                case "反応強化":
                    resultName = "反応低下" + "Lv" + SrcFormatter.Format(Math.Abs(fd.Level));
                    break;

                default:
                    resultName = fd.Name + "Lv" + SrcFormatter.Format(fd.Level);
                    break;
                }
            }

            return(resultName);
        }
Beispiel #29
0
Datei: Item.cs Projekt: 7474/SRC
        // アイテムが使用可能か?
        public bool IsAvailable(ref Unit u)
        {
            bool   IsAvailableRet = default;
            short  j, i, k;
            string iclass;
            string sname, fdata;

            IsAvailableRet = false;

            // イベントコマンド「Disable」
            string argvname = "Disable(" + Name + ")";

            if (Expression.IsGlobalVariableDefined(ref argvname))
            {
                return(IsAvailableRet);
            }

            // 装備個所に適合しているか
            switch (Part() ?? "")
            {
            case "片手":
            case "両手":
            case "盾":
            {
                object argIndex1 = "装備個所";
                if (Strings.InStr(u.FeatureData(ref argIndex1), "腕") == 0)
                {
                    return(IsAvailableRet);
                }

                break;
            }

            case "肩":
            case "両肩":
            {
                object argIndex2 = "装備個所";
                if (Strings.InStr(u.FeatureData(ref argIndex2), "肩") == 0)
                {
                    return(IsAvailableRet);
                }

                break;
            }

            case "体":
            {
                object argIndex3 = "装備個所";
                if (Strings.InStr(u.FeatureData(ref argIndex3), "体") == 0)
                {
                    return(IsAvailableRet);
                }

                break;
            }

            case "頭":
            {
                object argIndex4 = "装備個所";
                if (Strings.InStr(u.FeatureData(ref argIndex4), "頭") == 0)
                {
                    return(IsAvailableRet);
                }

                break;
            }
            }

            // 武器クラス or 防具クラスに属しているか?
            switch (Part() ?? "")
            {
            case "武器":
            case "片手":
            case "両手":
            {
                iclass = u.WeaponProficiency() + " 固定 汎用";
                var loopTo = GeneralLib.LLength(ref iclass);
                for (i = 1; i <= loopTo; i++)
                {
                    if ((Class0() ?? "") == (GeneralLib.LIndex(ref iclass, i) ?? ""))
                    {
                        IsAvailableRet = true;
                        break;
                    }
                }

                break;
            }

            case "盾":
            case "体":
            case "頭":
            {
                iclass = u.ArmorProficiency() + " 固定 汎用";
                var loopTo1 = GeneralLib.LLength(ref iclass);
                for (i = 1; i <= loopTo1; i++)
                {
                    if ((Class0() ?? "") == (GeneralLib.LIndex(ref iclass, i) ?? ""))
                    {
                        IsAvailableRet = true;
                        break;
                    }
                }

                break;
            }

            default:
            {
                // その他のアイテムは常に利用可能
                IsAvailableRet = true;
                break;
            }
            }

            if (!IsAvailableRet)
            {
                return(IsAvailableRet);
            }

            // 技能チェックが必要?
            string argfname  = "必要技能";
            string argfname1 = "不必要技能";

            if (!IsFeatureAvailable(ref argfname) & !IsFeatureAvailable(ref argfname1))
            {
                return(IsAvailableRet);
            }
            // 必要技能をチェック
            var loopTo2 = CountFeature();

            for (i = 1; i <= loopTo2; i++)
            {
                object argIndex15 = i;
                switch (Feature(ref argIndex15) ?? "")
                {
                case "必要技能":
                {
                    string localFeatureData1()
                    {
                        object argIndex1 = i; var ret = FeatureData(ref argIndex1); return(ret);
                    }

                    bool localIsNecessarySkillSatisfied()
                    {
                        string argnabilities = hs6a6e2af77d324e3587224eb7d4498ee9(); Pilot argp = null; var ret = u.IsNecessarySkillSatisfied(ref argnabilities, p: ref argp); return(ret);
                    }

                    if (!localIsNecessarySkillSatisfied())
                    {
                        // アイテム自身により必要技能に指定された能力が封印されていた場合は
                        // 必要技能を満たしていると判定させるため、チェックする必要がある。

                        var loopTo3 = u.CountItem();
                        for (j = 1; j <= loopTo3; j++)
                        {
                            Item localItem()
                            {
                                object argIndex1 = j; var ret = u.Item(ref argIndex1); return(ret);
                            }

                            if (ReferenceEquals(this, localItem()))
                            {
                                break;
                            }
                        }

                        if (j > u.CountItem())
                        {
                            // 既に装備しているのでなければ装備しない
                            IsAvailableRet = false;
                            return(IsAvailableRet);
                        }

                        if (u.CountPilot() > 0)
                        {
                            string localFeatureData()
                            {
                                object argIndex1 = i; var ret = FeatureData(ref argIndex1); return(ret);
                            }

                            string argsname = localFeatureData();
                            sname = u.MainPilot().SkillType(ref argsname);
                        }
                        else
                        {
                            object argIndex5 = i;
                            sname = FeatureData(ref argIndex5);
                        }

                        // 必要技能が「~装備」?
                        if (Strings.Right(sname, 2) == "装備")
                        {
                            if ((Strings.Left(sname, Strings.Len(sname) - 2) ?? "") == (Name ?? "") | (Strings.Left(sname, Strings.Len(sname) - 2) ?? "") == (Class0() ?? ""))
                            {
                                goto NextLoop;
                            }
                        }

                        // 封印する能力が必要技能になっている?
                        var loopTo4 = CountFeature();
                        for (j = 1; j <= loopTo4; j++)
                        {
                            object argIndex6 = j;
                            switch (Feature(ref argIndex6) ?? "")
                            {
                            case "パイロット能力付加":
                            case "パイロット能力強化":
                            {
                                break;
                            }

                            default:
                            {
                                goto NextLoop1;
                                break;
                            }
                            }

                            // 封印する能力名
                            object argIndex7 = j;
                            fdata = FeatureData(ref argIndex7);
                            if (Strings.Left(fdata, 1) == "\"")
                            {
                                fdata = Strings.Mid(fdata, 2, Strings.Len(fdata) - 2);
                            }

                            if (Strings.InStr(fdata, "=") > 0)
                            {
                                fdata = Strings.Left(fdata, Strings.InStr(fdata, "=") - 1);
                            }

                            // 必要技能と封印する能力が一致している?
                            if ((fdata ?? "") == (sname ?? ""))
                            {
                                goto NextLoop;
                            }

                            if (u.CountPilot() > 0)
                            {
                                object argIndex9 = fdata;
                                if (SRC.ALDList.IsDefined(ref argIndex9))
                                {
                                    object argIndex8 = fdata;
                                    {
                                        var withBlock = SRC.ALDList.Item(ref argIndex8);
                                        var loopTo5   = withBlock.Count;
                                        for (k = 1; k <= loopTo5; k++)
                                        {
                                            if ((withBlock.get_AliasType(k) ?? "") == (sname ?? ""))
                                            {
                                                goto NextLoop;
                                            }
                                        }
                                    }
                                }
                                else if ((u.MainPilot().SkillType(ref fdata) ?? "") == (sname ?? ""))
                                {
                                    goto NextLoop;
                                }
                            }

NextLoop1:
                            ;
                        }

                        // 必要技能が満たされていなかった
                        IsAvailableRet = false;
                        return(IsAvailableRet);
                    }

                    break;
                }

                case "不必要技能":
                {
                    string localFeatureData3()
                    {
                        object argIndex1 = i; var ret = FeatureData(ref argIndex1); return(ret);
                    }

                    string argnabilities = localFeatureData3();
                    Pilot  argp          = null;
                    if (u.IsNecessarySkillSatisfied(ref argnabilities, p: ref argp))
                    {
                        // アイテム自身により不必要技能が満たされている場合は不必要技能を
                        // 無視させるため、チェックする必要がある。

                        var loopTo6 = u.CountItem();
                        for (j = 1; j <= loopTo6; j++)
                        {
                            Item localItem1()
                            {
                                object argIndex1 = j; var ret = u.Item(ref argIndex1); return(ret);
                            }

                            if (ReferenceEquals(this, localItem1()))
                            {
                                break;
                            }
                        }

                        if (j > u.CountItem())
                        {
                            // 既に装備しているのでなければ装備しない
                            IsAvailableRet = false;
                            return(IsAvailableRet);
                        }

                        if (u.CountPilot() > 0)
                        {
                            string localFeatureData2()
                            {
                                object argIndex1 = i; var ret = FeatureData(ref argIndex1); return(ret);
                            }

                            string argsname1 = localFeatureData2();
                            sname = u.MainPilot().SkillType(ref argsname1);
                        }
                        else
                        {
                            object argIndex10 = i;
                            sname = FeatureData(ref argIndex10);
                        }

                        // 不必要技能が「~装備」?
                        if (Strings.Right(sname, 2) == "装備")
                        {
                            if ((Strings.Left(sname, Strings.Len(sname) - 2) ?? "") == (Name ?? "") | (Strings.Left(sname, Strings.Len(sname) - 2) ?? "") == (Class0() ?? ""))
                            {
                                goto NextLoop;
                            }
                        }

                        // 付加する能力が不必要技能になっている?
                        var loopTo7 = CountFeature();
                        for (j = 1; j <= loopTo7; j++)
                        {
                            object argIndex11 = j;
                            switch (Feature(ref argIndex11) ?? "")
                            {
                            case "パイロット能力付加":
                            case "パイロット能力強化":
                            {
                                break;
                            }

                            default:
                            {
                                goto NextLoop2;
                                break;
                            }
                            }

                            // 付加する能力名
                            object argIndex12 = j;
                            fdata = FeatureData(ref argIndex12);
                            if (Strings.Left(fdata, 1) == "\"")
                            {
                                fdata = Strings.Mid(fdata, 2, Strings.Len(fdata) - 2);
                            }

                            if (Strings.InStr(fdata, "=") > 0)
                            {
                                fdata = Strings.Left(fdata, Strings.InStr(fdata, "=") - 1);
                            }

                            // 必要技能と付加する能力が一致している?
                            if ((fdata ?? "") == (sname ?? ""))
                            {
                                goto NextLoop;
                            }

                            if (u.CountPilot() > 0)
                            {
                                object argIndex14 = fdata;
                                if (SRC.ALDList.IsDefined(ref argIndex14))
                                {
                                    object argIndex13 = fdata;
                                    {
                                        var withBlock1 = SRC.ALDList.Item(ref argIndex13);
                                        var loopTo8    = withBlock1.Count;
                                        for (k = 1; k <= loopTo8; k++)
                                        {
                                            if ((withBlock1.get_AliasType(k) ?? "") == (sname ?? ""))
                                            {
                                                goto NextLoop;
                                            }
                                        }
                                    }
                                }
                                else if ((u.MainPilot().SkillType(ref fdata) ?? "") == (sname ?? ""))
                                {
                                    goto NextLoop;
                                }
                            }

NextLoop2:
                            ;
                        }

                        // 不必要技能が満たされていた
                        IsAvailableRet = false;
                        return(IsAvailableRet);
                    }

                    break;
                }
                }

NextLoop:
                ;
            }

            return(IsAvailableRet);
        }
Beispiel #30
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 #31
0
        protected override int ExecInternal()
        {
            if (ArgNum < 4)
            {
                throw new EventErrorException(this, "PaintPictureコマンドの引数の数が違います");
            }

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

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

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

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

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

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

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

                    break;
                }
                }

                i = (i + 1);
            }

            var fname = GetArgAsString(2);

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

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

                break;
            }

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

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

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

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

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

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

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

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

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

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

            return(EventData.NextID);
        }
Beispiel #32
0
        // アビリティに効果を追加
        public void SetEffect(string elist)
        {
            elist = (elist ?? "").Trim();
            foreach (var eelm in GeneralLib.ToList(elist))
            {
                var    dat = new AbilityEffect();
                var    buf = eelm;
                var    j   = Strings.InStr(buf, "Lv");
                var    k   = Strings.InStr(buf, "=");
                string etype;
                string elevel;
                string edata;
                if (j > 0 && (k == 0 || j < k))
                {
                    // レベル指定のある効果(データ指定があるものを含む)
                    dat.Name = Strings.Left(buf, j - 1);
                    if (k > 0)
                    {
                        // データ指定があるもの
                        dat.Level = Conversions.ToDouble(Strings.Mid(buf, j + 2, k - (j + 2)));
                        buf       = Strings.Mid(buf, k + 1);
                        if (Strings.Left(buf, 1) == "\"")
                        {
                            buf = Strings.Mid(buf, 2, Strings.Len(buf) - 2);
                        }

                        j = Strings.InStr(buf, "Lv");
                        k = Strings.InStr(buf, "=");
                        if (j > 0 && (k == 0 || j < k))
                        {
                            // データ指定内にレベル指定がある
                            etype = Strings.Left(buf, j - 1);
                            if (k > 0)
                            {
                                elevel = Strings.Mid(buf, j + 2, k - (j + 2));
                                edata  = Strings.Mid(buf, k + 1);
                            }
                            else
                            {
                                elevel = Strings.Mid(buf, j + 2);
                                edata  = "";
                            }
                        }
                        else if (k > 0)
                        {
                            // データ指定内にデータ指定がある
                            etype  = Strings.Left(buf, k - 1);
                            elevel = "";
                            edata  = Strings.Mid(buf, k + 1);
                        }
                        else
                        {
                            // 単純なデータ指定
                            etype  = buf;
                            elevel = "";
                            edata  = "";
                        }

                        if (dat.Name == "付加" && string.IsNullOrEmpty(elevel))
                        {
                            elevel = SrcFormatter.Format(Constants.DEFAULT_LEVEL);
                        }

                        dat.Data = Strings.Trim(etype + " " + elevel + " " + edata);
                    }
                    else
                    {
                        // データ指定がないもの
                        dat.Level = Conversions.ToDouble(Strings.Mid(buf, j + 2));
                    }
                }
                else if (k > 0)
                {
                    // データ指定を含む効果
                    dat.Name = Strings.Left(buf, k - 1);
                    buf      = Strings.Mid(buf, k + 1);
                    if (Strings.Asc(buf) == 34) // "
                    {
                        buf = Strings.Mid(buf, 2, Strings.Len(buf) - 2);
                    }

                    j = Strings.InStr(buf, "Lv");
                    k = Strings.InStr(buf, "=");
                    if (dat.Name == "解説")
                    {
                        // 解説の指定
                        etype  = buf;
                        elevel = "";
                        edata  = "";
                    }
                    else if (j > 0)
                    {
                        // データ指定内にレベル指定がある
                        etype = Strings.Left(buf, j - 1);
                        if (k > 0)
                        {
                            elevel = Strings.Mid(buf, j + 2, k - (j + 2));
                            edata  = Strings.Mid(buf, k + 1);
                        }
                        else
                        {
                            elevel = Strings.Mid(buf, j + 2);
                            edata  = "";
                        }
                    }
                    else if (k > 0)
                    {
                        // データ指定内にデータ指定がある
                        etype  = Strings.Left(buf, k - 1);
                        elevel = "";
                        edata  = Strings.Mid(buf, k + 1);
                    }
                    else
                    {
                        // 単純なデータ指定
                        etype  = buf;
                        elevel = "";
                        edata  = "";
                    }

                    if (dat.Name == "付加" && string.IsNullOrEmpty(elevel))
                    {
                        elevel = SrcFormatter.Format(Constants.DEFAULT_LEVEL);
                    }

                    dat.Data = Strings.Trim(etype + " " + elevel + " " + edata);
                }
                else
                {
                    // 効果名のみ
                    dat.Name = buf;
                }

                j = 1;
                foreach (AbilityEffect dat2 in colEffects)
                {
                    if ((dat.Name ?? "") == (dat2.Name ?? ""))
                    {
                        j = (j + 1);
                    }
                }

                if (j == 1)
                {
                    colEffects.Add(dat, dat.Name);
                }
                else
                {
                    colEffects.Add(dat, dat.Name + SrcFormatter.Format(j));
                }
            }
        }