Esempio n. 1
0
        protected void update_map_dance()
        {
            Scene_Map scene_map = get_scene_map();

            if (scene_map == null)
            {
                return;
            }
            bool cont = false;

            while (!cont)
            {
                cont = true;
                switch (Dance_Phase)
                {
                    #region Setup
                case 0:
                    switch (Dance_Timer)
                    {
                    case 0:
                        Global.scene.suspend();
                        Dancer_Id       = Global.game_system.Battler_1_Id;
                        Dance_Target_Id = Global.game_system.Battler_2_Id;
                        Dance_Item      = Global.game_system.Dance_Item;
                        Global.game_system.Battler_1_Id = -1;
                        Global.game_system.Battler_2_Id = -1;
                        Global.game_system.Dance_Item   = -1;
                        Dance_Timer++;
                        break;

                    case 1:
                    case 2:
                    case 3:
                        if (Global.player.is_on_square)
                        {
                            Dance_Timer++;
                        }
                        break;

                    case 4:
                        if (!Scrolling)
                        {
                            dancer.battling = true;
                            // Turns map sprites toward each other
                            dancer.face(dance_target);
                            dancer.frame = 0;
                            if (Map_Animations.unit_data(1, dancer.actor.class_id) != null)
                            {
                                Dance_Animated = true;
                                scene_map.set_map_animation(Dancer_Id, 1, dancer.actor.class_id);
                            }
                            Dance_Phase++;
                            Dance_Action = 0;
                            Dance_Timer  = 0;
                        }
                        break;
                    }
                    break;

                    #endregion
                    #region Animation
                case 1:
                    if (Dance_Animated)
                    {
                        if (scene_map.map_animation_finished(Dancer_Id))
                        {
                            Dance_Phase++;
                            Dance_Action = 0;
                            Dance_Timer  = 0;
                        }
                    }
                    else
                    {
                        switch (Dance_Action)
                        {
                        // Waits
                        case 0:
                            switch (Dance_Timer)
                            {
                            case 23:
                                Dance_Action++;
                                Dance_Timer = 0;
                                break;

                            default:
                                Dance_Timer++;
                                break;
                            }
                            break;

                        // Dancer moves toward the target //Yeti
                        case 1:
                            dancer.attack_move(dance_target);
                            Dance_Action++;
                            break;

                        // Waits until dancer has moved //Yeti
                        case 2:
                            if (!dancer.is_attack_moving())
                            {
                                Dance_Action++;
                            }
                            break;

                        // Dancer animates
                        case 3:
                            Global.Audio.play_se("Map Sounds", "Map_Step_FDragon");
                            dancer.wiggle();
                            Dance_Action++;
                            break;

                        // Waits
                        case 4:
                            if (!dancer.is_wiggle_moving())
                            {
                                dancer.attack_move(dance_target, true);
                                Dance_Action++;
                            }
                            break;

                        // Waits
                        case 5:
                            if (!dancer.is_attack_moving())
                            {
                                Dance_Action++;
                            }
                            break;

                        // Waits
                        case 6:
                            switch (Dance_Timer)
                            {
                            case 47:
                                Dance_Phase++;
                                Dance_Action = 0;
                                Dance_Timer  = 0;
                                break;

                            default:
                                Dance_Timer++;
                                break;
                            }
                            break;
                        }
                        dancer.update_attack_graphics();
                    }
                    break;

                    #endregion
                    #region Ring Animation
                case 2:
                    switch (Dance_Action)
                    {
                    case 0:
                        if (Dance_Item > -1)
                        {
                            scene_map.set_map_effect(dance_target.loc, 0,
                                                     Map_Animations.item_effect_id(dancer.items[Dance_Item].Id));
                            Dance_Action++;
                        }
                        else
                        {
                            Dance_Phase++;
                            cont = false;
                        }
                        break;

                    case 1:
                    {
                        if (!scene_map.is_map_effect_active())
                        {
                            Dance_Action++;
                        }
                        break;
                    }

                    case 2:
                        switch (Dance_Timer)
                        {
                        case 32:
                            Dance_Phase++;
                            Dance_Action = 0;
                            Dance_Timer  = 0;
                            cont         = false;
                            break;

                        default:
                            Dance_Timer++;
                            break;
                        }
                        break;
                    }
                    break;

                    #endregion
                    #region Dance processing
                case 3:
                    dancer.apply_dance(dance_target, Dance_Item);
                    scene_map.update_map_sprite_status(Dance_Target_Id);
                    Dance_Phase++;
                    break;

                    #endregion
                    #region Exp gain
                case 4:
                    switch (Dance_Action)
                    {
                    case 0:
                        switch (Dance_Timer)
                        {
                        case 0:
                            if (dancer.allowed_to_gain_exp() && dancer.actor.can_level())
                            {
                                int exp      = dancer.actor.exp;
                                int exp_gain = dancer.dance_exp();
                                if (exp_gain > 0 || dancer.actor.needed_levels > 0)
                                {
                                    scene_map.create_exp_gauge(exp);
                                    exp_gauge_gain = exp_gain;
                                }
                                else
                                {
                                    Dance_Timer = 47;
                                }
                                Dance_Timer++;
                            }
                            else
                            {
                                Dance_Phase++;
                            }
                            break;

                        case 27:
                            if (Global.game_state.process_exp_gain())
                            {
                                Global.game_system.cancel_sound();
                                Dance_Timer++;
                            }
                            break;

                        // Clears exp window, continues
                        case 47:
                            scene_map.clear_exp();
                            Dance_Timer++;
                            break;

                        case 78:
                            if (dancer.actor.needed_levels > 0)
                            {
                                Dance_Action++;
                            }
                            else
                            {
                                Dance_Phase++;
                                Dance_Action = 0;
                            }
                            Dance_Timer = 0;
                            break;

                        default:
                            Dance_Timer++;
                            break;
                        }
                        break;

                    // Level up
                    case 1:
                        switch (Dance_Timer)
                        {
                        case 0:
                            scene_map.level_up(Dancer_Id);
                            Dance_Timer++;
                            break;

                        case 1:
                            if (!scene_map.is_leveling_up())
                            {
                                Dance_Timer++;
                            }
                            break;

                        case 31:
                            Dance_Phase++;
                            Dance_Action = 0;
                            Dance_Timer  = 0;
                            break;

                        default:
                            Dance_Timer++;
                            break;
                        }
                        break;
                    }
                    break;

                    #endregion
                    #region End
                default:
                    switch (Dance_Timer)
                    {
                    case 0:
                        dance_cleanup();
                        break;

                    case 1:
                        if (!Global.game_system.is_interpreter_running && !Global.scene.is_message_window_active)
                        {
                            Dance_Timer++;
                        }
                        break;

                    case 2:
                        Dance_Calling   = false;
                        In_Dance        = false;
                        Dance_Phase     = 0;
                        Dance_Action    = 0;
                        Dance_Timer     = 0;
                        Dancer_Id       = -1;
                        Dance_Target_Id = -1;
                        Dance_Item      = -1;
                        highlight_test();
                        Global.game_state.any_trigger_events();
                        break;
                    }
                    break;
                    #endregion
                }
            }
        }
