41 lines
1.4 KiB
C#
41 lines
1.4 KiB
C#
using System;
|
||
using Cielonos.MainGame.Buffs.Character;
|
||
using SLSUtilities.General;
|
||
using UnityEngine;
|
||
|
||
namespace Cielonos.MainGame.Inventory.Collections
|
||
{
|
||
/// <summary>
|
||
/// 聚变催化器 / Fusion Catalyst (Passive, Moser)
|
||
/// 降低 Fusion 引爆所需的最低层数阈值。
|
||
/// 订阅 onApplyBuffToOther,在 Fusion Buff 施加前修改 minimumStackToExplode。
|
||
/// </summary>
|
||
public class FusionCatalyst : PassiveEquipmentBase
|
||
{
|
||
private const string EventKey = nameof(FusionCatalyst);
|
||
|
||
public override void OnObtained()
|
||
{
|
||
base.OnObtained();
|
||
Action<CharacterBuffBase> onApplyBuff = OnApplyBuffToOther;
|
||
player.eventSm.onApplyBuffToTarget.Add(EventKey, onApplyBuff.ToPrioritized());
|
||
}
|
||
|
||
public override void OnDiscarded()
|
||
{
|
||
player.eventSm.onApplyBuffToTarget.Remove(EventKey);
|
||
base.OnDiscarded();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 在 Buff 施加到目标前拦截,若为 Fusion 则降低其引爆阈值。
|
||
/// </summary>
|
||
private void OnApplyBuffToOther(CharacterBuffBase buff)
|
||
{
|
||
if (buff is not Fusion fusion) return;
|
||
int reduction = Mathf.RoundToInt(passiveAttributeSm.GetItemAttribute("FusionExplosionThresholdReduction"));
|
||
fusion.minimumStackToExplode -= reduction;
|
||
}
|
||
}
|
||
}
|