29 lines
897 B
C#
29 lines
897 B
C#
|
|
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);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|