Example #1
0
        protected void battle_sprite_setup(int timer)
        {
            // sure looks like 11 should be a constant here //@Yeti

            //@Debug: should use lerp for battler scale?

            timer = Math.Max(timer, 0);
            Platform_Effect_Ratio = timer / 11f;
            Battler_1_Sprite.loc  = (Battler_1_Map_Loc + Pan_Vector) * ((11 - (timer)) / 11.0f) +
                                    Battler_1_Loc * ((timer) / 11.0f);
            //Battler_1_Sprite.loc = Battler_1_Map_Loc * ((11 - (timer)) / 11.0f) +
            //    Battler_1_Loc * ((timer) / 11.0f);
            Battler_1_Sprite.scale = new Vector2(Global.BattleSceneConfig.BattlerMinScale) * ((11 - (timer)) / 11.0f) +
                                     Vector2.One * ((timer) / 11.0f);
            Battler_1_Sprite.update_animation_position();
            if (Battler_2_Sprite != null)
            {
                Battler_2_Sprite.loc = (Battler_2_Map_Loc + Pan_Vector) * ((11 - (timer)) / 11.0f) +
                                       Battler_2_Loc * ((timer) / 11.0f);
                //Battler_2_Sprite.loc = Battler_2_Map_Loc * ((11 - (timer)) / 11.0f) +
                //    Battler_2_Loc * ((timer) / 11.0f);
                Battler_2_Sprite.scale = new Vector2(Global.BattleSceneConfig.BattlerMinScale) * ((11 - (timer)) / 11.0f) +
                                         Vector2.One * ((timer) / 11.0f);
                Battler_2_Sprite.update_animation_position();
            }
            Platform_Loc_2 = Battler_2 == null ? (Battler_1_Map_Loc + Pan_Vector) * ((11 - (timer)) / 11.0f) +
                             Battler_2_Loc * ((timer) / 11.0f) : Battler_2_Sprite.loc;
        }
        private void promotion_fade_in_initialize()
        {
            initialize_battle_sprites();
            Battler_1_Sprite.loc   = new Vector2(Battler_1_Loc.X, 176);
            Battler_1_Sprite.scale = Vector2.One;
            Battler_1_Sprite.reset_pose();
            Battler_1_Sprite.update_animation_position();
            Battler_1_Sprite.visible = true;

            HUD = null;
            if (!WaitingOnPromotionChoice)
            {
                // HUD
                setup_hud();
                HUD.complete_move();
            }
            // Create platforms
            create_platforms();
            Platform.add_y(-110);
            // White screen flash
            White_Screen           = new Sprite(battle_content.Load <Texture2D>(@"Graphics/White_Square"));
            White_Screen.dest_rect = new Rectangle(0, 0, Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT);
            White_Screen.visible   = false;

            // Start offscreen on the right if the promotion choice menu
            if (WaitingOnPromotionChoice)
            {
                Pan_Vector = new Vector2(this.OffscreenOffset, 0);
            }

            Black_Fill           = new Sprite(battle_content.Load <Texture2D>(@"Graphics/White_Square"));
            Black_Fill.dest_rect = new Rectangle(0, 0, Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT);
            Black_Fill.tint      = new Color(0, 0, 0, 0);
            // Create background
            if (is_battle_bg_visible)
            {
                Background = new Sprite(background(this.background_battler));
                Background.stereoscopic = Config.BATTLE_BG_DEPTH;
                Black_Backing           = new Sprite(battle_content.Load <Texture2D>(@"Graphics/White_Square"));
                Black_Backing.dest_rect = new Rectangle(0, 0, Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT);
                Black_Backing.tint      = new Color(0, 0, 0, 255);
            }

            Skip_Fill           = new Sprite(battle_content.Load <Texture2D>(@"Graphics/White_Square"));
            Skip_Fill.dest_rect = new Rectangle(0, 0, Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT);
        }
        protected override void update_phase_1()
        {
            base.update_phase_1();
            switch (Segment)
            {
            case 0:
                Battler_1_Sprite.class_change_start();
                darken();
                Segment = 1;
                break;

            case 1:
                if (Battler_1_Sprite.duration <= 1 && Battler_1_Sprite.spell_effect_duration <= 1)
                {
                    OldClass = Battler_1.actor.class_id;
                    OldLevel = Battler_1.actor.level;
                    Battler_1.actor.promotion_class_id = Global.game_system.Class_Change_To;
                    var battler1Data = new BattlerSpriteData(Battler_1);
                    Battler_1_Sprite = new Battler_Sprite(battler1Data, !Reverse, Distance, Reverse);
                    Battler_1_Sprite.start_battle();
                    Battler_1_Sprite.loc = Battler_1_Loc = new Vector2((!Reverse ? 184 + (Distance == 1 ? 0 : 56) :
                                                                        136 - (Distance == 1 ? 0 : 56)) +
                                                                       (Distance > 2 ? (Reverse ? -270 : 270) : 0), 176);
                    Battler_1_Sprite.reset_pose();
                    Battler_1_Sprite.update_animation_position();
                    Battler_1_Sprite.visible = true;
                    Battler_1_Sprite.class_change_end();
                    Battler_1_Sprite.stereoscopic = Config.BATTLE_BATTLERS_DEPTH;
                    Segment = 2;
                }
                break;

            case 2:
                if (Battler_1_Sprite.duration >= 163)
                {
                    brighten();
                }
                if (Battler_1_Sprite.duration <= 1 && Battler_1_Sprite.spell_effect_duration <= 1)
                {
                    Segment = 3;
                }
                break;

            case 3:
                switch (Timer)
                {
                case 104:
                    Phase   = 2;
                    Segment = 0;
                    Timer   = 0;
                    break;

                default:
                    Timer++;
                    break;
                }
                break;
            }
            // Updates screen flash
            Battler_1_Sprite.update_flash();
            update_spell_flash(Battler_1_Sprite);
        }
