This commit is contained in:
gechangfu 2025-08-22 19:26:39 +08:00
parent 9c9ef30f8b
commit 13c974adbe
2 changed files with 14 additions and 10 deletions

Binary file not shown.

View File

@ -24,8 +24,10 @@ setmetatable(Attack, {__index = Behaviour})
local CAST_DISTANCE = 8 local CAST_DISTANCE = 8
local COOLDOWN = 1 local COOLDOWN = 1
-- TODO: 虽然配置了不同属性的暴击率,但是暂时没用到
local ATTRIBUTE_LIST = { local ATTRIBUTE_LIST = {
{Name = "attack", ElementType = DamageProxy.ElementType.NONE, CritCheckRateName = "critRate", CritDamageRateName = "critDamageRate"}, {Name = "attack", ElementType = DamageProxy.ElementType.NONE, CritCheckRateName = "critRate", CritDamageRateName = nil},
{Name = "fireAtk", ElementType = DamageProxy.ElementType.FIRE, CritCheckRateName = "critRateFire", CritDamageRateName = "critDamageRateFire"}, {Name = "fireAtk", ElementType = DamageProxy.ElementType.FIRE, CritCheckRateName = "critRateFire", CritDamageRateName = "critDamageRateFire"},
{Name = "iceAtk", ElementType = DamageProxy.ElementType.ICE, CritCheckRateName = "critRateIce", CritDamageRateName = "critDamageRateIce"}, {Name = "iceAtk", ElementType = DamageProxy.ElementType.ICE, CritCheckRateName = "critRateIce", CritDamageRateName = "critDamageRateIce"},
{Name = "lightAtk", ElementType = DamageProxy.ElementType.LIGHT, CritCheckRateName = "critRateLight", CritDamageRateName = "critDamageRateLight"}, {Name = "lightAtk", ElementType = DamageProxy.ElementType.LIGHT, CritCheckRateName = "critRateLight", CritDamageRateName = "critDamageRateLight"},
@ -101,21 +103,23 @@ function Attack:Execute()
-- 攻击前摇 -- 攻击前摇
task.wait(atkSpeed) task.wait(atkSpeed)
-- 暴击判定走通用属性
local critCheckRate = self:GetAttributeValue("critRate") or 0
local isCrit = Rng:RandomPercent(critCheckRate)
-- 伤害逻辑计算部分 -- 伤害逻辑计算部分
local damageData = {} local damageData = {}
for _, attribute in ATTRIBUTE_LIST do for _, attribute in ATTRIBUTE_LIST do
local attributeValue = self:GetAttributeValue(attribute.Name) local attributeValue = self:GetAttributeValue(attribute.Name)
if attributeValue then if attributeValue then
-- 计算暴击加成
-- 暴击判定
local DamageType = DamageProxy.DamageType.NORMAL local DamageType = DamageProxy.DamageType.NORMAL
local critCheckRate = self:GetAttributeValue(attribute.CritCheckRateName) or 0 local baseCritDamageRate = self:GetAttributeValue("critDamageRate") or 0
local critDamageRate = self:GetAttributeValue(attribute.CritDamageRateName) or 0 local extraCritDamageRate = attribute.CritDamageRateName and self:GetAttributeValue(attribute.CritDamageRateName) or 0
if critCheckRate then if isCrit then
if Rng:RandomPercent(critCheckRate) then
attributeValue = attributeValue * (1 + (200 + critDamageRate) / 100)
DamageType = DamageProxy.DamageType.CRIT DamageType = DamageProxy.DamageType.CRIT
end attributeValue = attributeValue * (1 + (200 + baseCritDamageRate + extraCritDamageRate) / 100)
end end
-- 记录伤害数据 -- 记录伤害数据