Beispiel #1
0
 // コマンドを実行し、実行後のEventDataLine#IDを返す
 public int Exec()
 {
     SRC.LogDebug(Name.ToString(), args.Select(x => x.strArg).ToArray());
     try
     {
         return(ExecInternal());
     }
     catch (EventErrorException ex)
     {
         Event.DisplayEventErrorMessage(ex?.EventData.ID ?? EventData.ID, ex.Message);
         return(-1);
     }
     catch (NotImplementedException ex)
     {
         SRC.Log.LogWarning("NotImplemented: " + EventData.Data);
         return(EventData.NextID);
     }
     catch (Exception ex)
     {
         SRC.Log.LogError(ex.Message, ex);
         if (Strings.LCase(GeneralLib.ListIndex(EventData.Data, 1)) == "talk")
         {
             Event.DisplayEventErrorMessage(EventData.ID, "Talkコマンド実行中に不正な処理が行われました。" + "MIDIがソフトウェアシンセサイザで演奏されているか、" + "フォントキャッシュが壊れている可能性があります。" + "詳しくはSRC公式ホームページの「よくある質問集」をご覧下さい。");
         }
         else if (Strings.LCase(GeneralLib.ListIndex(EventData.Data, 1)) == "autotalk")
         {
             Event.DisplayEventErrorMessage(EventData.ID, "AutoTalkコマンド実行中に不正な処理が行われました。" + "MIDIがソフトウェアシンセサイザで演奏されているか、" + "フォントキャッシュが壊れている可能性があります。" + "詳しくはSRC公式ホームページの「よくある質問集」をご覧下さい。");
         }
         else
         {
             Event.DisplayEventErrorMessage(EventData.ID, "イベントデータが不正です");
         }
         return(-1);
     }
 }
Beispiel #2
0
        public string FeatureNameWithLv()
        {
            var    fd             = this;
            string FeatureNameRet = default;

            if (Strings.Len(fd.StrData) > 0)
            {
                FeatureNameRet = GeneralLib.ListIndex(fd.StrData, 1);
            }
            else if (fd.Level > 0d)
            {
                FeatureNameRet = fd.Name + "Lv" + SrcFormatter.Format(fd.Level);
            }
            else
            {
                FeatureNameRet = fd.Name;
            }

            return(FeatureNameRet);
        }
Beispiel #3
0
        // 地形効果の名称
        public string FeatureName(ref object Index)
        {
            string      FeatureNameRet = default;
            FeatureData fd;

            fd = (FeatureData)colFeature[Index];
            if (Strings.Len(fd.StrData) > 0)
            {
                FeatureNameRet = GeneralLib.ListIndex(ref fd.StrData, 1);
            }
            else if (fd.Level != SRC.DEFAULT_LEVEL)
            {
                FeatureNameRet = fd.Name + "Lv" + Microsoft.VisualBasic.Compatibility.VB6.Support.Format(fd.Level);
            }
            else
            {
                FeatureNameRet = fd.Name;
            }

            return(FeatureNameRet);
        }
Beispiel #4
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 #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: 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 #7
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));
                }
            }
        }
Beispiel #8
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 #9
0
        public bool Evaluate()
        {
            // Ifコマンドはあらかじめ構文解析されていて、条件式の項数が入っている
            bool flag;

            switch (ExprTermCount)
            {
            case 1:
                if (SRC.PList.IsDefined(Expr))
                {
                    var p = SRC.PList.Item(Expr);
                    if (p.Unit is null)
                    {
                        flag = false;
                    }
                    else
                    {
                        {
                            var withBlock1 = p.Unit;
                            if (withBlock1.Status == "出撃" || withBlock1.Status == "格納")
                            {
                                flag = true;
                            }
                            else
                            {
                                flag = false;
                            }
                        }
                    }
                }
                else if (Expression.GetValueAsLong(Expr, true) != 0)
                {
                    flag = true;
                }
                else
                {
                    flag = false;
                }
                break;

            case 2:
                var pname = GeneralLib.ListIndex(Expr, 2);
                if (SRC.PList.IsDefined(pname))
                {
                    {
                        var p = SRC.PList.Item(pname);
                        if (p.Unit is null)
                        {
                            flag = true;
                        }
                        else
                        {
                            if (p.Unit.Status == "出撃" || p.Unit.Status == "格納")
                            {
                                flag = false;
                            }
                            else
                            {
                                flag = true;
                            }
                        }
                    }
                }
                else if (Expression.GetValueAsLong(pname, true) == 0)
                {
                    flag = true;
                }
                else
                {
                    flag = false;
                }
                break;

            default:
                if (Expression.GetValueAsLong(Expr) != 0)
                {
                    flag = true;
                }
                else
                {
                    flag = false;
                }
                break;
            }

            return(flag);
        }
