internal Game_Ranking calculate_ranking_progress(TactileLibrary.Data_Chapter chapter, int killed_enemies, int enemies_remaining) { float chapter_progress = Chapter_Turn >= chapter.Ranking_Turns ? 1f : Chapter_Turn / (float)chapter.Ranking_Turns; int total_enemies = killed_enemies + enemies_remaining; // How many turns it should take to finish the map float kills_per_turn = MathHelper.Lerp(total_enemies / (float)chapter.Ranking_Turns, killed_enemies / (float)Chapter_Turn, chapter_progress); int turn_to_clear = (int)Math.Round(enemies_remaining / kills_per_turn) + Chapter_Turn; // If a survive/timed map, min this with the time limit since you can't take longer than that //Yeti // How much more damage will be taken killed_enemies = Math.Max(1, killed_enemies); // Avoid divide by 0s float damage_per_enemy = MathHelper.Lerp(chapter.Ranking_Combat / (float)total_enemies, Chapter_Damage_Taken / (float)killed_enemies, chapter_progress); int damage_on_clear = (int)Math.Round(enemies_remaining * damage_per_enemy) + Chapter_Damage_Taken; // How much more exp will be gained float exp_per_enemy = MathHelper.Lerp(chapter.Ranking_Exp / (float)total_enemies, Chapter_Exp_Gain / (float)killed_enemies, chapter_progress); int exp_on_clear = (int)Math.Round(enemies_remaining * exp_per_enemy) + Chapter_Exp_Gain; return(new Game_Ranking(chapter.Id, Difficulty_Mode, turn_to_clear, damage_on_clear, exp_on_clear, Chapter_Deaths, Chapter_Completion)); }
public Chapter_Transition_Effect(TactileLibrary.Data_Chapter chapter) { // Background texture = Global.Content.Load <Texture2D>(@"Graphics/Pictures/Chapter Transition Background"); Bmp_Width = texture.Width; while ((Loop - 1) * Bmp_Width < Math.Max((Config.WINDOW_WIDTH + Config.CH_TRANS_BG_DEPTH * 2), Config.WINDOW_HEIGHT)) { Loop++; } opacity = 0; offset = new Vector2(Config.CH_TRANS_BG_DEPTH); stereoscopic = Config.CH_TRANS_BG_DEPTH; // Sigil Sigil = new Sprite(Global.Content.Load <Texture2D>(@"Graphics/Pictures/Chapter Transition Sigil")); Sigil.loc = new Vector2(Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT) / 2; Sigil.offset = new Vector2(Sigil.texture.Width, Sigil.texture.Height) / 2; Sigil.blend_mode = 1; Sigil.opacity = 0; Sigil.stereoscopic = Config.CH_TRANS_SIGIL_DEPTH; // Banner Banner = new Sprite(Global.Content.Load <Texture2D>(@"Graphics/Pictures/Chapter Transition Banner")); Banner.loc = new Vector2(Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT) / 2; Banner.offset = new Vector2(Banner.texture.Width, Banner.texture.Height) / 2; Banner.blend_mode = 1; Banner.opacity = 0; Banner.stereoscopic = Config.CH_TRANS_BANNER_DEPTH; // Banner Bg Banner_Bg = new Sprite(Global.Content.Load <Texture2D>(@"Graphics/Pictures/Chapter Transition Sigil")); Banner_Bg.loc = new Vector2(Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT) / 2; Banner_Bg.offset = new Vector2(Sigil.texture.Width, Banner.texture.Height) / 2; Banner_Bg.src_rect = new Rectangle(0, (Banner_Bg.texture.Height - Banner.texture.Height) / 2, Banner_Bg.texture.Width, Banner.texture.Height); Banner_Bg.tint = new Color(0, 0, 0, 0); Banner_Bg.stereoscopic = Config.CH_TRANS_SIGIL_DEPTH; // Text Text = new TextSprite(); string str = chapter.FullName; Text.loc = new Vector2(Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT) / 2 - new Vector2(Font_Data.text_width(str, Config.CHAPTER_FONT) / 2, 8); Text_Scissor_Rect = new Rectangle(0, (int)Banner.loc.Y - Banner.texture.Height / 2, Config.WINDOW_WIDTH, Banner.texture.Height); Text.SetFont(Config.CHAPTER_FONT, Global.Content); Text.text = str; Text.opacity = 0; Text.stereoscopic = Config.CH_TRANS_BANNER_DEPTH; // Text if (!string.IsNullOrEmpty(chapter.AlternateTitle)) { AlternateTitle = new ChapterTransitionAlternateTitle(chapter.AlternateTitle); AlternateTitle.loc = Text.loc + new Vector2(-24, -24); } // Black Screen Black_Fill = new Sprite(Global.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); }