Esempio n. 1
0
        // マップ型「アビリティ」コマンドを終了
        private void MapAbilityCommand()
        {
            GUI.LockGUI();
            var currentUnit = SelectedUnit;
            var unitAbility = currentUnit.Ability(SelectedAbility);

            // 移動後使用後可能なアビリティか記録しておく
            var is_p_ability = unitAbility.IsAbilityClassifiedAs("P") ||
                               unitAbility.AbilityMaxRange() == 1 && !unitAbility.IsAbilityClassifiedAs("Q");

            // 目標地点を選択して初めて効果範囲が分かるタイプのマップアビリティの場合は再度プレイヤーの選択を促す必要がある
            if (CommandState == "ターゲット選択" || CommandState == "移動後ターゲット選択")
            {
                if (unitAbility.IsAbilityClassifiedAs("M投"))
                {
                    if (CommandState == "ターゲット選択")
                    {
                        CommandState = "マップ攻撃使用";
                    }
                    else
                    {
                        CommandState = "移動後マップ攻撃使用";
                    }

                    // 目標地点
                    SelectedX = GUI.PixelToMapX((int)GUI.MouseX);
                    SelectedY = GUI.PixelToMapY((int)GUI.MouseY);

                    // 効果範囲を設定
                    Map.AreaInRange(SelectedX, SelectedY, (int)unitAbility.AbilityLevel("M投"), 1, "味方");
                    GUI.MaskScreen();
                    return;
                }
                else if (unitAbility.IsAbilityClassifiedAs("M移"))
                {
                    SelectedX = GUI.PixelToMapX((int)GUI.MouseX);
                    SelectedY = GUI.PixelToMapY((int)GUI.MouseY);
                    if (Map.MapDataForUnit[SelectedX, SelectedY] is object)
                    {
                        GUI.MaskScreen();
                        return;
                    }

                    // 目標地点
                    if (CommandState == "ターゲット選択")
                    {
                        CommandState = "マップ攻撃使用";
                    }
                    else
                    {
                        CommandState = "移動後マップ攻撃使用";
                    }

                    // 効果範囲を設定
                    Map.AreaInPointToPoint(currentUnit.x, currentUnit.y, SelectedX, SelectedY);
                    GUI.MaskScreen();
                    return;
                }
                else if (unitAbility.IsAbilityClassifiedAs("M線"))
                {
                    if (CommandState == "ターゲット選択")
                    {
                        CommandState = "マップ攻撃使用";
                    }
                    else
                    {
                        CommandState = "移動後マップ攻撃使用";
                    }

                    // 目標地点
                    SelectedX = GUI.PixelToMapX((int)GUI.MouseX);
                    SelectedY = GUI.PixelToMapY((int)GUI.MouseY);

                    // 効果範囲を設定
                    Map.AreaInPointToPoint(currentUnit.x, currentUnit.y, SelectedX, SelectedY);
                    GUI.MaskScreen();
                    return;
                }
            }

            // 合体技のパートナーを設定
            IList <Unit> partners = new List <Unit>();

            {
                if (unitAbility.IsAbilityClassifiedAs("合"))
                {
                    if (unitAbility.AbilityMaxRange() == 1)
                    {
                        partners = unitAbility.CombinationPartner(SelectedTarget.x, SelectedTarget.y);
                    }
                    else
                    {
                        partners = unitAbility.CombinationPartner();
                    }
                }
                else
                {
                    SelectedPartners.Clear();
                }
            }

            // アビリティを実行
            currentUnit.ExecuteMapAbility(unitAbility, SelectedX, SelectedY);
            SelectedUnit   = currentUnit.CurrentForm();
            SelectedTarget = null;

            if (SRC.IsScenarioFinished)
            {
                SRC.IsScenarioFinished = false;
                SelectedPartners.Clear();
                GUI.UnlockGUI();
                return;
            }

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

            // 合体技のパートナーの行動数を減らす
            if (!Expression.IsOptionDefined("合体技パートナー行動数無消費"))
            {
                foreach (var pu in partners)
                {
                    pu.CurrentForm().UseAction();
                }
            }

            SelectedPartners.Clear();

            // 再移動
            if (is_p_ability && SelectedUnit.Status == "出撃")
            {
                if (SelectedUnit.MainPilot().IsSkillAvailable("遊撃") && SelectedUnit.Speed * 2 > SelectedUnitMoveCost)
                {
                    // 進入イベント
                    if (SelectedUnitMoveCost > 0)
                    {
                        Event.HandleEvent("進入", SelectedUnit.MainPilot().ID, "" + SelectedUnit.x, "" + SelectedUnit.y);
                        if (SRC.IsScenarioFinished)
                        {
                            SRC.IsScenarioFinished = false;
                            return;
                        }
                    }

                    // ユニットが既に出撃していない?
                    if (SelectedUnit.Status != "出撃")
                    {
                        GUI.RedrawScreen();
                        Status.ClearUnitStatus();
                        return;
                    }

                    SelectedCommand = "再移動";
                    Map.AreaInSpeed(SelectedUnit);
                    if (!Expression.IsOptionDefined("大型マップ"))
                    {
                        GUI.Center(SelectedUnit.x, SelectedUnit.y);
                    }

                    GUI.MaskScreen();
                    //if (GUI.NewGUIMode)
                    //{
                    //    Application.DoEvents();
                    //    Status.ClearUnitStatus();
                    //}
                    //else
                    {
                        Status.DisplayUnitStatus(SelectedUnit);
                    }

                    CommandState = "ターゲット選択";
                    return;
                }
            }

            // 行動終了
            WaitCommand();
        }
