多轮审查和修复
This commit is contained in:
54
Assets/Scripts/Combat/StatusEffects/PoisonEffect.cs
Normal file
54
Assets/Scripts/Combat/StatusEffects/PoisonEffect.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
namespace BaseGames.Combat.StatusEffects
|
||||
{
|
||||
/// <summary>
|
||||
/// 中毒效果(架构 06_CombatModule §11)。
|
||||
/// 规则:最多叠加 3 层;每层叠加伤害 +1;每 1 秒造成 StackCount 点 True 伤害。
|
||||
/// </summary>
|
||||
public class PoisonEffect : StatusEffect
|
||||
{
|
||||
private const float BaseDuration = 5.0f; // 持续 5 秒
|
||||
private const float DotInterval = 1.0f; // 每 1 秒一次
|
||||
|
||||
public override StatusEffectType EffectType => StatusEffectType.Poison;
|
||||
public override int MaxStacks => 3;
|
||||
|
||||
public PoisonEffect()
|
||||
{
|
||||
TickInterval = DotInterval;
|
||||
}
|
||||
|
||||
public override void OnApply(StatusEffectManager owner)
|
||||
{
|
||||
base.OnApply(owner);
|
||||
UpdateShader();
|
||||
}
|
||||
|
||||
public override void OnStack()
|
||||
{
|
||||
base.OnStack();
|
||||
UpdateShader();
|
||||
}
|
||||
|
||||
public override void OnTick()
|
||||
{
|
||||
var info = new DamageInfo.Builder()
|
||||
.SetRaw(StackCount) // 叠层越多伤害越高
|
||||
.SetType(DamageType.True)
|
||||
.SetFlags(DamageFlags.IgnoreIFrame)
|
||||
.Build();
|
||||
Owner?.ApplyDirectDamage(info);
|
||||
}
|
||||
|
||||
public override void OnExpire()
|
||||
{
|
||||
StackCount = 0;
|
||||
Owner?.SetShaderParam("_PoisonGlow", 0f);
|
||||
}
|
||||
|
||||
private void UpdateShader()
|
||||
=> Owner?.SetShaderParam("_PoisonGlow", StackCount / (float)MaxStacks);
|
||||
|
||||
protected override float GetBaseDuration() => BaseDuration;
|
||||
public override string GetDisplayName() => $"中毒 ×{StackCount}";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user