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)