From 7f2b6466e2198a5225e8067c6877aa73ef217db9 Mon Sep 17 00:00:00 2001 From: milimoe Date: Sun, 22 Jun 2025 05:12:09 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=8C=E5=8A=A8=E9=A1=BA=E5=BA=8F=E8=A1=A8?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E4=BC=98=E5=8C=96=EF=BC=8C=E7=8E=B0?= =?UTF-8?q?=E5=9C=A8=E9=9C=80=E8=A6=81=E5=8D=95=E7=8B=AC=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E9=98=9F=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Entity/Skill/Effect.cs | 24 ++++++++++++++++-------- Model/ActionQueue.cs | 4 ++-- Model/GamingQueue.cs | 31 +++++++++++++++++++------------ Model/MixGamingQueue.cs | 2 +- Model/TeamGamingQueue.cs | 2 +- 5 files changed, 39 insertions(+), 24 deletions(-) diff --git a/Entity/Skill/Effect.cs b/Entity/Skill/Effect.cs index 15b4a71..c0fd3c0 100644 --- a/Entity/Skill/Effect.cs +++ b/Entity/Skill/Effect.cs @@ -576,19 +576,22 @@ namespace Milimoe.FunGame.Core.Entity if (effect.DurativeWithoutDuration || (effect.Durative && effect.Duration > 0) || effect.DurationTurn > 0) { // 先从角色身上移除特效类型 - if (target.CharacterEffectTypes.TryGetValue(effect, out List? types) && types != null) + if (isEnemy != effect.IsDebuff) { - RemoveEffectTypesByDispel(types, isEnemy); - if (types.Count == 0) + if (target.CharacterEffectTypes.TryGetValue(effect, out List? types) && types != null) + { + RemoveEffectTypesByDispel(types, isEnemy); + if (types.Count == 0) + { + target.CharacterEffectTypes.Remove(effect); + removeEffectTypes = true; + } + } + else { - target.CharacterEffectTypes.Remove(effect); removeEffectTypes = true; } } - else - { - removeEffectTypes = true; - } // 友方移除控制状态 if (!isEnemy && effect.IsDebuff) { @@ -1022,6 +1025,11 @@ namespace Milimoe.FunGame.Core.Entity builder.Append($"({dispels})"); } + if (IsBeingTemporaryDispelled) + { + builder.Append("(已被临时驱散)"); + } + return builder.ToString(); } diff --git a/Model/ActionQueue.cs b/Model/ActionQueue.cs index c2c6361..eb87e56 100644 --- a/Model/ActionQueue.cs +++ b/Model/ActionQueue.cs @@ -22,8 +22,8 @@ namespace Milimoe.FunGame.Core.Model characters ??= []; return type switch { - RoomType.Team => new TeamGamingQueue(writer), - _ => new MixGamingQueue(writer) + RoomType.Team => new TeamGamingQueue(characters, writer), + _ => new MixGamingQueue(characters, writer) }; } } diff --git a/Model/GamingQueue.cs b/Model/GamingQueue.cs index 8490984..a3fc9ef 100644 --- a/Model/GamingQueue.cs +++ b/Model/GamingQueue.cs @@ -27,7 +27,7 @@ namespace Milimoe.FunGame.Core.Model /// /// 参与本次游戏的所有角色列表 /// - public List AllCharacter => _allCharacter; + public List AllCharacters => _allCharacters; /// /// 原始的角色字典 @@ -124,7 +124,7 @@ namespace Milimoe.FunGame.Core.Model /// /// 参与本次游戏的所有角色列表 /// - protected readonly List _allCharacter = []; + protected readonly List _allCharacters = []; /// /// 原始的角色字典 @@ -249,7 +249,7 @@ namespace Milimoe.FunGame.Core.Model } /// - /// 新建一个基础回合制游戏队列并初始化 + /// 新建一个基础回合制游戏队列并初始化角色 /// /// 参与本次游戏的角色列表 /// 用于文本输出 @@ -260,7 +260,7 @@ namespace Milimoe.FunGame.Core.Model WriteLine = writer; } WriteLine ??= new Action(Console.WriteLine); - InitCharacterQueue(characters); + InitCharacters(characters); } #endregion @@ -268,16 +268,16 @@ namespace Milimoe.FunGame.Core.Model #region 队列框架 /// - /// 初始化基础回合制游戏队列 + /// 初始化角色表 /// /// - public void InitCharacterQueue(List characters) + public void InitCharacters(List characters) { // 保存原始的角色信息。用于复活时还原状态 foreach (Character character in characters) { // 添加角色引用到所有角色列表 - _allCharacter.Add(character); + _allCharacters.Add(character); // 复制原始角色对象 Character original = character.Copy(); original.Guid = Guid.NewGuid(); @@ -289,6 +289,7 @@ namespace Milimoe.FunGame.Core.Model List deadCharacters = [.. characters.Where(c => c.HP <= 0)]; foreach (Character death in deadCharacters) { + _eliminated.Add(death); if (MaxRespawnTimes != 0 || (MaxRespawnTimes != -1 && _respawnTimes.TryGetValue(death, out int times) && times < MaxRespawnTimes)) { // 进入复活倒计时 @@ -297,9 +298,15 @@ namespace Milimoe.FunGame.Core.Model WriteLine($"[ {death} ] 进入复活倒计时:{respawnTime:0.##} {GameplayEquilibriumConstant.InGameTime}!"); } } + } + /// + /// 初始化行动顺序表 + /// + public void InitActionQueue() + { // 初始排序:按速度排序 - List> groupedBySpeed = [.. characters + List> groupedBySpeed = [.. _allCharacters .Where(c => c.HP > 0) .GroupBy(c => c.SPD) .OrderByDescending(g => g.Key)]; @@ -313,7 +320,7 @@ namespace Milimoe.FunGame.Core.Model // 如果只有一个角色,直接加入队列 Character character = group.First(); AddCharacter(character, Calculation.Round2Digits(_queue.Count * 0.1), false); - _assistDetail.Add(character, new AssistDetail(character, characters.Where(c => c != character))); + _assistDetail.Add(character, new AssistDetail(character, _allCharacters.Where(c => c != character))); _stats.Add(character, new()); // 初始化技能 foreach (Skill skill in character.Skills) @@ -367,7 +374,7 @@ namespace Milimoe.FunGame.Core.Model if (selectedCharacter != null) { AddCharacter(selectedCharacter, Calculation.Round2Digits(_queue.Count * 0.1), false); - _assistDetail.Add(selectedCharacter, new AssistDetail(selectedCharacter, characters.Where(c => c != selectedCharacter))); + _assistDetail.Add(selectedCharacter, new AssistDetail(selectedCharacter, _allCharacters.Where(c => c != selectedCharacter))); _stats.Add(selectedCharacter, new()); // 初始化技能 foreach (Skill skill in selectedCharacter.Skills) @@ -471,7 +478,7 @@ namespace Milimoe.FunGame.Core.Model { FirstKiller = null; CustomData.Clear(); - _allCharacter.Clear(); + _allCharacters.Clear(); _original.Clear(); _queue.Clear(); _hardnessTimes.Clear(); @@ -733,7 +740,7 @@ namespace Milimoe.FunGame.Core.Model List teammates = [.. allTeammates.Where(_queue.Contains)]; // 敌人列表 - List allEnemys = [.. _allCharacter.Where(c => c != character && !teammates.Contains(c))]; + List allEnemys = [.. _allCharacters.Where(c => c != character && !teammates.Contains(c))]; List enemys = [.. allEnemys.Where(c => _queue.Contains(c) && !c.IsUnselectable)]; // 技能列表 diff --git a/Model/MixGamingQueue.cs b/Model/MixGamingQueue.cs index 7387886..01259c6 100644 --- a/Model/MixGamingQueue.cs +++ b/Model/MixGamingQueue.cs @@ -111,7 +111,7 @@ namespace Milimoe.FunGame.Core.Model } /// - /// 创建一个混战游戏队列并初始化行动顺序表 + /// 创建一个混战游戏队列并初始化角色 /// /// /// diff --git a/Model/TeamGamingQueue.cs b/Model/TeamGamingQueue.cs index ce20487..21c742b 100644 --- a/Model/TeamGamingQueue.cs +++ b/Model/TeamGamingQueue.cs @@ -288,7 +288,7 @@ namespace Milimoe.FunGame.Core.Model } /// - /// 创建一个团队游戏队列并初始化行动顺序表 + /// 创建一个团队游戏队列并初始化角色 /// /// ///