Files
zeling_v2/Assets/_Game/Scripts/Equipment/Effects/SkillNumericModifierEffect.cs

28 lines
895 B
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using BaseGames.Skills;
namespace BaseGames.Equipment
{
/// <summary>
/// 技能数值修改护符效果(架构 09_ProgressionModule §5
/// 通过 SkillModifierRegistry 对指定技能的数值加成。
/// </summary>
[Serializable]
public class SkillNumericModifierEffect : ICharmEffect
{
public string TargetSkillId;
public SkillStat Stat;
public float Delta;
public bool IsPercent;
public void OnEquip(EquipmentContext ctx)
=> ctx.SkillMods?.Register(TargetSkillId, Stat, Delta, IsPercent);
public void OnUnequip(EquipmentContext ctx)
=> ctx.SkillMods?.Unregister(TargetSkillId, Stat, Delta, IsPercent);
public string GetEffectDescription()
=> $"{TargetSkillId}.{Stat} {(Delta >= 0 ? "+" : "")}{Delta}{(IsPercent ? "%" : "")}";
}
}