2026-05-23 08:27:50 -04:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using Cielonos.MainGame.Buffs.Character;
|
|
|
|
|
|
using Cielonos.MainGame.Characters;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Cielonos.MainGame
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class CombatManager
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class EnemySubmodule
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 从已有的敌人列表中选取评分最高的目标。
|
|
|
|
|
|
/// </summary>
|
2026-05-26 00:21:27 -04:00
|
|
|
|
public Enemy GetBestEnemy(List<Enemy> enemies)
|
2026-05-23 08:27:50 -04:00
|
|
|
|
{
|
|
|
|
|
|
if (enemies.Count == 0) return null;
|
|
|
|
|
|
if (enemies.Count == 1) return enemies[0];
|
|
|
|
|
|
|
|
|
|
|
|
List<TargetingScore> scores = GetScoredEnemies(float.MaxValue);
|
|
|
|
|
|
foreach (TargetingScore score in scores)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (enemies.Contains(score.target))
|
|
|
|
|
|
{
|
|
|
|
|
|
return score.target;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return enemies[0];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 从已有的敌人列表中进行评分,返回完整的评分列表(按分数从高到低)。
|
|
|
|
|
|
/// 适合后续通过 ApplyScoreModifier 施加修正。
|
|
|
|
|
|
/// </summary>
|
2026-05-26 00:21:27 -04:00
|
|
|
|
public List<TargetingScore> GetScoredEnemies(List<Enemy> enemies,
|
2026-05-23 08:27:50 -04:00
|
|
|
|
float radius = float.MaxValue, Transform origin = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
List<TargetingScore> allScores = GetScoredEnemies(radius, origin);
|
|
|
|
|
|
if (enemies == null || enemies.Count == 0) return allScores;
|
|
|
|
|
|
|
|
|
|
|
|
List<TargetingScore> filtered = new List<TargetingScore>(enemies.Count);
|
|
|
|
|
|
foreach (TargetingScore score in allScores)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (enemies.Contains(score.target))
|
|
|
|
|
|
{
|
|
|
|
|
|
filtered.Add(score);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return filtered;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取可被扰乱的敌人列表:
|
|
|
|
|
|
/// <para>目前获取的是当前可以受到Disruption打断,且有对应Buff(黄光,红光等)的敌人</para>
|
|
|
|
|
|
/// </summary>
|
2026-05-26 00:21:27 -04:00
|
|
|
|
public List<Enemy> GetDisruptableEnemies(List<Enemy> enemies,
|
2026-05-23 08:27:50 -04:00
|
|
|
|
Breakthrough.Type breakthroughType = Breakthrough.Type.Disruption)
|
|
|
|
|
|
{
|
2026-05-26 00:21:27 -04:00
|
|
|
|
List<Enemy> disruptableEnemies = new List<Enemy>();
|
2026-05-23 08:27:50 -04:00
|
|
|
|
|
2026-05-26 00:21:27 -04:00
|
|
|
|
foreach (Enemy enemy in enemies)
|
2026-05-23 08:27:50 -04:00
|
|
|
|
{
|
|
|
|
|
|
bool hasBuff = enemy.buffSm.HasBuff<BreakthroughResistanceModification>();
|
|
|
|
|
|
if (!enemy.reactionSc.breakthroughResistances[breakthroughType].Value && hasBuff)
|
|
|
|
|
|
{
|
|
|
|
|
|
disruptableEnemies.Add(enemy);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return disruptableEnemies;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|