多轮审查评估
This commit is contained in:
@@ -9,8 +9,10 @@ namespace BaseGames.Combat.StatusEffects
|
||||
private const float BaseDuration = 3.0f; // 持续 3 秒
|
||||
private const float DotInterval = 0.5f; // 每 0.5 秒一次
|
||||
|
||||
public override StatusEffectType EffectType => StatusEffectType.Fire;
|
||||
public override int MaxStacks => 1;
|
||||
public override StatusEffectType EffectType => StatusEffectType.Fire;
|
||||
public override int MaxStacks => 1;
|
||||
/// <summary>施加燃烧时移除冻结(火冰互斥)。</summary>
|
||||
public override StatusEffectType[] MutualExclusions => new[] { StatusEffectType.Freeze };
|
||||
|
||||
public FireEffect()
|
||||
{
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace BaseGames.Combat.StatusEffects
|
||||
|
||||
public override StatusEffectType EffectType => StatusEffectType.Stagger;
|
||||
public override int MaxStacks => 1;
|
||||
/// <summary>眼晕(Stun)优先级高于硬直,眼晕状态下硬直不可施加。</summary>
|
||||
public override StatusEffectType[] BlockedBy => new[] { StatusEffectType.Stun };
|
||||
|
||||
public override void OnApply(StatusEffectManager owner)
|
||||
{
|
||||
|
||||
@@ -31,6 +31,19 @@ namespace BaseGames.Combat.StatusEffects
|
||||
/// <summary>是否已过期(由 Manager 每帧检查)。</summary>
|
||||
public virtual bool IsExpired => Duration <= 0f;
|
||||
|
||||
/// <summary>
|
||||
/// 施加此效果时将被净化的互斥效果类型列表。
|
||||
/// 例:FireEffect 返回 [Freeze],表示施加燃烧时会同时移除冻结。
|
||||
/// </summary>
|
||||
public virtual StatusEffectType[] MutualExclusions => System.Array.Empty<StatusEffectType>();
|
||||
|
||||
/// <summary>
|
||||
/// 阻止此效果施加的效果类型列表。
|
||||
/// 宿主当前存在列表中任意效果时,本效果将被拒绝施加。
|
||||
/// 例:StaggerEffect 返回 [Stun],表示眩晕状态下无法再施加硬直。
|
||||
/// </summary>
|
||||
public virtual StatusEffectType[] BlockedBy => System.Array.Empty<StatusEffectType>();
|
||||
|
||||
private float _tickTimer;
|
||||
|
||||
/// <summary>宿主 Manager(OnApply 时注入,OnTick/OnExpire 中可访问)。</summary>
|
||||
|
||||
@@ -82,6 +82,15 @@ namespace BaseGames.Combat.StatusEffects
|
||||
/// <summary>直接施加一个具体效果(供技能/Boss 使用)。</summary>
|
||||
public void ApplyEffect(StatusEffect effect)
|
||||
{
|
||||
// 检查是否被现有效果阻断
|
||||
foreach (var blockerType in effect.BlockedBy)
|
||||
if (_activeIndex.ContainsKey(blockerType)) return;
|
||||
|
||||
// 净化与新效果互斥的现有效果
|
||||
foreach (var excludedType in effect.MutualExclusions)
|
||||
if (_activeIndex.ContainsKey(excludedType))
|
||||
CleanseEffect(excludedType);
|
||||
|
||||
if (_activeIndex.TryGetValue(effect.EffectType, out StatusEffect existing))
|
||||
{
|
||||
existing.OnStack();
|
||||
|
||||
Reference in New Issue
Block a user