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

29 lines
897 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%几率额外造成双倍伤害
var rateAttack = _TryGetFloatParam(0);
var fixValue = _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(damage, creator, isCritical);
}
}
}