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
        protected void update_map_sacrifice()
        {
            Scene_Map scene_map = get_scene_map();

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

            while (!cont)
            {
                cont = true;
                switch (Sacrifice_Phase)
                {
                    #region Setup
                case 0:
                    switch (Sacrifice_Timer)
                    {
                    case 0:
                        Global.scene.suspend();
                        Sacrificer_Id                   = Global.game_system.Battler_1_Id;
                        Sacrifice_Target_Id             = Global.game_system.Battler_2_Id;
                        Global.game_system.Battler_1_Id = -1;
                        Global.game_system.Battler_2_Id = -1;
                        Sacrifice_Timer++;
                        break;

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

                    case 4:
                        if (!Scrolling)
                        {
                            get_scene_map().create_hud(Sacrificer_Id, Sacrifice_Target_Id);
                            if (Map_Animations.unit_data(1, sacrificer.actor.class_id) != null)
                            {
                                sacrificer.battling = true;
                                // Turns map sprites toward each other
                                sacrificer.face(sacrifice_target);
                                sacrificer.frame   = 0;
                                Sacrifice_Animated = true;
                            }
                            else
                            {
                                sacrificer.sprite_moving = false;
                                sacrificer.frame         = 0;
                                sacrificer.facing        = 6; // 2;
                            }
                            Sacrifice_Timer++;
                        }
                        break;

                    case 5:
                        if (!Sacrifice_Animated)
                        {
                            sacrificer.facing = 6;
                        }
                        Sacrifice_Timer++;
                        break;

                    case 27:
                        if (Sacrifice_Animated)
                        {
                            scene_map.set_map_animation(Sacrificer_Id, 1, sacrificer.actor.class_id);
                        }
                        Sacrifice_Phase++;
                        Sacrifice_Action = 0;
                        Sacrifice_Timer  = 0;
                        break;

                    default:
                        Sacrifice_Timer++;
                        break;
                    }
                    break;

                    #endregion
                    #region Animation
                case 1:
                    if (Sacrifice_Animated)
                    {
                        if (scene_map.map_animation_finished(Sacrificer_Id))
                        {
                            Sacrifice_Phase++;
                            Sacrifice_Action = 0;
                            Sacrifice_Timer  = 0;
                        }
                    }
                    else
                    {
                        switch (Sacrifice_Timer)
                        {
                        case 0:
                            sacrificer.frame = 1;
                            Sacrifice_Timer++;
                            break;

                        case 4:
                            sacrificer.frame = 2;
                            Sacrifice_Timer++;
                            break;

                        case 10:
                            Sacrifice_Phase++;
                            Sacrifice_Action = 0;
                            Sacrifice_Timer  = 0;
                            break;

                        default:
                            Sacrifice_Timer++;
                            break;
                        }
                    }
                    break;

                    #endregion
                    #region Heal Animation
                case 2:
                    switch (Sacrifice_Action)
                    {
                    case 0:
                        // shouldn't be hardcoded //Yeti
                        scene_map.set_map_effect(sacrifice_target.loc, 0,
                                                 Map_Animations.item_effect_id(1));
                        Sacrifice_Action++;
                        break;

                    case 1:
                        switch (Sacrifice_Timer)
                        {
                        case 30:
                            int heal = sacrificer.sacrifice_heal_amount(sacrifice_target);
                            sacrificer.actor.hp       -= heal;
                            sacrifice_target.actor.hp += heal;

                            Sacrifice_Action++;
                            Sacrifice_Timer = 0;
                            break;

                        default:
                            Sacrifice_Timer++;
                            break;
                        }
                        break;

                    case 2:
                    {
                        switch (Sacrifice_Timer)
                        {
                        case 0:
                            if (!scene_map.is_map_effect_active())
                            {
                                if (get_scene_map().combat_hud_ready())
                                {
                                    //if (Sacrifice_Animated)
                                    //{
                                    //    Sacrifice_Action++;
                                    //    Sacrifice_Timer = 0;
                                    //}
                                    //else
                                    Sacrifice_Timer++;
                                }
                            }
                            break;

                        case 26:
                            if (!Sacrifice_Animated)
                            {
                                sacrificer.frame = 1;
                            }
                            Sacrifice_Timer++;
                            break;

                        case 34:
                            if (!Sacrifice_Animated)
                            {
                                sacrificer.frame = 0;
                            }
                            Sacrifice_Timer++;
                            break;

                        case 46:
                            Sacrifice_Action++;
                            Sacrifice_Timer = 0;
                            break;

                        default:
                            Sacrifice_Timer++;
                            break;
                        }
                        break;
                    }

                    case 3:
                        switch (Sacrifice_Timer)
                        {
                        case 0:             //32:
                            if (!Sacrifice_Animated)
                            {
                                sacrificer.sprite_moving = true;
                                sacrificer.selection_facing();
                                sacrificer.battling = true;
                                sacrificer.frame    = 0;
                            }

                            get_scene_map().clear_combat();
                            Sacrifice_Phase++;
                            Sacrifice_Action = 0;
                            Sacrifice_Timer  = 0;
                            cont             = false;
                            break;

                        default:
                            Sacrifice_Timer++;
                            break;
                        }
                        break;
                    }
                    break;

                    #endregion
                    #region Sacrifice processing
                case 3:
                    scene_map.update_map_sprite_status(Sacrifice_Target_Id);
                    Sacrifice_Phase++;
                    break;

                    #endregion
                    #region Exp gain
                case 4:
                    switch (Sacrifice_Action)
                    {
                    case 0:
                        switch (Sacrifice_Timer)
                        {
                        case 0:
                            // Don't give exp on sacrifice if the target also has sacrifice, or they can infinite loop
                            if (!sacrifice_target.actor.has_skill("SACRIFICE") &&
                                sacrificer.is_ally && sacrificer.actor.can_level())
                            {
                                //int exp_gain = 10; //Debug
                                int exp_gain = Combat.exp(sacrificer, sacrifice_target);
                                // shouldn't be hardcoded //Yeti
                                exp_gauge_gain = (exp_gain > 0 ?
                                                  Math.Min(exp_gain, sacrificer.actor.exp_gain_possible()) :
                                                  Math.Max(exp_gain, -sacrificer.actor.exp_loss_possible()));
                                get_scene_map().create_exp_gauge(sacrificer.actor.exp);
                                sacrificer.actor.exp += exp_gain;
                                Sacrifice_Timer++;
                            }
                            else
                            {
                                Sacrifice_Phase++;
                            }
                            break;

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

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

                        case 78:
                            if (sacrificer.actor.needed_levels > 0)
                            {
                                Sacrifice_Action++;
                            }
                            else
                            {
                                Sacrifice_Phase++;
                                Sacrifice_Action = 0;
                            }
                            Sacrifice_Timer = 0;
                            break;

                        default:
                            Sacrifice_Timer++;
                            break;
                        }
                        break;

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

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

                        case 31:
                            Sacrifice_Phase++;
                            Sacrifice_Action = 0;
                            Sacrifice_Timer  = 0;
                            break;

                        default:
                            Sacrifice_Timer++;
                            break;
                        }
                        break;
                    }
                    break;

                    #endregion
                    #region End
                default:
                    switch (Sacrifice_Timer)
                    {
                    case 0:
                        if (sacrificer.cantoing && sacrificer.is_active_player_team)         //Multi
                        {
                            Global.player.loc          = sacrificer.loc;
                            Global.player.instant_move = true;
                            sacrificer.open_move_range();
                        }
                        else
                        {
                            sacrificer.start_wait(false);
                        }
                        sacrificer.battling = false;
                        sacrificer.queue_move_range_update();
                        sacrifice_target.queue_move_range_update();
                        refresh_move_ranges();
                        Sacrifice_Timer++;
                        break;

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

                    case 2:
                        Sacrifice_Calling   = false;
                        In_Sacrifice        = false;
                        Sacrifice_Phase     = 0;
                        Sacrifice_Action    = 0;
                        Sacrifice_Timer     = 0;
                        Sacrificer_Id       = -1;
                        Sacrifice_Target_Id = -1;
                        highlight_test();
                        Global.game_state.any_trigger_events();
                        break;
                    }
                    break;
                    #endregion
                }
            }
        }