装备属性加成计算fix

This commit is contained in:
Fang 2023-07-24 18:36:35 +08:00
parent 0e2bb42a25
commit d10b9049f7
6 changed files with 56 additions and 38 deletions

View File

@ -1638,7 +1638,7 @@ local item = {
[1013]={ [1013]={
["type"]=2, ["type"]=2,
["qlt"]=1, ["qlt"]=1,
["icon"]="1013", ["icon"]="1019",
["get_way_type"]=2, ["get_way_type"]=2,
["get_way"]={ ["get_way"]={
2, 2,
@ -1658,7 +1658,7 @@ local item = {
[1014]={ [1014]={
["type"]=2, ["type"]=2,
["qlt"]=2, ["qlt"]=2,
["icon"]="1014", ["icon"]="1020",
["get_way_type"]=2, ["get_way_type"]=2,
["get_way"]={ ["get_way"]={
8, 8,
@ -1681,7 +1681,7 @@ local item = {
[1015]={ [1015]={
["type"]=2, ["type"]=2,
["qlt"]=3, ["qlt"]=3,
["icon"]="1015", ["icon"]="1021",
["get_way_type"]=2, ["get_way_type"]=2,
["get_way"]={ ["get_way"]={
14, 14,
@ -1707,7 +1707,7 @@ local item = {
[1016]={ [1016]={
["type"]=2, ["type"]=2,
["qlt"]=4, ["qlt"]=4,
["icon"]="1016", ["icon"]="1022",
["get_way_type"]=2, ["get_way_type"]=2,
["get_way"]={ ["get_way"]={
26, 26,
@ -1733,7 +1733,7 @@ local item = {
[1017]={ [1017]={
["type"]=2, ["type"]=2,
["qlt"]=5, ["qlt"]=5,
["icon"]="1017", ["icon"]="1023",
["get_way_type"]=2, ["get_way_type"]=2,
["get_way"]={ ["get_way"]={
38, 38,
@ -1753,7 +1753,7 @@ local item = {
[1018]={ [1018]={
["type"]=2, ["type"]=2,
["qlt"]=5, ["qlt"]=5,
["icon"]="1018", ["icon"]="1024",
["get_way_type"]=2, ["get_way_type"]=2,
["get_way"]={ ["get_way"]={
50, 50,
@ -1767,7 +1767,7 @@ local item = {
[1019]={ [1019]={
["type"]=2, ["type"]=2,
["qlt"]=1, ["qlt"]=1,
["icon"]="1019", ["icon"]="1013",
["get_way_type"]=2, ["get_way_type"]=2,
["get_way"]={ ["get_way"]={
3, 3,
@ -1787,7 +1787,7 @@ local item = {
[1020]={ [1020]={
["type"]=2, ["type"]=2,
["qlt"]=2, ["qlt"]=2,
["icon"]="1020", ["icon"]="1014",
["get_way_type"]=2, ["get_way_type"]=2,
["get_way"]={ ["get_way"]={
9, 9,
@ -1810,7 +1810,7 @@ local item = {
[1021]={ [1021]={
["type"]=2, ["type"]=2,
["qlt"]=3, ["qlt"]=3,
["icon"]="1021", ["icon"]="1015",
["get_way_type"]=2, ["get_way_type"]=2,
["get_way"]={ ["get_way"]={
15, 15,
@ -1836,7 +1836,7 @@ local item = {
[1022]={ [1022]={
["type"]=2, ["type"]=2,
["qlt"]=4, ["qlt"]=4,
["icon"]="1022", ["icon"]="1016",
["get_way_type"]=2, ["get_way_type"]=2,
["get_way"]={ ["get_way"]={
27, 27,
@ -1862,7 +1862,7 @@ local item = {
[1023]={ [1023]={
["type"]=2, ["type"]=2,
["qlt"]=5, ["qlt"]=5,
["icon"]="1023", ["icon"]="1017",
["get_way_type"]=2, ["get_way_type"]=2,
["get_way"]={ ["get_way"]={
39, 39,
@ -1882,7 +1882,7 @@ local item = {
[1024]={ [1024]={
["type"]=2, ["type"]=2,
["qlt"]=5, ["qlt"]=5,
["icon"]="1024", ["icon"]="1018",
["get_way_type"]=2, ["get_way_type"]=2,
["get_way"]={ ["get_way"]={
51, 51,

View File

@ -673,7 +673,12 @@ local tutorial = {
0, 0,
200 200
}, },
["target_name"]="hero_detail_ui(Clone)/common/btn_close" ["target_name"]="hero_detail_ui(Clone)/common/btn_close",
["arrow_direction"]=1,
["arrow_offset"]={
0,
0
}
}, },
[80050]={ [80050]={
["next_id"]=80060, ["next_id"]=80060,
@ -711,6 +716,7 @@ local tutorial = {
} }
}, },
[80070]={ [80070]={
["type"]=2,
["target_name"]="main_ui(Clone)/sub_ui_node/main_comp/dungeon_comp/scrollrect/viewport/content/scroll_cell_2/btn_start", ["target_name"]="main_ui(Clone)/sub_ui_node/main_comp/dungeon_comp/scrollrect/viewport/content/scroll_cell_2/btn_start",
["arrow_direction"]=2, ["arrow_direction"]=2,
["arrow_offset"]={ ["arrow_offset"]={
@ -776,7 +782,12 @@ local tutorial = {
0, 0,
200 200
}, },
["target_name"]="hero_detail_ui(Clone)/common/btn_close" ["target_name"]="hero_detail_ui(Clone)/common/btn_close",
["arrow_direction"]=1,
["arrow_offset"]={
0,
0
}
}, },
[90050]={ [90050]={
["next_id"]=90060, ["next_id"]=90060,

View File

@ -44,7 +44,7 @@ function WeaponInfoComp:refresh()
self.txLevel:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_3) .. self.weaponEntity:getLevel().."/"..self.weaponEntity:getMaxLevel()) self.txLevel:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_3) .. self.weaponEntity:getLevel().."/"..self.weaponEntity:getMaxLevel())
self.txAttr:setText(self.weaponEntity:getAttrDesc()) self.txAttr:setText(self.weaponEntity:getAttrDesc())
local height = self.txAttr:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredHeight local height = self.txAttr:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredHeight
self.attrContent:setSizeDeltaY(height) self.attrContent:setSizeDeltaY(height + 5)
self.attrContent:setAnchoredPosition(0, 0) self.attrContent:setAnchoredPosition(0, 0)
-- 基础属性 -- 基础属性

View File

@ -24,6 +24,7 @@ function DungeonArmorEntity:init(data)
DataManager.FormationData:initDungeonArmor(self.heroes) DataManager.FormationData:initDungeonArmor(self.heroes)
DataManager:registerCrossDayFunc("DungeonArmorEntity", function() DataManager:registerCrossDayFunc("DungeonArmorEntity", function()
self.fundAd = false
self.farmCount = table.clear(self.farmCount) self.farmCount = table.clear(self.farmCount)
self:setDirty() self:setDirty()
end) end)

View File

@ -1,5 +1,5 @@
local EquipEntity = class("EquipEntity", BaseData) local EquipEntity = class("EquipEntity", BaseData)
local DEFAULT_FACTOR = GConst.BattleConst.DEFAULT_FACTOR local ATTR_FACTOR = 100
function EquipEntity:ctor(heroId, part, level) function EquipEntity:ctor(heroId, part, level)
self.level = level or 0 self.level = level or 0
@ -40,7 +40,7 @@ end
-- 获取部位加成后生命值 -- 获取部位加成后生命值
function EquipEntity:getHp() function EquipEntity:getHp()
local result = self:getBaseHp() local result = self:getBaseHp()
result = result + self:getHeroEntity():getTotalBaseHp() * self:getHpPercent() // DEFAULT_FACTOR result = result + self:getHeroEntity():getTotalBaseHp() * self:getHpPercent() // ATTR_FACTOR
return result return result
end end
@ -55,7 +55,7 @@ end
-- 获取部位加成后攻击力 -- 获取部位加成后攻击力
function EquipEntity:getAttack() function EquipEntity:getAttack()
local result = self:getBaseAttack() local result = self:getBaseAttack()
result = result + self:getHeroEntity():getTotalBaseAtk() * self:getAtkPercent() // DEFAULT_FACTOR result = result + self:getHeroEntity():getTotalBaseAtk() * self:getAtkPercent() // ATTR_FACTOR
return result return result
end end
@ -78,12 +78,12 @@ end
-- 获取攻击加成百分比 -- 获取攻击加成百分比
function EquipEntity:getAtkPercent() function EquipEntity:getAtkPercent()
local attrs = self:getStageAttr() local attrs = self:getStageAttr()
if not attrs then if not attrs or #attrs == 0 then
return 0 return 0
end end
for index, attr in ipairs(attrs) do for index, attr in ipairs(attrs) do
if table.containValue(GConst.MATCH_ATTACK_ADD_NAME, attr.type) then if table.containValue(GConst.MATCH_ATTACK_ADD_NAME, attr.type) then
return attr.num // DEFAULT_FACTOR return attr.num // ATTR_FACTOR
end end
end end
return 0 return 0
@ -92,12 +92,12 @@ end
-- 获取生命值加成百分比 -- 获取生命值加成百分比
function EquipEntity:getHpPercent() function EquipEntity:getHpPercent()
local attrs = self:getStageAttr() local attrs = self:getStageAttr()
if not attrs then if not attrs or #attrs == 0 then
return 0 return 0
end end
for index, attr in ipairs(attrs) do for index, attr in ipairs(attrs) do
if table.containValue(GConst.MATCH_HP_ADD_NAME, attr.type) then if table.containValue(GConst.MATCH_HP_ADD_NAME, attr.type) then
return attr.num // DEFAULT_FACTOR return attr.num // ATTR_FACTOR
end end
end end
return 0 return 0
@ -106,12 +106,12 @@ end
-- 获取暴击率百分比 -- 获取暴击率百分比
function EquipEntity:getCritPercent() function EquipEntity:getCritPercent()
local attrs = self:getStageAttr() local attrs = self:getStageAttr()
if not attrs then if not attrs or #attrs == 0 then
return 0 return 0
end end
for index, attr in ipairs(attrs) do for index, attr in ipairs(attrs) do
if table.containValue(GConst.MATCH_CRIT_NAME, attr.type) then if table.containValue(GConst.MATCH_CRIT_NAME, attr.type) then
return attr.num // DEFAULT_FACTOR return attr.num // ATTR_FACTOR
end end
end end
return 0 return 0
@ -120,12 +120,12 @@ end
--获取暴击伤害百分比 --获取暴击伤害百分比
function EquipEntity:getCritHurtPercent() function EquipEntity:getCritHurtPercent()
local attrs = self:getStageAttr() local attrs = self:getStageAttr()
if not attrs then if not attrs or #attrs == 0 then
return 0 return 0
end end
for index, attr in ipairs(attrs) do for index, attr in ipairs(attrs) do
if table.containValue(GConst.MATCH_CRIT_TIME_NAME, attr.type) then if table.containValue(GConst.MATCH_CRIT_TIME_NAME, attr.type) then
return attr.num // DEFAULT_FACTOR return attr.num // ATTR_FACTOR
end end
end end
return 0 return 0
@ -134,12 +134,12 @@ end
-- 获取治疗百分比 -- 获取治疗百分比
function EquipEntity:getHealPercent() function EquipEntity:getHealPercent()
local attrs = self:getStageAttr() local attrs = self:getStageAttr()
if not attrs then if not attrs or #attrs == 0 then
return 0 return 0
end end
for index, attr in ipairs(attrs) do for index, attr in ipairs(attrs) do
if table.containValue(GConst.MATCH_CURED_NAME, attr.type) then if table.containValue(GConst.MATCH_CURED_NAME, attr.type) then
return attr.num // DEFAULT_FACTOR return attr.num // ATTR_FACTOR
end end
end end
return 0 return 0
@ -148,12 +148,12 @@ end
-- 获取普攻增伤百分比 -- 获取普攻增伤百分比
function EquipEntity:getNormalHurtPercent() function EquipEntity:getNormalHurtPercent()
local attrs = self:getStageAttr() local attrs = self:getStageAttr()
if not attrs then if not attrs or #attrs == 0 then
return 0 return 0
end end
for index, attr in ipairs(attrs) do for index, attr in ipairs(attrs) do
if table.containValue(GConst.MATCH_NORMAL_HURTP_NAME, attr.type) then if table.containValue(GConst.MATCH_NORMAL_HURTP_NAME, attr.type) then
return attr.num // DEFAULT_FACTOR return attr.num // ATTR_FACTOR
end end
end end
return 0 return 0
@ -162,12 +162,12 @@ end
-- 获取技能增伤百分比 -- 获取技能增伤百分比
function EquipEntity:getSkillHurtPercent() function EquipEntity:getSkillHurtPercent()
local attrs = self:getStageAttr() local attrs = self:getStageAttr()
if not attrs then if not attrs or #attrs == 0 then
return 0 return 0
end end
for index, attr in ipairs(attrs) do for index, attr in ipairs(attrs) do
if table.containValue(GConst.MATCH_SKILL_HURTP_NAME, attr.type) then if table.containValue(GConst.MATCH_SKILL_HURTP_NAME, attr.type) then
return attr.num // DEFAULT_FACTOR return attr.num // ATTR_FACTOR
end end
end end
return 0 return 0
@ -175,12 +175,14 @@ end
-- 获取部位阶段等级未达到最低阶段等级时阶段为0 -- 获取部位阶段等级未达到最低阶段等级时阶段为0
function EquipEntity:getStage() function EquipEntity:getStage()
local stage = 0
for idx, level in pairs(self.cfg.features_level) do for idx, level in pairs(self.cfg.features_level) do
if self.level < level then if self.level < level then
return idx - 1 break
end end
stage = idx - 1
end end
return nil-- 超过最大阶段等级 return stage
end end
-- 获取属性描述 -- 获取属性描述
@ -208,10 +210,14 @@ end
-- 获取部位已获得属性 -- 获取部位已获得属性
function EquipEntity:getStageAttr() function EquipEntity:getStageAttr()
local stage = self:getStage() local stage = self:getStage()
if stage and stage > 0 then if self.curAttr == nil or #self.curAttr ~= stage then
return self.cfg.features_attr[stage] self.curAttr = {}
for i = 1, stage do
table.insert(self.curAttr, self.cfg.features_attr[i])
end end
return nil end
return self.curAttr
end end
-- 获取部位图标id -- 获取部位图标id

View File

@ -108,7 +108,7 @@ function HeroEntity:updateEquipAttr()
if EDITOR_MODE then if EDITOR_MODE then
local printStr = "" local printStr = ""
printStr = printStr .. "更新装备数值:"..self:getCfgId().."-".. partName .. "\n" printStr = printStr .. "更新装备数值:"..self:getCfgId().."-".. partName .. "-" .. equipEntity:getLevel() .. "\n"
printStr = printStr .. "生命:".. hp .. "\n" printStr = printStr .. "生命:".. hp .. "\n"
printStr = printStr .. "攻击力:".. atk .. "\n" printStr = printStr .. "攻击力:".. atk .. "\n"
printStr = printStr .. "普攻增伤:".. normalHurt .. "\n" printStr = printStr .. "普攻增伤:".. normalHurt .. "\n"