Beispiel #10
0
        // 戦闘アニメを再生
        public void PlayAnimation(string main_situation, string sub_situation = "", bool keep_message_form = false)
        {
            var in_bulk = false;

            // 戦闘アニメデータを検索
            var anime = AnimationData(main_situation, sub_situation);

            // 見つからなかった場合は一括指定を試してみる
            if (string.IsNullOrEmpty(anime))
            {
                switch (Strings.Right(main_situation, 4) ?? "")
                {
                case "(準備)":
                case "(攻撃)":
                case "(命中)":
                {
                    anime   = AnimationData(Strings.Left(main_situation, Strings.Len(main_situation) - 4), sub_situation);
                    in_bulk = true;
                    break;
                }

                case "(発動)":
                {
                    anime = AnimationData(Strings.Left(main_situation, Strings.Len(main_situation) - 4), sub_situation);
                    break;
                }
                }
            }

            anime = anime.Trim();

            // 表示キャンセル
            if (string.IsNullOrEmpty(anime) || anime == "-")
            {
                return;
            }

            // マウスの右ボタンでキャンセル
            if (GUI.IsRButtonPressed())
            {
                // アニメの終了処理はキャンセルしない
                if (main_situation != "終了" && Strings.Right(main_situation, 4) != "(終了)")
                {
                    // 式評価のみ行う
                    Expression.FormatMessage(ref anime);
                    return;
                }
            }

            // メッセージウィンドウは表示されている?
            var is_message_form_opened = GUI.MessageFormVisible;

            // TODO Impl オブジェクト色等
            //// オブジェクト色等を記録しておく
            //prev_obj_color = Event.ObjColor;
            //prev_obj_fill_color = Event.ObjFillColor;
            //prev_obj_fill_style = Event.ObjFillStyle;
            //prev_obj_draw_width = Event.ObjDrawWidth;
            //prev_obj_draw_option = Event.ObjDrawOption;

            //// オブジェクト色等をデフォルトに戻す
            //Event.ObjColor = ColorTranslator.ToOle(Color.White);
            //Event.ObjFillColor = ColorTranslator.ToOle(Color.White);
            //Event.ObjFillStyle = vbFSTransparent;
            //Event.ObjDrawWidth = 1;
            //Event.ObjDrawOption = "";

            // 検索するシチュエーションが武器名かどうか調べる
            var is_weapon = Weapons.Any(w => main_situation == w.Name + "(攻撃)");

            // 検索するシチュエーションがアビリティかどうか調べる
            var is_ability = Abilities.Any(a => main_situation == a.Data.Name + "(発動)");

            // イベント用ターゲットを記録しておく
            var prev_selected_target = Event.SelectedTargetForEvent;

            // 攻撃でもアビリティでもない場合、ターゲットが設定されていなければ
            // 自分自身をターゲットに設定する
            // (発動アニメではアニメ表示にSelectedTargetForEventが使われるため)
            if (!is_weapon && !is_ability)
            {
                if (Event.SelectedTargetForEvent is null)
                {
                    Event.SelectedTargetForEvent = this;
                }
            }

            // アニメ指定を分割
            var animes = anime.Split(";").ToList();

            try
            {
                var need_refresh = false;
                var wait_time    = 0;
                var sname        = "";
                var buf          = "";
                foreach (var a in animes)
                {
                    var animepart = a;
                    // 最後に実行されたのがサブルーチン呼び出しかどうかを判定するため
                    // サブルーチン名をあらかじめクリアしておく
                    sname = "";

                    // 式評価
                    Expression.FormatMessage(ref animepart);

                    // 画面クリア?
                    if (Strings.LCase(animepart) == "clear")
                    {
                        GUI.ClearPicture();
                        need_refresh = true;
                        goto NextAnime;
                    }

                    // 戦闘アニメ以外の特殊効果
                    switch (Strings.LCase(Strings.Right(GeneralLib.LIndex(animepart, 1), 4)) ?? "")
                    {
                    case ".wav":
                    case ".mp3":
                    {
                        // 効果音
                        Sound.PlayWave(animepart);
                        if (wait_time > 0)
                        {
                            if (need_refresh)
                            {
                                GUI.UpdateScreen();
                                need_refresh = false;
                            }

                            GUI.Sleep(wait_time);
                            wait_time = 0;
                        }

                        goto NextAnime;
                    }

                    case ".bmp":
                    case ".jpg":
                    case ".gif":
                    case ".png":
                    {
                        // カットインの表示
                        if (wait_time > 0)
                        {
                            animepart    = (wait_time / 100d) + ";" + animepart;
                            wait_time    = 0;
                            need_refresh = false;
                        }
                        else if (Strings.Left(animepart, 1) == "@")
                        {
                            need_refresh = false;
                        }
                        else
                        {
                            need_refresh = true;
                        }

                        GUI.DisplayBattleMessage("-", animepart, msg_mode: "");
                        goto NextAnime;
                    }
                    }

                    switch (Strings.LCase(GeneralLib.LIndex(animepart, 1)) ?? "")
                    {
                    case "line":
                    case "circle":
                    case "arc":
                    case "oval":
                    case "color":
                    case "fillcolor":
                    case "fillstyle":
                    case "drawwidth":
                    {
                        // 画面処理コマンド
                        if (wait_time > 0)
                        {
                            animepart    = (wait_time / 100d) + ";" + animepart;
                            wait_time    = 0;
                            need_refresh = false;
                        }
                        else
                        {
                            need_refresh = true;
                        }

                        GUI.DisplayBattleMessage("-", animepart, msg_mode: "");
                        goto NextAnime;
                    }

                    case "center":
                    {
                        // 指定したユニットを中央表示
                        buf = Expression.GetValueAsString(GeneralLib.ListIndex(animepart, 2));
                        if (SRC.UList.IsDefined(buf))
                        {
                            {
                                var withBlock = SRC.UList.Item(buf);
                                GUI.Center(withBlock.x, withBlock.y);
                                GUI.RedrawScreen();
                                need_refresh = false;
                            }
                        }

                        goto NextAnime;
                    }

                    case "keep":
                    {
                        // そのまま終了
                        break;
                    }
                    }

                    // ウェイト?
                    if (Information.IsNumeric(animepart))
                    {
                        wait_time = (int)(100d * Conversions.ToDouble(animepart));
                        goto NextAnime;
                    }

                    // サブルーチンの呼び出しが確定

                    // 戦闘アニメ再生用のサブルーチン名を作成
                    sname = GeneralLib.LIndex(animepart, 1);
                    if (Strings.Left(sname, 1) == "@")
                    {
                        sname = Strings.Mid(sname, 2);
                    }
                    else if (is_weapon)
                    {
                        // 武器名の場合
                        sname = "戦闘アニメ_" + sname + "攻撃";
                    }
                    else
                    {
                        // その他の場合
                        // 括弧を含んだ武器名に対応するため、"("は後ろから検索
                        var idx = GeneralLib.InStr2(main_situation, "(");

                        // 変形系のシチュエーションではサフィックスを無視
                        if (idx > 0)
                        {
                            switch (Strings.Left(main_situation, idx - 1) ?? "")
                            {
                            case "変形":
                            case "ハイパーモード":
                            case "ノーマルモード":
                            case "パーツ分離":
                            case "合体":
                            case "分離":
                            {
                                idx = 0;
                                break;
                            }
                            }
                        }

                        // 武器名(攻撃無効化)の場合もサフィックスを無視
                        if (idx > 0)
                        {
                            if (Strings.Mid(main_situation, idx) == "(攻撃無効化)")
                            {
                                idx = 0;
                            }
                        }

                        if (idx > 0)
                        {
                            // サフィックスあり
                            sname = "戦闘アニメ_" + sname + Strings.Mid(main_situation, idx + 1, Strings.Len(main_situation) - idx - 1);
                        }
                        else
                        {
                            sname = "戦闘アニメ_" + sname + "発動";
                        }
                    }

                    // サブルーチンが見つからなかった
                    if (Event.FindNormalLabel(sname) == 0)
                    {
                        if (in_bulk)
                        {
                            // 一括指定を利用している場合
                            switch (Strings.Right(main_situation, 4) ?? "")
                            {
                            case "(準備)":
                            {
                                // 表示をキャンセル
                                goto NextAnime;
                            }

                            case "(攻撃)":
                            {
                                // 複数のアニメ指定がある場合は諦めて他のものを使う
                                if (animes.Count > 1)
                                {
                                    goto NextAnime;
                                }
                                // そうでなければ「デフォルト」を使用
                                sname = "戦闘アニメ_デフォルト攻撃";
                                break;
                            }

                            case "(命中)":
                            {
                                // 複数のアニメ指定がある場合は諦めて他のものを使う
                                if (animes.Count > 1)
                                {
                                    goto NextAnime;
                                }
                                // そうでなければ「ダメージ」を使用
                                sname = "戦闘アニメ_ダメージ命中";
                                break;
                            }
                            }
                        }
                        else
                        {
                            if (wait_time > 0)
                            {
                                animepart = (wait_time / 100d) + ";" + animepart;
                                wait_time = 0;
                            }

                            if (!GUI.MessageFormVisible)
                            {
                                if (ReferenceEquals(Commands.SelectedTarget, this))
                                {
                                    GUI.OpenMessageForm(this, u2: null);
                                }
                                else
                                {
                                    GUI.OpenMessageForm(Commands.SelectedTarget, this);
                                }
                            }

                            GUI.DisplayBattleMessage("-", animepart, msg_mode: "");
                            goto NextAnime;
                        }
                    }

                    sname = "`" + sname + "`";

                    // 引数の構築
                    sname = sname + "," + string.Join(",", GeneralLib.ToList(animepart).Skip(1));
                    if (in_bulk)
                    {
                        sname = sname + ",`一括指定`";
                    }

                    // 戦闘アニメ再生前にウェイトを入れる
                    if (need_refresh)
                    {
                        GUI.UpdateScreen();
                        need_refresh = false;
                    }

                    if (wait_time > 0)
                    {
                        GUI.Sleep(wait_time);
                        wait_time = 0;
                    }

                    // 画像描画が行われたかどうかの判定のためにフラグを初期化
                    GUI.IsPictureDrawn = false;

                    // 戦闘アニメ再生
                    Event.SaveBasePoint();
                    Expression.CallFunction("Call(" + sname + ")", Expressions.ValueType.StringType, out buf, out _);
                    Event.RestoreBasePoint();

                    // 画像を消去しておく
                    if (GUI.IsPictureDrawn && Strings.LCase(buf) != "keep")
                    {
                        GUI.ClearPicture();
                        GUI.UpdateScreen();
                    }

NextAnime:
                    ;
                }

                // 戦闘アニメ再生後にウェイトを入れる?
                if (need_refresh)
                {
                    GUI.UpdateScreen();
                    need_refresh = false;
                }

                if (wait_time > 0)
                {
                    GUI.Sleep(wait_time);
                    wait_time = 0;
                }

                // 画像を消去しておく
                if (GUI.IsPictureDrawn && string.IsNullOrEmpty(sname) && Strings.InStr(main_situation, "(準備)") == 0 && Strings.LCase(anime) != "keep")
                {
                    GUI.ClearPicture();
                    GUI.UpdateScreen();
                }

                // 最初から表示されていたのでなければメッセージウィンドウを閉じる
                if (!is_message_form_opened && !keep_message_form)
                {
                    GUI.CloseMessageForm();
                }

                //// オブジェクト色等を元に戻す
                //Event.ObjColor = prev_obj_color;
                //Event.ObjFillColor = prev_obj_fill_color;
                //Event.ObjFillStyle = prev_obj_fill_style;
                //Event.ObjDrawWidth = prev_obj_draw_width;
                //Event.ObjDrawOption = prev_obj_draw_option;

                // イベント用ターゲットを元に戻す
                Event.SelectedTargetForEvent = prev_selected_target;
            }
            catch (Exception ex)
            {
                // TODO Handle error
                //if (Strings.Len(Event.EventErrorMessage) > 0)
                //{
                //    Event.DisplayEventErrorMessage(Event.CurrentLineNum, Event.EventErrorMessage);
                //    Event.EventErrorMessage = "";
                //}
                //else
                //{
                //    Event.DisplayEventErrorMessage(Event.CurrentLineNum, "");
                //}
                Event.DisplayEventErrorMessage(Event.CurrentLineNum, ex.Message);
            }
        }
Beispiel #11
0
 public NotSupportedCmd(SRC src, EventDataLine eventData) : base(src, CmdType.NopCmd, eventData)
 {
     throw new NotSupportedException(GeneralLib.ListIndex(eventData.Data, 1) + "コマンドはサポートされていません。");
 }
Beispiel #12
0
        // ラベルの検索
        public int SearchLabel(string lname, int start = -1)
        {
            // ラベルの各要素をあらかじめ解析
            // XXX Indexがずれていて辛い。
            string[] litem;
            int      llen = GeneralLib.ListSplit(lname, out litem);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            default:
                ltype = LabelType.NormalLabel;
                break;
            }

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

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

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

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

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

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

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

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

                return(lab.EventDataId);
            }

            return(-1);
        }