From 09eea71cb6d07a7f393659cec901c6a102e8bf79 Mon Sep 17 00:00:00 2001 From: milimoe Date: Sun, 7 Sep 2025 22:42:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=9C=B0=E5=9B=BE=E9=80=89?= =?UTF-8?q?=E5=8F=96=E8=8C=83=E5=9B=B4=E6=A0=BC=E5=AD=90=E7=9A=84=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Entity/Skill/Effect.cs | 1 + Library/Common/Addon/GameMap.cs | 22 ++++++++++++++-------- Library/Common/Addon/Grid.cs | 9 +++++++++ Model/GamingQueue.cs | 2 +- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Entity/Skill/Effect.cs b/Entity/Skill/Effect.cs index 514f097..3946ffc 100644 --- a/Entity/Skill/Effect.cs +++ b/Entity/Skill/Effect.cs @@ -813,6 +813,7 @@ namespace Milimoe.FunGame.Core.Entity { result = damageType == DamageType.Physical ? GamingQueue.CalculatePhysicalDamage(actor, enemy, false, expectedDamage, out damage, ref changeCount) : GamingQueue.CalculateMagicalDamage(actor, enemy, false, MagicType, expectedDamage, out damage, ref changeCount); } + // 注意此方法在后台线程运行 GamingQueue.DamageToEnemyAsync(actor, enemy, damage, false, damageType, magicType, result); return result; } diff --git a/Library/Common/Addon/GameMap.cs b/Library/Common/Addon/GameMap.cs index 07b6bd8..e1150e1 100644 --- a/Library/Common/Addon/GameMap.cs +++ b/Library/Common/Addon/GameMap.cs @@ -205,12 +205,13 @@ namespace Milimoe.FunGame.Core.Library.Common.Addon } /// - /// 获取以某个格子为中心,一定范围内的格子(曼哈顿距离),只考虑同一平面的格子,不包含中心格子。 + /// 获取以某个格子为中心,一定范围内的格子(曼哈顿距离),只考虑同一平面的格子。 /// /// /// + /// /// - public virtual List GetGridsByRange(Grid grid, int range) + public virtual List GetGridsByRange(Grid grid, int range, bool includeCharacter = false) { List grids = []; @@ -227,23 +228,26 @@ namespace Milimoe.FunGame.Core.Library.Common.Addon int z = grid.Z; if (GridsByCoordinate.TryGetValue((x, y, z), out Grid? select) && select != null) { - grids.Add(select); + if (includeCharacter || select.Characters.Count == 0) + { + grids.Add(select); + } } } } } - grids.RemoveAll(g => g.Id == grid.Id); return grids; } /// - /// 获取以某个格子为中心,一定半径内的格子(圆形范围,欧几里得距离),只考虑同一平面的格子,不包含中心格子。 + /// 获取以某个格子为中心,一定半径内的格子(圆形范围,欧几里得距离),只考虑同一平面的格子。 /// /// /// + /// /// - public virtual List GetGridsByCircleRange(Grid grid, int range) + public virtual List GetGridsByCircleRange(Grid grid, int range, bool includeCharacter = false) { List grids = []; @@ -265,12 +269,14 @@ namespace Milimoe.FunGame.Core.Library.Common.Addon if (GridsByCoordinate.TryGetValue((x, y, z), out Grid? select) && select != null) { - grids.Add(select); + if (includeCharacter || select.Characters.Count == 0) + { + grids.Add(select); + } } } } } - grids.RemoveAll(g => g.Id == grid.Id); return grids; } diff --git a/Library/Common/Addon/Grid.cs b/Library/Common/Addon/Grid.cs index 2640717..d31c100 100644 --- a/Library/Common/Addon/Grid.cs +++ b/Library/Common/Addon/Grid.cs @@ -44,5 +44,14 @@ namespace Milimoe.FunGame.Core.Library.Common.Addon /// 此格子呈现的颜色(默认为 ) /// public Color Color { get; set; } = Color.Gray; + + /// + /// 默认的字符串表示形式 + /// + /// + public override string ToString() + { + return $"Grid: {Id} ({X}, {Y}, {Z})"; + } } } diff --git a/Model/GamingQueue.cs b/Model/GamingQueue.cs index 575a064..d8df0f2 100644 --- a/Model/GamingQueue.cs +++ b/Model/GamingQueue.cs @@ -2342,7 +2342,7 @@ namespace Milimoe.FunGame.Core.Model { return target; } - if (map.Characters.TryGetValue(character, out Grid? current) && current != null) + else if (target.Id == -2 && map.Characters.TryGetValue(character, out Grid? current) && current != null) { List grids = map.GetGridsByRange(current, character.MOV); if (grids.Count > 0)