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

30 lines
1007 B
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 UnityEngine;
namespace Gameplay.Buff
{
public class BuffBulletDamage7 : BaseBuff
{
protected override void _OnTrigger()
{
base._OnTrigger();
// 对目标造成A%+B克默攻击点伤害有10%几率额外造成双倍伤害
// 修正 0-固定值 1-攻击力百分比 2-暴击率 3-暴击倍数
var fixValue = _TryGetFloatParam(0);
var rateAttack = _TryGetFloatParam(1);
var critRate = _TryGetFloatParam(2);
var critValue = _TryGetFloatParam(3);
var damage = Mathf.FloorToInt((fixValue + rateAttack * owner.fightData.attack));
var random = Random.Range(0, 1f);
var isCritical = random < critRate;
if (isCritical)
{
damage = Mathf.FloorToInt(damage * critValue);
}
owner.TakeNormalDamage(configData.AttackPowerLevel,damage, creator, isCritical);
}
}
}