From 4affe4617a792ff8391e27d2ae88b55bca021837 Mon Sep 17 00:00:00 2001 From: milimoe Date: Mon, 4 Nov 2024 23:00:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20rating=20=E7=AE=97?= =?UTF-8?q?=E6=B3=95=EF=BC=9B=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=BA=9B=20BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OshimaCore/Controllers/FunGameController.cs | 7 +++-- OshimaCore/Utils/FunGameUtil.cs | 31 ++++++++++++++------ OshimaModules/Skills/ColdBlue/累积之压.cs | 2 +- OshimaModules/Skills/MagicalGirl/绝对领域.cs | 2 +- OshimaModules/Skills/QingXiang/枯竭打击.cs | 2 +- OshimaModules/Skills/XinYin/心灵之火.cs | 2 +- OshimaModules/Skills/dddovo/敏捷之刃.cs | 2 +- OshimaModules/Skills/战技/疾风步.cs | 2 ++ 8 files changed, 33 insertions(+), 17 deletions(-) diff --git a/OshimaCore/Controllers/FunGameController.cs b/OshimaCore/Controllers/FunGameController.cs index 6b9c67d..ef1e092 100644 --- a/OshimaCore/Controllers/FunGameController.cs +++ b/OshimaCore/Controllers/FunGameController.cs @@ -17,11 +17,12 @@ namespace Oshima.Core.Controllers private readonly ILogger _logger = logger; [HttpGet("test")] - public List GetTest([FromQuery] bool? isweb = null, [FromQuery] bool? isteam = null) + public List GetTest([FromQuery] bool? isweb = null, [FromQuery] bool? isteam = null, [FromQuery] bool? showall = null) { bool web = isweb ?? true; bool team = isteam ?? false; - return FunGameSimulation.StartGame(false, web, team); + bool all = showall ?? false; + return FunGameSimulation.StartGame(false, web, team, all); } [HttpGet("stats")] @@ -103,12 +104,12 @@ namespace Oshima.Core.Controllers builder.AppendLine($"ÿ˺{stats.DamagePerSecond:0.##}"); builder.AppendLine($"ܼƻɱ{stats.Kills}" + (stats.Plays != 0 ? $" / {(double)stats.Kills / stats.Plays:0.##}" : "")); builder.AppendLine($"ܼ{stats.Deaths}" + (stats.Plays != 0 ? $" / {(double)stats.Deaths / stats.Plays:0.##}" : "")); + builder.AppendLine($"ɱȣ{(stats.Deaths == 0 ? stats.Kills : (stats.Kills / stats.Deaths)):0.##}"); builder.AppendLine($"ܼ{stats.Assists}" + (stats.Plays != 0 ? $" / {(double)stats.Assists / stats.Plays:0.##}" : "")); builder.AppendLine($"ܼɱ{stats.FirstKills}" + (stats.Plays != 0 ? $" / ɱʣ{(double)stats.FirstKills / stats.Plays * 100:0.##}%" : "")); builder.AppendLine($"ܼ{stats.FirstDeaths}" + (stats.Plays != 0 ? $" / ʣ{(double)stats.FirstDeaths / stats.Plays * 100:0.##}%" : "")); builder.AppendLine($"ܼƲ{stats.Plays}"); builder.AppendLine($"ܼƹھ{stats.Wins}"); - builder.AppendLine($"ܼǰ{stats.Top3s}"); builder.AppendLine($"ܼưܳ{stats.Loses}"); List names = [.. FunGameSimulation.TeamCharacterStatistics.OrderByDescending(kv => kv.Value.Winrates).Select(kv => kv.Key.GetName())]; diff --git a/OshimaCore/Utils/FunGameUtil.cs b/OshimaCore/Utils/FunGameUtil.cs index f84b764..b0f8af6 100644 --- a/OshimaCore/Utils/FunGameUtil.cs +++ b/OshimaCore/Utils/FunGameUtil.cs @@ -22,12 +22,14 @@ namespace Oshima.Core.Utils public static bool IsRuning { get; set; } = false; public static bool IsWeb { get; set; } = false; public static bool PrintOut { get; set; } = false; + public static bool DeathMatchRoundDetail { get; set; } = false; public static string Msg { get; set; } = ""; - public static List StartGame(bool printout, bool isWeb = false, bool isTeam = false) + public static List StartGame(bool printout, bool isWeb = false, bool isTeam = false, bool deathMatchRoundDetail = false) { PrintOut = printout; IsWeb = isWeb; + DeathMatchRoundDetail = deathMatchRoundDetail; try { if (IsRuning) return ["游戏正在模拟中,请勿重复请求!"]; @@ -407,7 +409,7 @@ namespace Oshima.Core.Utils if (characterToAct != null) { WriteLine($"=== Round {i++} ==="); - WriteLine("现在是 [ " + characterToAct + " ] 的回合!"); + WriteLine("现在是 [ " + characterToAct + (isTeam ? "(" + (actionQueue.GetTeam(characterToAct)?.Name ?? "") + ")" : "") + " ] 的回合!"); bool isGameEnd = actionQueue.ProcessTurn(characterToAct); if (isGameEnd) @@ -450,11 +452,15 @@ namespace Oshima.Core.Utils } } - if (actionQueue.LastRound.Targets.Any(c => c.HP <= 0)) + if (actionQueue.LastRound.HasKill) { + string roundMsg = Msg; + if (!deathMatchRoundDetail) + { + roundMsg = actionQueue.LastRound.ToString(); + } if (!isWeb) { - string roundMsg = Msg; string[] strs = roundMsg.Split("==== 角色状态 ===="); if (strs.Length > 0) { @@ -462,7 +468,10 @@ namespace Oshima.Core.Utils } result.Add(roundMsg); } - else result.Add(Msg); + else + { + result.Add(roundMsg); + } } } @@ -824,7 +833,11 @@ namespace Oshima.Core.Utils baseScore += 0.5; } } - + else + { + baseScore = baseScore * 0.6 + 0.4 * (stats.Kills / (stats.Kills + stats.Deaths + 0.01)); + } + // 伤害贡献 double logDamageContribution = Math.Log(1 + (stats.TotalDamage / (stats.TotalTakenDamage + 1e-6))); @@ -838,14 +851,14 @@ namespace Oshima.Core.Utils teamContribution = (stats.Kills + stats.Assists) / (team.Score + 0.01); if (team.IsWinner) { - teamContribution += 0.2; + teamContribution += 0.15; } } // 权重设置 double k = stats.Deaths > 0 ? 0.2 : 0.075; // 伤害贡献权重 - double l = stats.Deaths > 0 ? 0.3 : 0.05; // 存活时间权重 - double t = stats.Deaths > 0 ? 0.225 : 0.1; // 参团率权重 + double l = stats.Deaths > 0 ? 0.2 : 0.05; // 存活时间权重 + double t = stats.Deaths > 0 ? 0.2 : 0.075; // 参团率权重 // 计算最终评分 double rating = baseScore + k * logDamageContribution + l * liveTimeContribution + t * teamContribution; diff --git a/OshimaModules/Skills/ColdBlue/累积之压.cs b/OshimaModules/Skills/ColdBlue/累积之压.cs index defc2f6..923ced8 100644 --- a/OshimaModules/Skills/ColdBlue/累积之压.cs +++ b/OshimaModules/Skills/ColdBlue/累积之压.cs @@ -33,7 +33,7 @@ namespace Oshima.FunGame.OshimaModules.Skills public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult) { - if (character == Skill.Character && damageResult != DamageResult.Evaded && !是否是嵌套伤害) + if (character == Skill.Character && damageResult != DamageResult.Evaded && !是否是嵌套伤害 && enemy.HP > 0) { // 叠标记 IEnumerable effects = enemy.Effects.Where(e => e is 累积之压标记); diff --git a/OshimaModules/Skills/MagicalGirl/绝对领域.cs b/OshimaModules/Skills/MagicalGirl/绝对领域.cs index d38a955..645bc5b 100644 --- a/OshimaModules/Skills/MagicalGirl/绝对领域.cs +++ b/OshimaModules/Skills/MagicalGirl/绝对领域.cs @@ -54,7 +54,7 @@ namespace Oshima.FunGame.OshimaModules.Skills return false; } - public override void OnSkillCasting(Character caster) + public override void OnSkillCasting(Character caster, List targets) { 释放时的能量值 = caster.EP; } diff --git a/OshimaModules/Skills/QingXiang/枯竭打击.cs b/OshimaModules/Skills/QingXiang/枯竭打击.cs index 3884354..99b32b3 100644 --- a/OshimaModules/Skills/QingXiang/枯竭打击.cs +++ b/OshimaModules/Skills/QingXiang/枯竭打击.cs @@ -31,7 +31,7 @@ namespace Oshima.FunGame.OshimaModules.Skills public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult) { - if (character == Skill.Character && damageResult != DamageResult.Evaded && !是否是嵌套伤害) + if (character == Skill.Character && damageResult != DamageResult.Evaded && !是否是嵌套伤害 && enemy.HP > 0) { // 减少能量 double EP = Random.Shared.Next(7, 15); diff --git a/OshimaModules/Skills/XinYin/心灵之火.cs b/OshimaModules/Skills/XinYin/心灵之火.cs index 09a6976..52a65de 100644 --- a/OshimaModules/Skills/XinYin/心灵之火.cs +++ b/OshimaModules/Skills/XinYin/心灵之火.cs @@ -34,7 +34,7 @@ namespace Oshima.FunGame.OshimaModules.Skills public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult) { - if (character == Skill.Character && isNormalAttack && 冷却时间 == 0 && !是否是嵌套普通攻击 && GamingQueue != null) + if (character == Skill.Character && isNormalAttack && 冷却时间 == 0 && !是否是嵌套普通攻击 && GamingQueue != null && enemy.HP > 0) { WriteLine($"[ {character} ] 发动了心灵之火!额外进行一次普通攻击!"); 冷却时间 = 基础冷却时间; diff --git a/OshimaModules/Skills/dddovo/敏捷之刃.cs b/OshimaModules/Skills/dddovo/敏捷之刃.cs index 3379b7a..780df7e 100644 --- a/OshimaModules/Skills/dddovo/敏捷之刃.cs +++ b/OshimaModules/Skills/dddovo/敏捷之刃.cs @@ -33,7 +33,7 @@ namespace Oshima.FunGame.OshimaModules.Skills public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult) { - if (character == Skill.Character && isNormalAttack && damageResult != DamageResult.Evaded && !是否是嵌套伤害) + if (character == Skill.Character && isNormalAttack && damageResult != DamageResult.Evaded && !是否是嵌套伤害 && enemy.HP > 0) { WriteLine($"[ {character} ] 发动了敏捷之刃!将造成额外伤害!"); 是否是嵌套伤害 = true; diff --git a/OshimaModules/Skills/战技/疾风步.cs b/OshimaModules/Skills/战技/疾风步.cs index f783208..8547c8b 100644 --- a/OshimaModules/Skills/战技/疾风步.cs +++ b/OshimaModules/Skills/战技/疾风步.cs @@ -11,6 +11,7 @@ namespace Oshima.FunGame.OshimaModules.Skills public override double EPCost => 60; public override double CD => 35; public override double HardnessTime { get; set; } = 5; + public override bool CanSelectSelf => true; public 疾风步(Character? character = null) : base(SkillType.Skill, character) { @@ -73,6 +74,7 @@ namespace Oshima.FunGame.OshimaModules.Skills { if (!caster.Effects.Contains(this)) { + GamingQueue?.LastRound.Effects.Add(caster, EffectType.Unselectable); 首次伤害 = true; 破隐一击 = false; RemainDuration = Duration;