Example #4
0
        protected virtual void update_phase_0()
        {
            bool cont = false;

            while (!cont)
            {
                cont = true;
                switch (Timer)
                {
                case 0:
                    initialize_battle_sprites();
                    Timer++;
                    break;

                case 1:
                    Platform_Effect_1        = new Sprite(battle_content.Load <Texture2D>(@"Graphics/White_Square"));
                    Platform_Effect_1.offset = new Vector2(8, 8);
                    if (Battler_2 != null && Distance > 1)
                    {
                        Platform_Effect_2        = new Sprite(battle_content.Load <Texture2D>(@"Graphics/White_Square"));
                        Platform_Effect_2.offset = new Vector2(8, 8);
                    }
                    battle_sprite_setup(0);
                    Timer++;
                    break;

                case 2:
                case 3:
                    Battler_1_Sprite.visible = false;
                    if (Battler_2_Sprite != null)
                    {
                        Battler_2_Sprite.visible = false;
                    }
                    battle_sprite_setup(Timer - 3);
                    Timer++;
                    break;

                case 4:
                    Battler_1_Sprite.visible  = true;
                    Battler_1_Sprite.offset.Y = 120;
                    Battler_1_Sprite.update_animation_position();
                    if (Battler_2_Sprite != null)
                    {
                        Battler_2_Sprite.visible  = true;
                        Battler_2_Sprite.offset.Y = 120;
                        Battler_2_Sprite.update_animation_position();
                    }
                    battle_sprite_setup(Timer - 3);
                    Timer++;
                    break;

                case 5:
                    battle_sprite_setup(Timer - 3);
                    Timer++;
                    break;

                case 6:
                    battle_sprite_setup(Timer - 3);
                    // HUD
                    setup_hud();
                    // Create platforms
                    create_platforms();
                    // White screen flash
                    White_Screen           = new Sprite(battle_content.Load <Texture2D>(@"Graphics/White_Square"));
                    White_Screen.dest_rect = new Rectangle(0, 0, Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT);
                    White_Screen.visible   = false;
                    Timer++;
                    break;

                case 7:
                case 8:
                    battle_sprite_setup(Timer - 3);
                    // 110 total platform movement
                    Platform.add_y(-(Timer + 3));
                    Timer++;
                    break;

                case 9:
                case 10:
                case 11:
                    battle_sprite_setup(Timer - 3);
                    Platform.add_y(-(Timer + 6));
                    Timer++;
                    break;

                case 12:
                case 13:
                    battle_sprite_setup(Timer - 3);
                    Platform.add_y(-(Timer + 8));
                    Timer++;
                    break;

                case 14:
                    battle_sprite_setup(Timer - 3);
                    Timer++;
                    Platform_Effect_1 = null;
                    Platform_Effect_2 = null;
                    break;

                case 15:
                    Battler_1_Sprite.loc   = new Vector2(Battler_1_Loc.X, 176);
                    Battler_1_Sprite.scale = Vector2.One;
                    Battler_1_Sprite.reset_pose();
                    Battler_1_Sprite.update_animation_position();
                    if (Battler_2_Sprite != null)
                    {
                        Battler_2_Sprite.loc   = new Vector2(Battler_2_Loc.X, 176);
                        Battler_2_Sprite.scale = Vector2.One;
                        Battler_2_Sprite.reset_pose();
                        Battler_2_Sprite.update_animation_position();
                    }
                    Battler_1_Sprite.initialize_animation();
                    if (Battler_2_Sprite != null)
                    {
                        Battler_2_Sprite.initialize_animation();
                    }

                    Platform_Effect_1 = null;
                    Platform_Effect_2 = null;
                    Timer++;
                    break;

                case 16:
                    Black_Fill           = new Sprite(battle_content.Load <Texture2D>(@"Graphics/White_Square"));
                    Black_Fill.dest_rect = new Rectangle(0, 0, Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT);
                    if (is_battle_bg_visible)
                    {
                        Black_Fill.tint = new Color(0, 0, 0, 32);
                    }
                    else
                    {
                        Black_Fill.tint = new Color(0, 0, 0, 0);
                    }
                    Timer++;
                    break;

                case 17:
                case 18:
                case 19:
                case 20:
                case 21:
                case 22:
                case 23:
                    if (is_battle_bg_visible)
                    {
                        Black_Fill.tint = new Color(0, 0, 0, (int)MathHelper.Min((Timer - 15) * 32, 255));
                        if (Timer > 19)
                        {
                            Weather_Opacity = (Timer - 19) / 16f;
                        }
                    }
                    Timer++;
                    break;

                case 24:
                case 25:
                    if (is_battle_bg_visible)
                    {
                        Weather_Opacity = (Timer - 19) / 16f;
                    }
                    Timer++;
                    break;

                case 26:
                    // Create background
                    if (is_battle_bg_visible)
                    {
                        Background = new Sprite(background(this.background_battler));
                        Background.stereoscopic = Config.BATTLE_BG_DEPTH;
                        Black_Backing           = new Sprite(battle_content.Load <Texture2D>(@"Graphics/White_Square"));
                        Black_Backing.dest_rect = new Rectangle(0, 0, Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT);
                        Black_Backing.tint      = new Color(0, 0, 0, 255);

                        Weather_Opacity = (Timer - 19) / 16f;
                    }
                    else
                    {
                        cont = false;
                    }
                    Timer++;
                    break;

                case 27:
                case 28:
                case 29:
                case 30:
                case 31:
                case 32:
                case 33:
                case 34:
                case 35:
                    if (is_battle_bg_visible)
                    {
                        Black_Fill.tint = new Color(0, 0, 0, (int)MathHelper.Min((35 - Timer) * 32, 255));
                        Weather_Opacity = (Timer - 19) / 16f;
                        //Weather_Opacity = (Timer - 27) / 8f;
                    }
                    else
                    {
                        cont = false;
                    }
                    Timer++;
                    break;

                case 36:
                    battle_start_text();
                    if (!Music_Started && (!test_battle_theme() || !Global.game_temp.boss_theme))
                    {
                        Global.Audio.BgmFadeOut(60);
                    }
                    Global.game_temp.boss_theme = false;
                    Timer++;
                    break;

                case 72:
                    if (!Music_Started)
                    {
                        play_battle_theme();
                        Music_Started = true;
                    }
                    Battler_1_Sprite.start_battle();
                    if (Battler_2_Sprite != null)
                    {
                        Battler_2_Sprite.start_battle();
                    }
                    Timer++;
                    break;

                case 73:
                    if (Battler_1_Sprite.duration <= 2 && (Battler_2_Sprite == null || Battler_2_Sprite.duration <= 2))
                    {
                        check_talk(Battler_1, Battler_2, Reverse);
                        Timer++;
                    }
                    break;

                case 74:
                    if (!is_message_window_active && HUD.is_ready && !Message_Active)
                    {
                        Timer = 0;
                        Phase = 1;
                    }
                    break;

                default:
                    Timer++;
                    break;
                }
            }
        }
