mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2025-12-05 00:06:02 +00:00
更新地图选取范围格子的逻辑
This commit is contained in:
parent
030ef179e8
commit
09eea71cb6
@ -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);
|
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);
|
GamingQueue.DamageToEnemyAsync(actor, enemy, damage, false, damageType, magicType, result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -205,12 +205,13 @@ namespace Milimoe.FunGame.Core.Library.Common.Addon
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取以某个格子为中心,一定范围内的格子(曼哈顿距离),只考虑同一平面的格子,不包含中心格子。
|
/// 获取以某个格子为中心,一定范围内的格子(曼哈顿距离),只考虑同一平面的格子。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="grid"></param>
|
/// <param name="grid"></param>
|
||||||
/// <param name="range"></param>
|
/// <param name="range"></param>
|
||||||
|
/// <param name="includeCharacter"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual List<Grid> GetGridsByRange(Grid grid, int range)
|
public virtual List<Grid> GetGridsByRange(Grid grid, int range, bool includeCharacter = false)
|
||||||
{
|
{
|
||||||
List<Grid> grids = [];
|
List<Grid> grids = [];
|
||||||
|
|
||||||
@ -227,23 +228,26 @@ namespace Milimoe.FunGame.Core.Library.Common.Addon
|
|||||||
int z = grid.Z;
|
int z = grid.Z;
|
||||||
if (GridsByCoordinate.TryGetValue((x, y, z), out Grid? select) && select != null)
|
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;
|
return grids;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取以某个格子为中心,一定半径内的格子(圆形范围,欧几里得距离),只考虑同一平面的格子,不包含中心格子。
|
/// 获取以某个格子为中心,一定半径内的格子(圆形范围,欧几里得距离),只考虑同一平面的格子。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="grid"></param>
|
/// <param name="grid"></param>
|
||||||
/// <param name="range"></param>
|
/// <param name="range"></param>
|
||||||
|
/// <param name="includeCharacter"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual List<Grid> GetGridsByCircleRange(Grid grid, int range)
|
public virtual List<Grid> GetGridsByCircleRange(Grid grid, int range, bool includeCharacter = false)
|
||||||
{
|
{
|
||||||
List<Grid> grids = [];
|
List<Grid> grids = [];
|
||||||
|
|
||||||
@ -265,12 +269,14 @@ namespace Milimoe.FunGame.Core.Library.Common.Addon
|
|||||||
|
|
||||||
if (GridsByCoordinate.TryGetValue((x, y, z), out Grid? select) && select != null)
|
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;
|
return grids;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,5 +44,14 @@ namespace Milimoe.FunGame.Core.Library.Common.Addon
|
|||||||
/// 此格子呈现的颜色(默认为 <see cref="Color.Gray"/> )
|
/// 此格子呈现的颜色(默认为 <see cref="Color.Gray"/> )
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Color Color { get; set; } = Color.Gray;
|
public Color Color { get; set; } = Color.Gray;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 默认的字符串表示形式
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"Grid: {Id} ({X}, {Y}, {Z})";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2342,7 +2342,7 @@ namespace Milimoe.FunGame.Core.Model
|
|||||||
{
|
{
|
||||||
return target;
|
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<Grid> grids = map.GetGridsByRange(current, character.MOV);
|
List<Grid> grids = map.GetGridsByRange(current, character.MOV);
|
||||||
if (grids.Count > 0)
|
if (grids.Count > 0)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user