36 lines
1.2 KiB
C#
36 lines
1.2 KiB
C#
using System;
|
||
using Cielonos.MainGame.Buffs.Character;
|
||
using Cielonos.MainGame.Characters;
|
||
using SLSUtilities.General;
|
||
using UnityEngine;
|
||
|
||
namespace Cielonos.MainGame.Inventory.Collections
|
||
{
|
||
/// <summary>
|
||
/// 助燃剂 / Combustion Enhancer
|
||
/// 每次攻击到敌人后,如果敌人处于燃烧Buff,那么为燃烧Buff持续时间延长0.1秒
|
||
/// </summary>
|
||
public class CombustionEnhancer : PassiveEquipmentBase
|
||
{
|
||
private const string EventKey = nameof(CombustionEnhancer);
|
||
|
||
public override void OnObtained()
|
||
{
|
||
base.OnObtained();
|
||
Action<AttackAreaBase, CharacterBase, Attack.Result> onFinishAttack = OnFinishAttack;
|
||
player.eventSm.onFinishAttack.Add(EventKey, onFinishAttack.ToPrioritized());
|
||
}
|
||
|
||
public override void OnDiscarded()
|
||
{
|
||
player.eventSm.onFinishAttack.Remove(EventKey);
|
||
base.OnDiscarded();
|
||
}
|
||
|
||
private void OnFinishAttack(AttackAreaBase attackArea, CharacterBase target, Attack.Result result)
|
||
{
|
||
Burn burn = target.buffSm.GetBuff<Burn>();
|
||
burn?.timeSubmodule.AddDuration(0.1f);
|
||
}
|
||
}
|
||
} |