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

30 lines
1.0 KiB
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.Player;
namespace BaseGames.Equipment
{
/// <summary>
/// 武器替换护符效果(架构 09_ProgressionModule §5
/// 通过 WeaponManager 将指定形态的武器替换为另一武器。
/// </summary>
[Serializable]
public class WeaponOverrideEffect : ICharmEffect
{
public string targetFormId; // 目标形态 ID留空 = 所有形态)
public WeaponSO replacementWeapon; // 替换武器 SO
public void OnEquip(EquipmentContext ctx)
=> ctx.WeaponMgr?.SetOverride(targetFormId, replacementWeapon);
public void OnUnequip(EquipmentContext ctx)
=> ctx.WeaponMgr?.ClearOverride(targetFormId);
public string GetEffectDescription()
{
string formStr = string.IsNullOrEmpty(targetFormId) ? "所有形态" : targetFormId;
string wName = replacementWeapon != null ? replacementWeapon.displayName : "null";
return $"{formStr}的武器替换为 [{wName}]";
}
}
}