Esempio n. 1
0
        internal override void update()
        {
            if (Support_Calling)
            {
                In_Support      = true;
                Support_Calling = false;
            }
            if (SupportGainCalling)
            {
                InSupportGain      = true;
                SupportGainCalling = false;
            }

            if (In_Support && get_scene_map() != null)
            {
                bool cont = false;
                while (!cont)
                {
                    cont = true;
                    switch (Support_Timer)
                    {
                    case 0:
                        Support_Id1 = Global.game_system.Rescuer_Id;
                        Support_Id2 = Global.game_system.Rescuee_Id;
                        Global.game_system.Rescuer_Id = -1;
                        Global.game_system.Rescuee_Id = -1;
                        // Add the new support level to the game progression
                        Global.progress.AddSupport(
                            supporter_actor.GetSupportKey(support_target_actor.id),
                            supporter_actor.get_support_level(support_target_actor.id) + 1);
                        if (!Global.game_system.preparations)
                        {
                            Global.scene.suspend();
                        }
                        Support_Timer++;
                        break;

                    case 2:
                        string convo = supporter_actor.support_convo(support_target_actor.id, Global.game_system.preparations);
                        if (Global.supports.ContainsKey(convo))
                        {
                            Global.game_temp.message_text += Global.supports[convo];
                            if (Global.game_temp.message_text.Length == 0 ||
                                Scene_Map.debug_chapter_options_blocked())
                            {
                                Global.game_temp.message_text = null;
                            }
                            else
                            {
                                if (Global.game_system.preparations)
                                {
                                    string clear_faces = "";
                                    for (int i = 1; i <= Face_Sprite_Data.FACE_COUNT; i++)
                                    {
                                        clear_faces += string.Format("\\f[{0}|nil]", i);
                                    }
                                    Global.game_temp.message_text = string.Format("\\g[{0}]{1}\\s[-2]{2}\\event",
                                                                                  Global.game_system.home_base_background, Global.game_temp.message_text, clear_faces);
                                }
                                Global.scene.new_message_window();
                            }
                        }
                        Support_Timer++;
                        break;

                    case 3:
                        if (!Global.game_system.is_interpreter_running && !Global.scene.is_message_window_active)
                        {
                            supporter_actor.increase_support_level(support_target_actor.id);
                            support_target_actor.increase_support_level(supporter_actor.id);
                            add_support_this_chapter(supporter_actor.id, support_target_actor.id);
                            Support_Timer++;
                        }
                        break;

                    case 19:
                        Global.game_system.play_se(System_Sounds.Gain);
                        get_scene_map().set_popup("Support level increased!", 113);     //Yeti
                        Support_Timer++;
                        break;

                    case 20:
                        if (!get_scene_map().is_map_popup_active())
                        {
                            Global.scene.resume_message();
                            if (!Global.scene.is_message_window_active)
                            {
                                Support_Timer++;
                            }
                        }
                        break;

                    case 21:
                        if (!Global.game_system.is_interpreter_running && !Global.scene.is_message_window_active)
                        {
                            if (!Global.game_system.preparations)
                            {
                                if (supporter.cantoing && supporter.is_active_player_team)     //Multi
                                {
                                    Global.player.force_loc(supporter.loc);
                                    supporter.open_move_range();
                                }
                                else
                                {
                                    supporter.start_wait(false);
                                }
                                supporter.queue_move_range_update();
                                refresh_move_ranges();
                            }
                            Support_Timer++;
                        }
                        break;

                    case 22:
                        if (!Global.game_system.is_interpreter_running && !Global.scene.is_message_window_active)
                        {
                            wait_for_move_update();

                            Support_Timer++;
                        }
                        break;

                    case 23:
                        In_Support    = false;
                        Support_Timer = 0;
                        Support_Id1   = -1;
                        Support_Id2   = -1;
                        highlight_test();
                        break;

                    default:
                        Support_Timer++;
                        break;
                    }
                }
            }
            else if (InSupportGain && get_scene_map() != null)
            {
                bool cont = false;
                if (Global.game_state.talk_blocking_support_gain)
                {
                    cont = true;
                }
                while (!cont)
                {
                    // If skipping AI turn
                    if (Global.game_state.skip_ai_turn_active)
                    {
                        // Don't show support hearts
                        Support_Timer = SUPPORT_GAIN_TIME + SUPPORT_GAIN_STARTUP;
                    }

                    cont = true;
                    switch (Support_Timer)
                    {
                    case 0:
                        if (Global.game_system.SupportGainId != -1)
                        {
                            Support_Id1    = Global.game_system.SupportGainId;
                            SupportTargets = Global.game_system.SupportGainTargets;
                            Global.game_system.SupportGainId      = -1;
                            Global.game_system.SupportGainTargets = new List <int>();
                        }
                        Support_Timer++;
                        break;

                    case SUPPORT_GAIN_STARTUP + 3:
                        // Check if the lead unit has a support ready
                        bool supportReady = false;
                        foreach (int id in SupportTargets)
                        {
                            Game_Unit target = Units[id];
                            if (this.supporter.actor.is_support_ready(target.actor.id))
                            {
                                supportReady = true;
                                break;
                            }
                        }
                        // Shift the pitch up more if a support is ready
                        if (supportReady)
                        {
                            Global.Audio.play_se("System Sounds", "Support_Gain", 0.6f);
                        }
                        else
                        {
                            Global.Audio.play_se("System Sounds", "Support_Gain", 0.2f);
                        }
                        Support_Timer++;
                        break;

                    case SUPPORT_GAIN_TIME + SUPPORT_GAIN_STARTUP:
                        InSupportGain = false;
                        Support_Timer = 0;
                        Support_Id1   = -1;
                        Support_Id2   = -1;
                        SupportTargets.Clear();
                        break;

                    default:
                        Support_Timer++;
                        break;
                    }
                }
            }
        }