NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/Buff/Impl/BuffSpecialKillLogic.cs

50 lines
1.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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);
}
}
}