using System;
using System.Collections.Generic;
using Cielonos.MainGame.Buffs.Character;
using Cielonos.MainGame.Characters;
using SLSUtilities.General;
using UnityEngine;
namespace Cielonos.MainGame.Inventory.Collections
{
///
/// 超临界核心 / Supercritical Core
/// Fusion 引爆所需层数增加,但引爆伤害大幅提升
///
public class SupercriticalCore : PassiveEquipmentBase
{
private const string EventKey = nameof(SupercriticalCore);
public override void OnObtained()
{
base.OnObtained();
Action onApplyBuff = OnApplyBuffToOther;
player.eventSm.onApplyBuffToTarget.Add(EventKey, onApplyBuff.ToPrioritized());
}
public override void OnDiscarded()
{
player.eventSm.onApplyBuffToTarget.Remove(EventKey);
base.OnDiscarded();
}
private void OnApplyBuffToOther(CharacterBuffBase buff)
{
if (buff is not Fusion fusion) return;
fusion.minimumStackToExplode += Mathf.RoundToInt(passiveAttributeSm.GetItemAttribute("ExtraMinimumStackToExplode"));
fusion.damagePerStack += Mathf.RoundToInt(passiveAttributeSm.GetItemAttribute("ExtraDamagePerStack"));
}
}
}