Example #5
0
 protected void platform_effect_setup()
 {
     if (Platform_Effect_1 != null)
     {
         // If at range, the battler 1 platform will be attached to battle 1
         if (Distance > 1)
         {
             Platform_Effect_1.loc = Battler_1_Sprite.loc;
         }
         // Otherwise it is shared between the two battlers and thus needs to be averaged between them
         else
         {
             Platform_Effect_1.loc = (Battler_1_Sprite.loc + Platform_Loc_2) / 2;
         }
         Platform_Effect_1.loc -= new Vector2(0, 8);
         Platform_Effect_1.loc -= Pan_Vector;
         Platform_Effect_1.loc += Stereoscopic_Graphic_Object.graphic_draw_offset(Battler_1_Sprite.battler_stereo_offset());
         Platform_Matrix_1      = Matrix.Identity *
                                  Matrix.CreateTranslation(new Vector3(-Platform_Effect_1.loc.X, -Platform_Effect_1.loc.Y, 0)) *
                                  platform_effect_matrix(Distance > 1, true ^ !Reverse, Platform_Effect_Ratio) *
                                  Matrix.CreateRotationZ((1 - Platform_Effect_Ratio) * Platform_Effect_Angle) *
                                  Matrix.CreateTranslation(new Vector3(
                                                               Platform_Effect_1.loc.X,
                                                               Platform_Effect_1.loc.Y,
                                                               0) +
                                                           new Vector3((Battler_2 == null || Distance == 1) ? 0 : Platform_Effect_Ratio * 4, Platform_Effect_Ratio * 2, -0.5f)) *
                                  Matrix.CreateScale(new Vector3(1, 1, 0.001f));
         if (Platform_Effect_2 != null)
         {
             Platform_Effect_2.loc  = Battler_2_Sprite.loc - new Vector2(0, 8);
             Platform_Effect_2.loc -= Pan_Vector;
             Platform_Effect_2.loc += Stereoscopic_Graphic_Object.graphic_draw_offset(Battler_1_Sprite.battler_stereo_offset());
             Platform_Matrix_2      = Matrix.Identity *
                                      Matrix.CreateTranslation(new Vector3(-Platform_Effect_2.loc.X, -Platform_Effect_2.loc.Y, 0)) *
                                      platform_effect_matrix(Distance > 1, false ^ !Reverse, Platform_Effect_Ratio) *
                                      Matrix.CreateRotationZ((1 - Platform_Effect_Ratio) * Platform_Effect_Angle) *
                                      Matrix.CreateTranslation(new Vector3(
                                                                   Platform_Effect_2.loc.X,
                                                                   Platform_Effect_2.loc.Y,
                                                                   0) +
                                                               new Vector3(Platform_Effect_Ratio * -4, Platform_Effect_Ratio * 2, -0.5f)) *
                                      Matrix.CreateScale(new Vector3(1, 1, 0.001f));
         }
     }
 }
