30 lines
1.0 KiB
C#
30 lines
1.0 KiB
C#
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}]";
|
|
}
|
|
}
|
|
}
|