50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
using cfg.CharacterCfg;
|
||
using Gameplay.Skill;
|
||
namespace Gameplay.Buff
|
||
{
|
||
public class BuffSpecialKillLogic : BaseBuff
|
||
{
|
||
|
||
private int _targetJob;
|
||
private float _triggerRate;
|
||
private int _recoverSkillCount;
|
||
|
||
protected override void _OnInit()
|
||
{
|
||
base._OnInit();
|
||
|
||
// 每击杀一个支援敌人,有15%恢复1次技能
|
||
// 敌人类型, 恢复概率, 恢复次数
|
||
_targetJob = _TryGetIntParam(0);
|
||
_triggerRate = _TryGetFloatParam(1, 1f);
|
||
_recoverSkillCount = _TryGetIntParam(2);
|
||
}
|
||
|
||
protected override void _OnTrigger()
|
||
{
|
||
base._OnTrigger();
|
||
|
||
if (killUnit == null) return;
|
||
if (_targetJob != -1 && (int)killUnit.commonData.eJob != _targetJob)
|
||
{
|
||
// 不是目标敌人
|
||
return;
|
||
}
|
||
var randomValue = UnityEngine.Random.Range(0f, 1f);
|
||
if (randomValue > _triggerRate)
|
||
{
|
||
// 触发概率不满足
|
||
return;
|
||
}
|
||
// 恢复技能次数
|
||
var skillManager = SkillManager.instance.GetUnitSkillManager(owner);
|
||
if (skillManager == null)
|
||
{
|
||
return;
|
||
}
|
||
skillManager.AddSkillStoreCount(_recoverSkillCount);
|
||
}
|
||
|
||
}
|
||
}
|