diff --git a/excel/attribute.xlsx b/excel/attribute.xlsx index d347a10..a0353ea 100644 Binary files a/excel/attribute.xlsx and b/excel/attribute.xlsx differ diff --git a/src/ServerStorage/Modules/Behaviours/Attack.luau b/src/ServerStorage/Modules/Behaviours/Attack.luau index c637d33..0a4fe8c 100644 --- a/src/ServerStorage/Modules/Behaviours/Attack.luau +++ b/src/ServerStorage/Modules/Behaviours/Attack.luau @@ -24,8 +24,10 @@ setmetatable(Attack, {__index = Behaviour}) local CAST_DISTANCE = 8 local COOLDOWN = 1 + +-- TODO: 虽然配置了不同属性的暴击率,但是暂时没用到 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 = "iceAtk", ElementType = DamageProxy.ElementType.ICE, CritCheckRateName = "critRateIce", CritDamageRateName = "critDamageRateIce"}, {Name = "lightAtk", ElementType = DamageProxy.ElementType.LIGHT, CritCheckRateName = "critRateLight", CritDamageRateName = "critDamageRateLight"}, @@ -101,21 +103,23 @@ function Attack:Execute() -- 攻击前摇 task.wait(atkSpeed) + + -- 暴击判定走通用属性 + local critCheckRate = self:GetAttributeValue("critRate") or 0 + local isCrit = Rng:RandomPercent(critCheckRate) + -- 伤害逻辑计算部分 local damageData = {} for _, attribute in ATTRIBUTE_LIST do local attributeValue = self:GetAttributeValue(attribute.Name) if attributeValue then - - -- 暴击判定 + -- 计算暴击加成 local DamageType = DamageProxy.DamageType.NORMAL - local critCheckRate = self:GetAttributeValue(attribute.CritCheckRateName) or 0 - local critDamageRate = self:GetAttributeValue(attribute.CritDamageRateName) or 0 - if critCheckRate then - if Rng:RandomPercent(critCheckRate) then - attributeValue = attributeValue * (1 + (200 + critDamageRate) / 100) - DamageType = DamageProxy.DamageType.CRIT - end + local baseCritDamageRate = self:GetAttributeValue("critDamageRate") or 0 + local extraCritDamageRate = attribute.CritDamageRateName and self:GetAttributeValue(attribute.CritDamageRateName) or 0 + if isCrit then + DamageType = DamageProxy.DamageType.CRIT + attributeValue = attributeValue * (1 + (200 + baseCritDamageRate + extraCritDamageRate) / 100) end -- 记录伤害数据