diff --git a/Entity/Skill/NormalAttack.cs b/Entity/Skill/NormalAttack.cs
index de66fae..4d9c6f1 100644
--- a/Entity/Skill/NormalAttack.cs
+++ b/Entity/Skill/NormalAttack.cs
@@ -188,6 +188,16 @@ namespace Milimoe.FunGame.Core.Entity
///
public bool CanSelectTeammate { get; set; } = false;
+ ///
+ /// 选取所有敌对角色,优先级大于
+ ///
+ public bool SelectAllEnemies { get; set; } = false;
+
+ ///
+ /// 选取所有友方角色,优先级大于 ,默认包含自身
+ ///
+ public bool SelectAllTeammates { get; set; } = false;
+
///
/// 可选取的作用目标数量
///
@@ -231,17 +241,17 @@ namespace Milimoe.FunGame.Core.Entity
///
/// 获取可选择的目标列表
///
- ///
+ ///
///
///
///
- public List GetSelectableTargets(Character caster, List enemys, List teammates)
+ public List GetSelectableTargets(Character attacker, List enemys, List teammates)
{
List selectable = [];
if (CanSelectSelf)
{
- selectable.Add(caster);
+ selectable.Add(attacker);
}
foreach (Character character in enemys)
@@ -263,6 +273,43 @@ namespace Milimoe.FunGame.Core.Entity
return selectable;
}
+
+ ///
+ /// 选取普攻目标
+ ///
+ ///
+ ///
+ ///
+ ///
+ public List SelectTargets(Character attacker, List enemys, List teammates)
+ {
+ List tobeSelected = GetSelectableTargets(attacker, enemys, teammates);
+
+ List targets = [];
+
+ if (SelectAllTeammates || SelectAllEnemies)
+ {
+ if (SelectAllTeammates)
+ {
+ targets.AddRange(tobeSelected.Where(c => c == attacker || teammates.Contains(c)));
+ }
+ if (SelectAllEnemies)
+ {
+ targets.AddRange(tobeSelected.Where(enemys.Contains));
+ }
+ }
+ else if (tobeSelected.Count <= CanSelectTargetCount)
+ {
+ targets.AddRange(tobeSelected);
+ }
+ else
+ {
+ targets.AddRange(tobeSelected.OrderBy(x => Random.Shared.Next()).Take(CanSelectTargetCount));
+ }
+
+ return [.. targets.Distinct()];
+ }
+
///
/// 对目标(或多个目标)发起普通攻击
///
diff --git a/Interface/Entity/Typical/ISkill.cs b/Interface/Entity/Typical/ISkill.cs
index 15e3008..4ac6619 100644
--- a/Interface/Entity/Typical/ISkill.cs
+++ b/Interface/Entity/Typical/ISkill.cs
@@ -1,5 +1,4 @@
-using Milimoe.FunGame.Core.Api.Utility;
-using Milimoe.FunGame.Core.Entity;
+using Milimoe.FunGame.Core.Entity;
namespace Milimoe.FunGame.Core.Interface.Entity
{
@@ -52,6 +51,17 @@ namespace Milimoe.FunGame.Core.Interface.Entity
/// 可选取友方角色
///
public bool CanSelectTeammate { get; }
+
+ ///
+ /// 选取所有敌对角色,优先级大于
+ ///
+ public bool SelectAllEnemies { get; }
+
+ ///
+ /// 选取所有友方角色,优先级大于 ,默认包含自身
+ ///
+ public bool SelectAllTeammates { get; }
+
///
/// 可选取的作用目标数量
///
diff --git a/Model/GamingQueue.cs b/Model/GamingQueue.cs
index 97f1c51..42d1f27 100644
--- a/Model/GamingQueue.cs
+++ b/Model/GamingQueue.cs
@@ -2370,11 +2370,7 @@ namespace Milimoe.FunGame.Core.Model
List targets = await OnSelectNormalAttackTargetsAsync(character, attack, enemys, teammates);
if (targets.Count == 0 && CharactersInAI.Contains(character))
{
- targets = character.NormalAttack.GetSelectableTargets(character, enemys, teammates);
- if (targets.Count > 0)
- {
- targets = [targets[Random.Shared.Next(targets.Count)]];
- }
+ targets = character.NormalAttack.SelectTargets(character, enemys, teammates);
}
return targets;
}