mirror of
https://github.com/oshima-studios/OshimaGameModule.git
synced 2025-05-07 03:09:34 +08:00
使用新队列,添加新接口
This commit is contained in:
parent
26509a0839
commit
eae54423fa
@ -45,7 +45,7 @@ namespace Oshima.FunGame.OshimaModules.Effects.SkillEffects
|
||||
target.Effects.Add(e);
|
||||
e.OnEffectGained(target);
|
||||
e.EffectType = EffectType.Haste;
|
||||
GamingQueue?.LastRound.Effects.TryAdd(target, [e.EffectType]);
|
||||
GamingQueue?.LastRound.ApplyEffects.TryAdd(target, [e.EffectType]);
|
||||
GamingQueue?.ChangeCharacterHardnessTime(target, -0.3, true, false);
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ namespace Oshima.FunGame.OshimaModules.Effects.SkillEffects
|
||||
封技 e = new(Skill, caster, false, 0, 1);
|
||||
enemy.Effects.Add(e);
|
||||
e.OnEffectGained(enemy);
|
||||
GamingQueue?.LastRound.Effects.TryAdd(enemy, [e.EffectType]);
|
||||
GamingQueue?.LastRound.ApplyEffects.TryAdd(enemy, [e.EffectType]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ namespace Oshima.FunGame.OshimaModules.Effects.SkillEffects
|
||||
眩晕 e = new(Skill, caster, _durative, _duration, _durationTurn);
|
||||
enemy.Effects.Add(e);
|
||||
e.OnEffectGained(enemy);
|
||||
GamingQueue?.LastRound.Effects.TryAdd(enemy, [e.EffectType]);
|
||||
GamingQueue?.LastRound.ApplyEffects.TryAdd(enemy, [e.EffectType]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ namespace Oshima.FunGame.OshimaModules.Effects.SkillEffects
|
||||
e.OnEffectGained(target);
|
||||
e.EffectType = EffectType.Slow;
|
||||
e.IsDebuff = true;
|
||||
GamingQueue?.LastRound.Effects.TryAdd(target, [e.EffectType]);
|
||||
GamingQueue?.LastRound.ApplyEffects.TryAdd(target, [e.EffectType]);
|
||||
GamingQueue?.ChangeCharacterHardnessTime(target, 0.3, true, false);
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ namespace Oshima.FunGame.OshimaModules.Skills
|
||||
caster.Effects.Add(this);
|
||||
OnEffectGained(caster);
|
||||
}
|
||||
GamingQueue?.LastRound.Effects.TryAdd(caster, [EffectType.DamageBoost, EffectType.Lifesteal]);
|
||||
GamingQueue?.LastRound.ApplyEffects.TryAdd(caster, [EffectType.DamageBoost, EffectType.Lifesteal]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ namespace Oshima.FunGame.OshimaModules.Skills
|
||||
caster.Effects.Add(this);
|
||||
OnEffectGained(caster);
|
||||
}
|
||||
GamingQueue?.LastRound.Effects.TryAdd(caster, [EffectType.Invulnerable]);
|
||||
GamingQueue?.LastRound.ApplyEffects.TryAdd(caster, [EffectType.Invulnerable]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ namespace Oshima.FunGame.OshimaModules.Skills
|
||||
caster.Effects.Add(this);
|
||||
OnEffectGained(caster);
|
||||
}
|
||||
GamingQueue?.LastRound.Effects.TryAdd(caster, [EffectType.CritBoost, EffectType.PenetrationBoost]);
|
||||
GamingQueue?.LastRound.ApplyEffects.TryAdd(caster, [EffectType.CritBoost, EffectType.PenetrationBoost]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ namespace Oshima.FunGame.OshimaModules.Skills
|
||||
caster.Effects.Add(this);
|
||||
OnEffectGained(caster);
|
||||
}
|
||||
GamingQueue?.LastRound.Effects.TryAdd(caster, [EffectType.MPRegen, EffectType.Haste]);
|
||||
GamingQueue?.LastRound.ApplyEffects.TryAdd(caster, [EffectType.MPRegen, EffectType.Haste]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ namespace Oshima.FunGame.OshimaModules.Skills
|
||||
caster.Effects.Add(this);
|
||||
OnEffectGained(caster);
|
||||
}
|
||||
GamingQueue?.LastRound.Effects.TryAdd(caster, [EffectType.DamageBoost]);
|
||||
GamingQueue?.LastRound.ApplyEffects.TryAdd(caster, [EffectType.DamageBoost]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ namespace Oshima.FunGame.OshimaModules.Skills
|
||||
caster.Effects.Add(this);
|
||||
OnEffectGained(caster);
|
||||
}
|
||||
GamingQueue?.LastRound.Effects.TryAdd(caster, [EffectType.DamageBoost]);
|
||||
GamingQueue?.LastRound.ApplyEffects.TryAdd(caster, [EffectType.DamageBoost]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ namespace Oshima.FunGame.OshimaModules.Skills
|
||||
caster.Effects.Add(this);
|
||||
OnEffectGained(caster);
|
||||
}
|
||||
GamingQueue?.LastRound.Effects.TryAdd(caster, [EffectType.DamageBoost, EffectType.Haste, EffectType.DefenseBoost]);
|
||||
GamingQueue?.LastRound.ApplyEffects.TryAdd(caster, [EffectType.DamageBoost, EffectType.Haste, EffectType.DefenseBoost]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ namespace Oshima.FunGame.OshimaModules.Skills
|
||||
caster.Effects.Add(this);
|
||||
OnEffectGained(caster);
|
||||
}
|
||||
GamingQueue?.LastRound.Effects.TryAdd(caster, [EffectType.Lifesteal]);
|
||||
GamingQueue?.LastRound.ApplyEffects.TryAdd(caster, [EffectType.Lifesteal]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ namespace Oshima.FunGame.OshimaModules.Skills
|
||||
caster.Effects.Add(this);
|
||||
OnEffectGained(caster);
|
||||
}
|
||||
GamingQueue?.LastRound.Effects.TryAdd(caster, [EffectType.DamageBoost, EffectType.PenetrationBoost]);
|
||||
GamingQueue?.LastRound.ApplyEffects.TryAdd(caster, [EffectType.DamageBoost, EffectType.PenetrationBoost]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ namespace Oshima.FunGame.OshimaModules.Skills
|
||||
caster.Effects.Add(this);
|
||||
OnEffectGained(caster);
|
||||
}
|
||||
GamingQueue?.LastRound.Effects.TryAdd(caster, [EffectType.DefenseBoost]);
|
||||
GamingQueue?.LastRound.ApplyEffects.TryAdd(caster, [EffectType.DefenseBoost]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ namespace Oshima.FunGame.OshimaModules.Skills
|
||||
caster.Effects.Add(this);
|
||||
OnEffectGained(caster);
|
||||
}
|
||||
GamingQueue?.LastRound.Effects.TryAdd(caster, [EffectType.DamageBoost, EffectType.Lifesteal]);
|
||||
GamingQueue?.LastRound.ApplyEffects.TryAdd(caster, [EffectType.DamageBoost, EffectType.Lifesteal]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ namespace Oshima.FunGame.OshimaModules.Skills
|
||||
{
|
||||
if (!caster.Effects.Contains(this))
|
||||
{
|
||||
GamingQueue?.LastRound.Effects.Add(caster, [EffectType]);
|
||||
GamingQueue?.LastRound.ApplyEffects.Add(caster, [EffectType]);
|
||||
首次伤害 = true;
|
||||
破隐一击 = false;
|
||||
RemainDuration = Duration;
|
||||
|
@ -167,7 +167,7 @@ namespace Oshima.FunGame.OshimaServers
|
||||
SendAllGamingMessage(obj, data, c.GetInfo());
|
||||
}
|
||||
|
||||
ActionQueue actionQueue = new(inGameCharacters, false, (str) =>
|
||||
MixGamingQueue actionQueue = new(inGameCharacters, (str) =>
|
||||
{
|
||||
SendAllGamingMessage(obj, data, str);
|
||||
});
|
||||
@ -332,7 +332,7 @@ namespace Oshima.FunGame.OshimaServers
|
||||
}
|
||||
}
|
||||
|
||||
public static void 空投(ActionQueue queue, double totalTime)
|
||||
public static void 空投(GamingQueue queue, double totalTime)
|
||||
{
|
||||
Item[] 这次发放的空投;
|
||||
if (totalTime == 0)
|
||||
|
@ -7,7 +7,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
{
|
||||
public class FunGameActionQueue
|
||||
{
|
||||
public ActionQueue ActionQueue { get; set; } = new();
|
||||
public GamingQueue GamingQueue { get; set; } = new();
|
||||
public bool IsWeb { get; set; } = false;
|
||||
public bool PrintOut { get; set; } = false;
|
||||
public bool DeathMatchRoundDetail { get; set; } = false;
|
||||
@ -15,7 +15,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
|
||||
private string _msg = "";
|
||||
|
||||
public async Task<List<string>> StartGame(List<Character> characters, bool printout = false, bool isWeb = false, bool deathMatchRoundDetail = false, bool showRoundEndDetail = false, bool showAllRound = false)
|
||||
public async Task<List<string>> StartGame(List<Character> characters, int maxRespawnTimes = 0, int maxScoreToWin = 0, bool printout = false, bool isWeb = false, bool deathMatchRoundDetail = false, bool showRoundEndDetail = false, bool showAllRound = false)
|
||||
{
|
||||
Result.Clear();
|
||||
PrintOut = printout;
|
||||
@ -30,7 +30,11 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
if (PrintOut) Console.WriteLine();
|
||||
|
||||
// 创建顺序表并排序
|
||||
ActionQueue actionQueue = new(characters, false, WriteLine);
|
||||
MixGamingQueue actionQueue = new(characters, WriteLine)
|
||||
{
|
||||
MaxRespawnTimes = maxRespawnTimes,
|
||||
MaxScoreToWin = maxScoreToWin
|
||||
};
|
||||
actionQueue.SetCharactersToAIControl(false, characters);
|
||||
foreach (Character dead in characters)
|
||||
{
|
||||
@ -40,7 +44,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
actionQueue.Eliminated.Add(dead);
|
||||
}
|
||||
}
|
||||
ActionQueue = actionQueue;
|
||||
GamingQueue = actionQueue;
|
||||
if (PrintOut) Console.WriteLine();
|
||||
|
||||
// 总游戏时长
|
||||
@ -156,7 +160,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
}
|
||||
|
||||
// 赛后统计
|
||||
FunGameService.GetCharacterRating(actionQueue.CharacterStatistics, false, actionQueue.EliminatedTeams);
|
||||
FunGameService.GetCharacterRating(actionQueue.CharacterStatistics, false, []);
|
||||
|
||||
// 统计技术得分,评选 MVP
|
||||
Character? mvp = actionQueue.CharacterStatistics.OrderByDescending(d => d.Value.Rating).Select(d => d.Key).FirstOrDefault();
|
||||
@ -244,7 +248,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
List<Character> characters = [.. teams.SelectMany(t => t.Members)];
|
||||
|
||||
// 创建顺序表并排序
|
||||
ActionQueue actionQueue = new(characters, true, WriteLine)
|
||||
TeamGamingQueue actionQueue = new(characters, WriteLine)
|
||||
{
|
||||
MaxRespawnTimes = maxRespawnTimes,
|
||||
MaxScoreToWin = maxScoreToWin
|
||||
@ -258,7 +262,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
actionQueue.Eliminated.Add(dead);
|
||||
}
|
||||
}
|
||||
ActionQueue = actionQueue;
|
||||
GamingQueue = actionQueue;
|
||||
if (PrintOut) Console.WriteLine();
|
||||
|
||||
// 总游戏时长
|
||||
@ -424,9 +428,9 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
if (PrintOut) Console.WriteLine(str);
|
||||
}
|
||||
|
||||
public static async Task<List<string>> NewAndStartGame(List<Character> characters, bool printout = false, bool isWeb = false, bool deathMatchRoundDetail = false, bool showRoundEndDetail = false, bool showAllRound = false)
|
||||
public static async Task<List<string>> NewAndStartGame(List<Character> characters, int maxRespawnTimes = 0, int maxScoreToWin = 0, bool printout = false, bool isWeb = false, bool deathMatchRoundDetail = false, bool showRoundEndDetail = false, bool showAllRound = false)
|
||||
{
|
||||
return await new FunGameActionQueue().StartGame(characters, printout, isWeb, deathMatchRoundDetail, showRoundEndDetail, showAllRound);
|
||||
return await new FunGameActionQueue().StartGame(characters, maxRespawnTimes, maxScoreToWin, printout, isWeb, deathMatchRoundDetail, showRoundEndDetail, showAllRound);
|
||||
}
|
||||
|
||||
public static async Task<List<string>> NewAndStartTeamGame(List<Team> teams, int maxRespawnTimes = 0, int maxScoreToWin = 0, bool printout = false, bool isWeb = false, bool deathMatchRoundDetail = false, bool showRoundEndDetail = false, bool showAllRound = false)
|
||||
|
@ -1447,10 +1447,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
if (team is null)
|
||||
{
|
||||
baseScore += stats.Kills * 0.1;
|
||||
if (stats.Deaths == 0)
|
||||
{
|
||||
baseScore += 0.5;
|
||||
}
|
||||
baseScore -= stats.Deaths * 0.05;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1458,7 +1455,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
}
|
||||
|
||||
// 伤害贡献
|
||||
double logDamageContribution = Math.Log(1 + (stats.TotalDamage / (stats.TotalTakenDamage + 1)));
|
||||
double logDamageContribution = Math.Log(1 + (stats.TotalDamage / (stats.TotalTakenDamage + 1.75)));
|
||||
|
||||
// 存活时间贡献
|
||||
double liveTimeContribution = Math.Log(1 + (stats.LiveTime / (stats.TotalTakenDamage + 0.01) * 100));
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System.Text;
|
||||
using Milimoe.FunGame.Core.Api.Utility;
|
||||
using Milimoe.FunGame.Core.Entity;
|
||||
using Milimoe.FunGame.Core.Interface.Entity;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using Milimoe.FunGame.Core.Model;
|
||||
using Oshima.FunGame.OshimaModules.Effects.OpenEffects;
|
||||
@ -14,6 +15,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
public static Dictionary<Character, CharacterStatistics> TeamCharacterStatistics { get; } = [];
|
||||
public static PluginConfig StatsConfig { get; } = new("FunGameSimulation", nameof(CharacterStatistics));
|
||||
public static PluginConfig TeamStatsConfig { get; } = new("FunGameSimulation", nameof(TeamCharacterStatistics));
|
||||
public static PluginConfig LastRecordConfig { get; } = new("FunGameSimulation", "LastRecord");
|
||||
public static bool IsRuning { get; set; } = false;
|
||||
public static bool IsWeb { get; set; } = false;
|
||||
public static bool PrintOut { get; set; } = false;
|
||||
@ -24,6 +26,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
{
|
||||
CharacterStatistics.Clear();
|
||||
TeamCharacterStatistics.Clear();
|
||||
LastRecordConfig.Clear();
|
||||
|
||||
foreach (Character c in FunGameConstant.Characters)
|
||||
{
|
||||
@ -54,7 +57,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<List<string>> StartSimulationGame(bool printout, bool isWeb = false, bool isTeam = false, bool deathMatchRoundDetail = false)
|
||||
public static async Task<List<string>> StartSimulationGame(bool printout, bool isWeb = false, bool isTeam = false, bool deathMatchRoundDetail = false, int maxRespawnTimesMix = 1)
|
||||
{
|
||||
PrintOut = printout;
|
||||
IsWeb = isWeb;
|
||||
@ -64,6 +67,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
if (IsRuning) return ["游戏正在模拟中,请勿重复请求!"];
|
||||
|
||||
List<string> result = [];
|
||||
List<string> lastRecord = [];
|
||||
Msg = "";
|
||||
|
||||
IsRuning = true;
|
||||
@ -123,11 +127,25 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
}
|
||||
|
||||
// 创建顺序表并排序
|
||||
ActionQueue actionQueue = new(characters, isTeam, WriteLine);
|
||||
GamingQueue actionQueue;
|
||||
MixGamingQueue? mgq = null;
|
||||
TeamGamingQueue? tgq = null;
|
||||
if (isTeam)
|
||||
{
|
||||
actionQueue.MaxRespawnTimes = -1;
|
||||
actionQueue.MaxScoreToWin = 30;
|
||||
tgq = new TeamGamingQueue(characters, WriteLine)
|
||||
{
|
||||
MaxRespawnTimes = -1,
|
||||
MaxScoreToWin = 30
|
||||
};
|
||||
actionQueue = tgq;
|
||||
}
|
||||
else
|
||||
{
|
||||
mgq = new MixGamingQueue(characters, WriteLine)
|
||||
{
|
||||
MaxRespawnTimes = maxRespawnTimesMix
|
||||
};
|
||||
actionQueue = mgq;
|
||||
}
|
||||
if (PrintOut) Console.WriteLine();
|
||||
|
||||
@ -177,7 +195,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
if (PrintOut) Console.WriteLine();
|
||||
|
||||
// 团队模式
|
||||
if (isTeam)
|
||||
if (isTeam && actionQueue is TeamGamingQueue tg)
|
||||
{
|
||||
Msg = "=== 团队模式随机分组 ===\r\n\r\n";
|
||||
// 打乱角色列表
|
||||
@ -201,12 +219,12 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
}
|
||||
|
||||
// 添加到团队字典
|
||||
actionQueue.AddTeam("队伍一", group1);
|
||||
actionQueue.AddTeam("队伍二", group2);
|
||||
tg.AddTeam("队伍一", group1);
|
||||
tg.AddTeam("队伍二", group2);
|
||||
|
||||
foreach (string team in actionQueue.Teams.Keys)
|
||||
foreach (string team in tg.Teams.Keys)
|
||||
{
|
||||
WriteLine($"团队【{team}】的成员:\r\n{string.Join("\r\n", actionQueue.Teams[team].Members)}\r\n");
|
||||
WriteLine($"团队【{team}】的成员:\r\n{string.Join("\r\n", tg.Teams[team].Members)}\r\n");
|
||||
}
|
||||
result.Add(Msg);
|
||||
}
|
||||
@ -235,6 +253,11 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
int i = 1;
|
||||
while (i < maxRound)
|
||||
{
|
||||
if (i != 1)
|
||||
{
|
||||
lastRecord.Add(actionQueue.LastRound.ToString());
|
||||
}
|
||||
|
||||
Msg = "";
|
||||
if (i == maxRound - 1)
|
||||
{
|
||||
@ -259,8 +282,8 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
WriteLine("[ " + winner + " ] 对 [ " + c + " ] 造成了 99999999999 点真实伤害。");
|
||||
await actionQueue.DeathCalculationAsync(winner, c);
|
||||
}
|
||||
await actionQueue.EndGameInfo(winner);
|
||||
result.Add(Msg);
|
||||
mgq?.EndGameInfo(winner);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -272,13 +295,14 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
if (characterToAct != null)
|
||||
{
|
||||
WriteLine($"=== Round {i++} ===");
|
||||
WriteLine("现在是 [ " + characterToAct + (isTeam ? "(" + (actionQueue.GetTeam(characterToAct)?.Name ?? "") + ")" : "") + " ] 的回合!");
|
||||
WriteLine("现在是 [ " + characterToAct + (tgq != null ? "(" + (tgq.GetTeam(characterToAct)?.Name ?? "") + ")" : "") + " ] 的回合!");
|
||||
|
||||
bool isGameEnd = await actionQueue.ProcessTurnAsync(characterToAct);
|
||||
|
||||
if (isGameEnd)
|
||||
{
|
||||
result.Add(Msg);
|
||||
lastRecord.Add(actionQueue.LastRound.ToString());
|
||||
break;
|
||||
}
|
||||
|
||||
@ -292,7 +316,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
roundMsg = Msg;
|
||||
if (!deathMatchRoundDetail)
|
||||
{
|
||||
roundMsg = actionQueue.LastRound.ToString().Trim() + $"\r\n{(isTeam ? $"比分:{string.Join(" / ", actionQueue.Teams.Values.Select(t => $"{t.Name}({t.Score})"))},击杀来自{actionQueue.GetTeam(actionQueue.LastRound.Actor)}" : "")}\r\n";
|
||||
roundMsg = actionQueue.LastRound.ToString().Trim() + $"\r\n{(tgq != null ? $"比分:{string.Join(" / ", tgq.Teams.Values.Select(t => $"{t.Name}({t.Score})"))},击杀来自{tgq.GetTeam(tgq.LastRound.Actor)}" : "")}\r\n";
|
||||
}
|
||||
Msg = "";
|
||||
}
|
||||
@ -351,7 +375,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
}
|
||||
|
||||
// 赛后统计
|
||||
FunGameService.GetCharacterRating(actionQueue.CharacterStatistics, isTeam, actionQueue.EliminatedTeams);
|
||||
FunGameService.GetCharacterRating(actionQueue.CharacterStatistics, isTeam, tgq != null ? tgq.EliminatedTeams : []);
|
||||
|
||||
// 统计技术得分,评选 MVP
|
||||
Character? mvp = actionQueue.CharacterStatistics.OrderByDescending(d => d.Value.Rating).Select(d => d.Key).FirstOrDefault();
|
||||
@ -360,7 +384,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
{
|
||||
CharacterStatistics stats = actionQueue.CharacterStatistics[mvp];
|
||||
stats.MVPs++;
|
||||
mvpBuilder.AppendLine($"{(isTeam ? "[ " + actionQueue.GetTeamFromEliminated(mvp)?.Name + " ] " : "")}[ {mvp.ToStringWithLevel()} ]");
|
||||
mvpBuilder.AppendLine($"{(tgq != null ? "[ " + tgq.GetTeamFromEliminated(mvp)?.Name + " ] " : "")}[ {mvp.ToStringWithLevel()} ]");
|
||||
mvpBuilder.AppendLine($"技术得分:{stats.Rating:0.0#} / 击杀数:{stats.Kills} / 助攻数:{stats.Assists}{(actionQueue.MaxRespawnTimes != 0 ? " / 死亡数:" + stats.Deaths : "")}");
|
||||
mvpBuilder.AppendLine($"存活时长:{stats.LiveTime:0.##} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn}");
|
||||
mvpBuilder.AppendLine($"控制时长:{stats.ControlTime:0.##} / 总计治疗:{stats.TotalHeal:0.##}");
|
||||
@ -379,20 +403,32 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
else
|
||||
{
|
||||
StringBuilder ratingBuilder = new();
|
||||
if (isTeam)
|
||||
if (tgq != null)
|
||||
{
|
||||
ratingBuilder.AppendLine($"=== 赛后数据 ===");
|
||||
foreach (Team team in actionQueue.EliminatedTeams)
|
||||
foreach (Team team in tgq.EliminatedTeams)
|
||||
{
|
||||
ratingBuilder.AppendLine($"☆--- [ {team} ] ---☆");
|
||||
foreach (Character character in actionQueue.CharacterStatistics.Where(d => team.Members.Contains(d.Key))
|
||||
foreach (Character character in tgq.CharacterStatistics.Where(d => team.Members.Contains(d.Key))
|
||||
.OrderByDescending(d => d.Value.Rating).Select(d => d.Key))
|
||||
{
|
||||
CharacterStatistics stats = actionQueue.CharacterStatistics[character];
|
||||
CharacterStatistics stats = tgq.CharacterStatistics[character];
|
||||
ratingBuilder.AppendLine($"[ {stats.Rating:0.0#} ] {character}({stats.Kills} / {stats.Assists} / {stats.Deaths})");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (mgq != null)
|
||||
{
|
||||
ratingBuilder.AppendLine($"=== 赛后数据 ===");
|
||||
foreach (Character statCharacter in actionQueue.CharacterStatistics
|
||||
.OrderBy(kv => kv.Value.Deaths)
|
||||
.ThenByDescending(kv => kv.Value.Rating)
|
||||
.ThenByDescending(kv => kv.Value.Kills).Select(kv => kv.Key))
|
||||
{
|
||||
CharacterStatistics stats = actionQueue.CharacterStatistics[statCharacter];
|
||||
ratingBuilder.AppendLine($"[ {stats.Rating:0.0#} ] {statCharacter}({stats.Kills} / {stats.Assists} / {stats.Deaths})");
|
||||
}
|
||||
}
|
||||
WriteLine("=== 本场比赛最佳角色 ===");
|
||||
Msg = $"=== 本场比赛最佳角色 ===\r\n";
|
||||
WriteLine(mvpBuilder.ToString() + "\r\n\r\n" + ratingBuilder.ToString());
|
||||
@ -404,14 +440,14 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
}
|
||||
}
|
||||
|
||||
if (isTeam)
|
||||
if (tgq != null)
|
||||
{
|
||||
foreach (Character character in actionQueue.CharacterStatistics.OrderByDescending(d => d.Value.Rating).Select(d => d.Key))
|
||||
foreach (Character character in tgq.CharacterStatistics.OrderByDescending(d => d.Value.Rating).Select(d => d.Key))
|
||||
{
|
||||
StringBuilder builder = new();
|
||||
CharacterStatistics stats = actionQueue.CharacterStatistics[character];
|
||||
builder.AppendLine($"{(isWeb ? count + "." : ("[ " + actionQueue.GetTeamFromEliminated(character)?.Name + " ]" ?? ""))} [ {character.ToStringWithLevel()} ]");
|
||||
builder.AppendLine($"技术得分:{stats.Rating:0.0#} / 击杀数:{stats.Kills} / 助攻数:{stats.Assists}{(actionQueue.MaxRespawnTimes != 0 ? " / 死亡数:" + stats.Deaths : "")}");
|
||||
CharacterStatistics stats = tgq.CharacterStatistics[character];
|
||||
builder.AppendLine($"{(isWeb ? count + "." : ("[ " + tgq.GetTeamFromEliminated(character)?.Name + " ]" ?? ""))} [ {character.ToStringWithLevel()} ]");
|
||||
builder.AppendLine($"技术得分:{stats.Rating:0.0#} / 击杀数:{stats.Kills} / 助攻数:{stats.Assists}{(tgq.MaxRespawnTimes != 0 ? " / 死亡数:" + stats.Deaths : "")}");
|
||||
builder.AppendLine($"存活时长:{stats.LiveTime:0.##} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn}");
|
||||
builder.AppendLine($"控制时长:{stats.ControlTime:0.##} / 总计治疗:{stats.TotalHeal:0.##}");
|
||||
builder.AppendLine($"总计伤害:{stats.TotalDamage:0.##} / 总计物理伤害:{stats.TotalPhysicalDamage:0.##} / 总计魔法伤害:{stats.TotalMagicDamage:0.##}");
|
||||
@ -464,16 +500,17 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
}
|
||||
|
||||
result.Add(Msg);
|
||||
lastRecord.Add(Msg);
|
||||
|
||||
// 显示每个角色的信息
|
||||
if (isWeb)
|
||||
{
|
||||
if (isTeam)
|
||||
if (tgq != null)
|
||||
{
|
||||
top = 1;
|
||||
for (i = actionQueue.EliminatedTeams.Count - 1; i >= 0; i--)
|
||||
for (i = tgq.EliminatedTeams.Count - 1; i >= 0; i--)
|
||||
{
|
||||
Team team = actionQueue.EliminatedTeams[i];
|
||||
Team team = tgq.EliminatedTeams[i];
|
||||
string topTeam = "";
|
||||
if (top == 1)
|
||||
{
|
||||
@ -493,7 +530,9 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
}
|
||||
foreach (Character character in team.Members)
|
||||
{
|
||||
result.Add($"== {topTeam}团队 [ {team.Name} ] ==\r\n== 角色:[ {character} ] ==\r\n{character.GetInfo()}");
|
||||
string msg = $"== {topTeam}团队 [ {team.Name} ] ==\r\n== 角色:[ {character} ] ==\r\n{character.GetInfo()}";
|
||||
result.Add(msg);
|
||||
lastRecord.Add(msg);
|
||||
}
|
||||
top++;
|
||||
}
|
||||
@ -503,7 +542,9 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
for (i = actionQueue.Eliminated.Count - 1; i >= 0; i--)
|
||||
{
|
||||
Character character = actionQueue.Eliminated[i];
|
||||
result.Add($"=== 角色 [ {character} ] ===\r\n{character.GetInfo()}");
|
||||
string msg = $"=== 角色 [ {character} ] ===\r\n{character.GetInfo()}";
|
||||
result.Add(msg);
|
||||
lastRecord.Add(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -531,6 +572,13 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
}
|
||||
}
|
||||
|
||||
lock (LastRecordConfig)
|
||||
{
|
||||
LastRecordConfig.Add("last", result);
|
||||
LastRecordConfig.Add("full", lastRecord);
|
||||
LastRecordConfig.SaveConfig();
|
||||
}
|
||||
|
||||
IsRuning = false;
|
||||
}
|
||||
|
||||
@ -550,7 +598,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
if (PrintOut) Console.WriteLine(str);
|
||||
}
|
||||
|
||||
public static void 空投(ActionQueue queue, int mQuality, int wQuality, int aQuality, int sQuality, int acQuality)
|
||||
public static void 空投(GamingQueue queue, int mQuality, int wQuality, int aQuality, int sQuality, int acQuality)
|
||||
{
|
||||
foreach (Character character in queue.Queue)
|
||||
{
|
||||
|
@ -31,12 +31,19 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpGet("test")]
|
||||
public async Task<List<string>> GetTest([FromQuery] bool? isweb = null, [FromQuery] bool? isteam = null, [FromQuery] bool? showall = null)
|
||||
public async Task<List<string>> GetTest([FromQuery] bool? isweb = null, [FromQuery] bool? isteam = null, [FromQuery] bool? showall = null, [FromQuery] int? maxRespawnTimesMix = null)
|
||||
{
|
||||
bool web = isweb ?? true;
|
||||
bool team = isteam ?? false;
|
||||
bool all = showall ?? false;
|
||||
return await FunGameSimulation.StartSimulationGame(false, web, team, all);
|
||||
return await FunGameSimulation.StartSimulationGame(false, isweb ?? true, isteam ?? false, showall ?? false, maxRespawnTimesMix ?? 1);
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpGet("last")]
|
||||
public string[] GetLast([FromQuery] bool full = false)
|
||||
{
|
||||
PluginConfig LastRecordConfig = new("FunGameSimulation", "LastRecord");
|
||||
LastRecordConfig.LoadConfig();
|
||||
string get = full ? "full" : "last";
|
||||
return LastRecordConfig.Get<string[]>(get) ?? [];
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
@ -1874,7 +1881,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
{
|
||||
user1.Inventory.MainCharacter.Recovery(EP: 200);
|
||||
user2.Inventory.MainCharacter.Recovery(EP: 200);
|
||||
return await FunGameActionQueue.NewAndStartGame([user1.Inventory.MainCharacter, user2.Inventory.MainCharacter], false, false, false, false, showAllRound);
|
||||
return await FunGameActionQueue.NewAndStartGame([user1.Inventory.MainCharacter, user2.Inventory.MainCharacter], 0, 0, false, false, false, false, showAllRound);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3462,7 +3469,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
|
||||
Character boss2 = CharacterBuilder.Build(boss, false, true, null, FunGameConstant.AllItems, FunGameConstant.AllSkills, false);
|
||||
List<string> msgs = await FunGameActionQueue.NewAndStartGame([user.Inventory.MainCharacter, boss2], false, false, false, false, showAllRound);
|
||||
List<string> msgs = await FunGameActionQueue.NewAndStartGame([user.Inventory.MainCharacter, boss2], 0, 0, false, false, false, false, showAllRound);
|
||||
|
||||
if (boss2.HP <= 0)
|
||||
{
|
||||
|
@ -221,7 +221,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
if (!FunGameSimulation)
|
||||
{
|
||||
FunGameSimulation = true;
|
||||
List<string> msgs = await Controller.GetTest(false);
|
||||
List<string> msgs = await Controller.GetTest(false, maxRespawnTimesMix: 0);
|
||||
List<string> real = [];
|
||||
int remain = 7;
|
||||
string merge = "";
|
||||
@ -263,6 +263,66 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
if (e.Detail.StartsWith("混战模拟"))
|
||||
{
|
||||
int maxRespawnTimesMix = 1;
|
||||
string detail = e.Detail.Replace("混战模拟", "").Trim();
|
||||
if (int.TryParse(detail, out int times))
|
||||
{
|
||||
maxRespawnTimesMix = times;
|
||||
}
|
||||
if (!FunGameSimulation)
|
||||
{
|
||||
FunGameSimulation = true;
|
||||
List<string> msgs = await Controller.GetTest(false, maxRespawnTimesMix: maxRespawnTimesMix);
|
||||
List<string> real = [];
|
||||
int remain = 7;
|
||||
string merge = "";
|
||||
for (int i = 0; i < msgs.Count - 2; i++)
|
||||
{
|
||||
remain--;
|
||||
merge += msgs[i] + "\r\n";
|
||||
if (remain == 0)
|
||||
{
|
||||
real.Add(merge);
|
||||
merge = "";
|
||||
if ((msgs.Count - i - 3) < 7)
|
||||
{
|
||||
remain = msgs.Count - i - 3;
|
||||
}
|
||||
else remain = 7;
|
||||
}
|
||||
}
|
||||
if (msgs.Count > 2)
|
||||
{
|
||||
real.Add(msgs[^2]);
|
||||
real.Add(msgs[^1]);
|
||||
}
|
||||
if (real.Count >= 3)
|
||||
{
|
||||
real = real[^3..];
|
||||
}
|
||||
int count = 1;
|
||||
foreach (string msg in real)
|
||||
{
|
||||
await SendAsync(e, "饭给木", msg.Trim(), msgSeq: count++);
|
||||
await Task.Delay(5500);
|
||||
}
|
||||
FunGameSimulation = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
await SendAsync(e, "饭给木", "游戏正在模拟中,请勿重复请求!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
if (e.Detail == "上次的完整日志")
|
||||
{
|
||||
await SendAsync(e, "饭给木", string.Join("\r\n", Controller.GetLast()));
|
||||
return result;
|
||||
}
|
||||
|
||||
if (e.Detail.StartsWith("FunGame团队模拟", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
@ -2004,7 +2064,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
if (e.Detail == "毕业礼包")
|
||||
{
|
||||
string msg = Controller.CreateGiftBox(uid, "毕业礼包");
|
||||
|
Loading…
x
Reference in New Issue
Block a user