Example #6
0
        protected override void update_phase_0()
        {
            bool cont = false;

            while (!cont)
            {
                cont = true;
                switch (Timer)
                {
                // Initialize battler sprites
                case 0:
                    initialize_battle_sprites();
                    Battler_1_Sprite.loc   = new Vector2(Battler_1_Loc.X, 176);
                    Battler_1_Sprite.scale = Vector2.One;
                    Battler_1_Sprite.reset_pose();
                    Battler_1_Sprite.visible = true;
                    if (Battler_2_Sprite != null)
                    {
                        Battler_2_Sprite.loc   = new Vector2(Battler_2_Loc.X, 176);
                        Battler_2_Sprite.scale = Vector2.One;
                        Battler_2_Sprite.reset_pose();
                        Battler_2_Sprite.visible = true;
                    }
                    Skip_Fill           = new Sprite(battle_content.Load <Texture2D>(@"Graphics/White_Square"));
                    Skip_Fill.dest_rect = new Rectangle(0, 0, Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT);
                    Skip_Fill.tint      = new Color(0, 0, 0, 255);
                    Timer++;
                    break;

                case 1:
                case 2:
                case 3:
                    Timer++;
                    break;

                case 4:
                    Timer++;
                    break;

                case 5:
                    Timer++;
                    break;

                case 6:
                    // hud
                    setup_hud();
                    while (!HUD.is_ready)
                    {
                        HUD.update();
                    }
                    // Create platforms
                    create_platforms();
                    // White screen flash
                    White_Screen           = new Sprite(battle_content.Load <Texture2D>(@"Graphics/White_Square"));
                    White_Screen.dest_rect = new Rectangle(0, 0, Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT);
                    White_Screen.visible   = false;
                    // Create background
                    Background              = new Arena_Background(background(this.background_battler));
                    Black_Backing           = new Sprite(battle_content.Load <Texture2D>(@"Graphics/White_Square"));
                    Black_Backing.dest_rect = new Rectangle(0, 0, Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT);
                    Black_Backing.tint      = new Color(0, 0, 0, 255);
                    Timer++;
                    break;

                case 8:
                case 9:
                case 10:
                case 11:
                case 12:
                case 13:
                case 14:
                case 15:
                case 16:
                case 17:
                case 18:
                case 19:
                case 20:
                case 21:
                case 22:
                case 23:
                    Skip_Fill.tint = new Color(0, 0, 0, (23 - Timer) * 16);
                    Timer++;
                    break;

                case 24:
                    Skip_Fill            = null;
                    Black_Fill           = new Sprite(battle_content.Load <Texture2D>(@"Graphics/White_Square"));
                    Black_Fill.dest_rect = new Rectangle(0, 0, Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT);
                    Black_Fill.tint      = new Color(0, 0, 0, 0);
                    if (Combat_Data != null)
                    {
                        Battler_1_Sprite.initialize_animation();
                        if (Battler_2_Sprite != null)
                        {
                            Battler_2_Sprite.initialize_animation();
                        }
                    }
                    Timer++;
                    break;

                case 36:
                    Global.Audio.BgmFadeOut(60);
                    crowd_cheer();
                    battle_start_text();
                    Timer++;
                    break;

                case 72:
                    play_battle_theme();
                    Battler_1_Sprite.start_battle();
                    if (Battler_2_Sprite != null)
                    {
                        Battler_2_Sprite.start_battle();
                    }
                    Timer++;
                    break;

                case 73:
                    if (Battler_1_Sprite.duration <= 2 && (Battler_2_Sprite == null || Battler_2_Sprite.duration <= 2))
                    {
                        check_talk(Battler_1, Battler_2, Reverse);
                        Timer++;
                    }
                    break;

                case 74:
                    if (!is_message_window_active && HUD.is_ready && !Message_Active)
                    {
                        Timer = 0;
                        Phase = 1;
                    }
                    break;

                default:
                    Timer++;
                    break;
                }
            }
        }