Esempio n. 2
0
        // 「アビリティ」コマンドを終了
        private void FinishAbilityCommand()
        {
            //// MOD START MARGE
            //// If MainWidth <> 15 Then
            //if (GUI.NewGUIMode)
            //{
            //    // MOD END MARGE
            //    Status.ClearUnitStatus();
            //}

            GUI.LockGUI();
            var currentUnit = SelectedUnit;
            var unitAbility = currentUnit.Ability(SelectedAbility);

            // 合体技のパートナーを設定
            IList <Unit> partners = new List <Unit>();
            {
                if (unitAbility.IsAbilityClassifiedAs("合"))
                {
                    if (unitAbility.AbilityMaxRange() == 1)
                    {
                        partners = unitAbility.CombinationPartner(SelectedTarget.x, SelectedTarget.y);
                    }
                    else
                    {
                        partners = unitAbility.CombinationPartner();
                    }
                }
                else
                {
                    SelectedPartners.Clear();
                }
            }

            var aname = unitAbility.Data.Name;

            SelectedAbilityName = aname;

            // 移動後使用後可能なアビリティか記録しておく
            var is_p_ability = unitAbility.IsAbilityClassifiedAs("P") ||
                               unitAbility.AbilityMaxRange() == 1 && !unitAbility.IsAbilityClassifiedAs("Q");

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

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

            {
                foreach (Unit u in SRC.UList.Items)
                {
                    if (u.Status == "出撃")
                    {
                        Map.MaskData[u.x, u.y] = true;
                    }
                }

                // 合体技パートナーのハイライト表示
                foreach (var pu in partners)
                {
                    Map.MaskData[pu.x, pu.y] = false;
                }

                Map.MaskData[currentUnit.x, currentUnit.y]       = false;
                Map.MaskData[SelectedTarget.x, SelectedTarget.y] = false;
                if (!SRC.BattleAnimation)
                {
                    GUI.MaskScreen();
                }

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

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

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

                    WaitCommand();
                    return;
                }
            }

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

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

            // 合体技のパートナーの行動数を減らす
            if (!Expression.IsOptionDefined("合体技パートナー行動数無消費"))
            {
                foreach (var pu in partners)
                {
                    pu.CurrentForm().UseAction();
                }
            }

            SelectedPartners.Clear();

            // 再移動
            if (is_p_ability && SelectedUnit.Status == "出撃")
            {
                if (SelectedUnit.MainPilot().IsSkillAvailable("遊撃") && SelectedUnit.Speed * 2 > SelectedUnitMoveCost)
                {
                    // 進入イベント
                    if (SelectedUnitMoveCost > 0)
                    {
                        Event.HandleEvent("進入", SelectedUnit.MainPilot().ID, "" + SelectedUnit.x, "" + SelectedUnit.y);
                        if (SRC.IsScenarioFinished)
                        {
                            SRC.IsScenarioFinished = false;
                            return;
                        }
                    }

                    // ユニットが既に出撃していない?
                    if (SelectedUnit.Status != "出撃")
                    {
                        GUI.RedrawScreen();
                        Status.ClearUnitStatus();
                        return;
                    }

                    SelectedCommand = "再移動";
                    Map.AreaInSpeed(SelectedUnit);
                    if (!Expression.IsOptionDefined("大型マップ"))
                    {
                        GUI.Center(SelectedUnit.x, SelectedUnit.y);
                    }

                    GUI.MaskScreen();
                    //if (GUI.NewGUIMode)
                    //{
                    //    Application.DoEvents();
                    //    Status.ClearUnitStatus();
                    //}
                    //else
                    {
                        Status.DisplayUnitStatus(SelectedUnit);
                    }

                    CommandState = "ターゲット選択";
                    return;
                }
            }

            // 行動終了
            WaitCommand();
        }