Esempio n. 2
0
        internal override void update()
        {
            Scene_Map scene_map = get_scene_map();

            if (scene_map == null)
            {
                return;
            }

            if (Exp_Calling)
            {
                In_Exp      = true;
                Exp_Calling = false;
            }
            if (In_Exp)
            {
                bool cont = false;
                while (!cont)
                {
                    cont = true;
                    switch (Exp_Action)
                    {
                    case 0:
                        switch (Exp_Timer)
                        {
                        case 0:
                            if (exp_gainer.is_ally && exp_gainer.actor.can_level())
                            {
                                // shouldn't be hardcoded //Yeti
                                Exp_Gauge_Gain = (Exp_Unit_Gain > 0 ?
                                                  Math.Min(Exp_Unit_Gain, exp_gainer.actor.exp_gain_possible()) :
                                                  Math.Max(Exp_Unit_Gain, -exp_gainer.actor.exp_loss_possible()));
                                scene_map.create_exp_gauge(exp_gainer.actor.exp);
                                exp_gainer.actor.exp += Exp_Unit_Gain;
                                Exp_Timer++;
                            }
                            else
                            {
                                Exp_Action = 2;
                                cont       = false;
                            }
                            break;

                        case 27:
                            if (process_exp_gain())
                            {
                                Global.game_system.cancel_sound();
                                Exp_Timer++;
                            }
                            break;

                        // Clears exp window, continues
                        case 47:
                            scene_map.clear_exp();
                            Exp_Timer++;
                            break;

                        case 78:
                            if (exp_gainer.actor.needed_levels > 0)
                            {
                                Exp_Action++;
                            }
                            else
                            {
                                Exp_Action = 2;
                                cont       = false;
                            }
                            Exp_Timer = 0;
                            break;

                        default:
                            Exp_Timer++;
                            break;
                        }
                        break;

                    // Level up
                    case 1:
                        switch (Exp_Timer)
                        {
                        case 0:
                            scene_map.level_up(Exp_Unit_Id);
                            Exp_Timer++;
                            break;

                        case 1:
                            if (!scene_map.is_leveling_up())
                            {
                                Exp_Timer++;
                            }
                            break;

                        case 31:
                            Exp_Action = 2;
                            cont       = false;
                            break;

                        default:
                            Exp_Timer++;
                            break;
                        }
                        break;

                    case 2:
                        In_Exp        = false;
                        Exp_Action    = 0;
                        Exp_Timer     = 0;
                        Exp_Unit_Id   = -1;
                        Exp_Unit_Gain = 0;
                        break;
                    }
                }
            }
        }