This commit is contained in:
kai 2025-10-14 19:14:34 +08:00
parent 79aa6b116d
commit 8fb9492ad9
8 changed files with 34 additions and 38 deletions

View File

@ -2074,27 +2074,7 @@ function GFunc.getBuffDesc(buffName, effectNum, ispercent)
end end
function GFunc.getAttrDesc(attrName, attrNum) function GFunc.getAttrDesc(attrName, attrNum)
attrNum = GFunc.getAttrShowValue(attrName, attrNum, true) return I18N:getTextWithOtherKey("attr", "name", attrName, "desc", GFunc.getFinalAttrValue(attrName, attrNum))
return I18N:getTextWithOtherKey("attr", "name", attrName, "desc", attrNum)
end
-- 获取属性用于显示的数值
function GFunc.getAttrShowValue(attrType, attrNum, notPercentSign)
if table.containValue(GConst.MATCH_ATTACK_ADD_NAME, attrType) or
table.containValue(GConst.MATCH_HP_ADD_NAME, attrType) or
table.containValue(GConst.MATCH_NORMAL_HURTP_NAME, attrType) or
table.containValue(GConst.MATCH_SKILL_HURTP_NAME, attrType) or
table.containValue(GConst.MATCH_CRIT_NAME, attrType) or
table.containValue(GConst.MATCH_CRIT_TIME_NAME, attrType) or
table.containValue(GConst.MATCH_CURED_NAME, attrType) or
table.containValue(GConst.MATCH_ALL_ATKP_NAME, attrType) or
table.containValue(GConst.MATCH_ALL_HURTP_NAME, attrType)
then
local str = notPercentSign and "" or "%"
return attrNum // GConst.BattleConst.PERCENT_FACTOR .. str
else
return attrNum // GConst.BattleConst.DEFAULT_FACTOR
end
end end
-- 属性id转属性名 -- 属性id转属性名

View File

@ -179,6 +179,7 @@ function DailyChallengeManager:dealTaskProgress(battleController)
local comboOver10Count = battleController.taskProgress[GConst.BattleConst.BATTLE_TASK_FIELD.COMBO_OVER_10] local comboOver10Count = battleController.taskProgress[GConst.BattleConst.BATTLE_TASK_FIELD.COMBO_OVER_10]
local linkCountOver8Count = battleController.taskProgress[GConst.BattleConst.BATTLE_TASK_FIELD.LINK_COUNT_OVER_8] local linkCountOver8Count = battleController.taskProgress[GConst.BattleConst.BATTLE_TASK_FIELD.LINK_COUNT_OVER_8]
local killBossTurn = battleController.taskProgress[GConst.BattleConst.BATTLE_TASK_FIELD.KILLS_BOSS_TURN]
local skillCountMap = {} local skillCountMap = {}
local damageMatchTypeMap = {} local damageMatchTypeMap = {}
@ -206,11 +207,11 @@ function DailyChallengeManager:dealTaskProgress(battleController)
end end
local taskProgress = { local taskProgress = {
[3] = comboOver10Count, [2] = comboOver10Count,
[4] = linkCountOver8Count, [3] = linkCountOver8Count,
[5] = skillCountMap, [4] = skillCountMap,
[7] = damageHeroMap, [5] = killBossTurn,
[8] = damageMatchTypeMap [6] = damageMatchTypeMap,
} }
return taskProgress return taskProgress
end end

View File

@ -56,7 +56,7 @@ function AttrCell:showHp()
value = value + DataManager.SkinData:getHp(self.heroEntity) value = value + DataManager.SkinData:getHp(self.heroEntity)
end end
self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value)) self.txValue:setText(GFunc.getFinalAttrValue(self.attrName, value))
end end
-- 显示攻击力 -- 显示攻击力
@ -81,7 +81,7 @@ function AttrCell:showAtk()
value = value + DataManager.SkinData:getAttack(self.heroEntity) value = value + DataManager.SkinData:getAttack(self.heroEntity)
end end
self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value)) self.txValue:setText(GFunc.getFinalAttrValue(self.attrName, value))
end end
-- 显示普攻增伤 -- 显示普攻增伤
@ -97,7 +97,7 @@ function AttrCell:showNormalHurt()
value = value + DataManager.SkinData:getNormalHurt(self.heroEntity) value = value + DataManager.SkinData:getNormalHurt(self.heroEntity)
end end
self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value)) self.txValue:setText(GFunc.getFinalAttrValue(self.attrName, value))
end end
-- 显示技能增伤 -- 显示技能增伤
@ -113,7 +113,7 @@ function AttrCell:showSkillHurt()
value = value + DataManager.SkinData:getSkillHurt(self.heroEntity) value = value + DataManager.SkinData:getSkillHurt(self.heroEntity)
end end
self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value)) self.txValue:setText(GFunc.getFinalAttrValue(self.attrName, value))
end end
-- 显示暴击率 -- 显示暴击率
@ -129,7 +129,7 @@ function AttrCell:showCrit()
value = value + DataManager.SkinData:getCritPercent(self.heroEntity) value = value + DataManager.SkinData:getCritPercent(self.heroEntity)
end end
self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value)) self.txValue:setText(GFunc.getFinalAttrValue(self.attrName, value))
end end
-- 显示暴击伤害百分比 -- 显示暴击伤害百分比
@ -145,7 +145,7 @@ function AttrCell:showCritAtk()
value = value + DataManager.SkinData:getCritHurtPercent(self.heroEntity) value = value + DataManager.SkinData:getCritHurtPercent(self.heroEntity)
end end
self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value)) self.txValue:setText(GFunc.getFinalAttrValue(self.attrName, value))
end end
-- 显示普攻增伤百分比 -- 显示普攻增伤百分比
@ -163,7 +163,7 @@ function AttrCell:showNormalHurtp()
value = value + DataManager.SkinData:getNormalHurtPercent(self.heroEntity) value = value + DataManager.SkinData:getNormalHurtPercent(self.heroEntity)
end end
self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value)) self.txValue:setText(GFunc.getFinalAttrValue(self.attrName, value))
end end
-- 显示技能增伤百分比 -- 显示技能增伤百分比
@ -181,7 +181,7 @@ function AttrCell:showSkillHurtp()
value = value + DataManager.SkinData:getSkillHurtPercent(self.heroEntity) value = value + DataManager.SkinData:getSkillHurtPercent(self.heroEntity)
end end
self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value)) self.txValue:setText(GFunc.getFinalAttrValue(self.attrName, value))
end end
-- 显示治疗效果提升百分比 -- 显示治疗效果提升百分比
@ -197,7 +197,7 @@ function AttrCell:showCured()
value = value + DataManager.SkinData:getHealPercent(self.heroEntity) value = value + DataManager.SkinData:getHealPercent(self.heroEntity)
end end
self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value)) self.txValue:setText(GFunc.getFinalAttrValue(self.attrName, value))
end end
return AttrCell return AttrCell

View File

@ -26,7 +26,7 @@ function StarCell:refresh(heroEntity, idx)
local attr = heroEntity:getLvAttrCfg(idx) local attr = heroEntity:getLvAttrCfg(idx)
local attrIdx = GFunc.getAttrIdByName(attr.type) local attrIdx = GFunc.getAttrIdByName(attr.type)
local attrNum = GFunc.getAttrShowValue(attr.type, attr.num, true) local attrNum = GFunc.getFinalAttrValue(attr.type, attr.num)
local descTx = "" local descTx = ""
if not table.containValue(GConst.MATCH_ALL_ATKP_NAME, attr.type) then if not table.containValue(GConst.MATCH_ALL_ATKP_NAME, attr.type) then
descTx = I18N:getText("attr", attrIdx, "desc", heroEntity:getName(), attrNum) descTx = I18N:getText("attr", attrIdx, "desc", heroEntity:getName(), attrNum)

View File

@ -70,6 +70,7 @@ function TalentMainUI:onLoadRootComplete()
self.upNode:addClickListener(function() self.upNode:addClickListener(function()
self.upNode:setActive(false) self.upNode:setActive(false)
DataManager.HeroData:calcPower()
end) end)
self:bind(DataManager.TalentData, "isDirty", function() self:bind(DataManager.TalentData, "isDirty", function()
@ -110,7 +111,7 @@ function TalentMainUI:onUpgrade()
local attr, num = DataManager.TalentData:getAttrById(upData.id) local attr, num = DataManager.TalentData:getAttrById(upData.id)
local str = I18N:getText("talent", upData.id, "desc") local str = I18N:getText("talent", upData.id, "desc")
if attr and #attr > 0 then if attr and #attr > 0 then
str = str .. GFunc.getPerStr(attr[1].type, attr[1].num / GConst.DEFAULT_FACTOR) str = str .. GFunc.getFinalAttrValue(attr[1].type, attr[1].num)
-- else -- else
-- str = str .. (num or 0) -- str = str .. (num or 0)
end end

View File

@ -816,7 +816,7 @@ function BattleBaseData:initHeroData(formation)
---- 攻击力 ---- 攻击力
for matchType, attrName in pairs(GConst.MATCH_ATTACK_NAME) do for matchType, attrName in pairs(GConst.MATCH_ATTACK_NAME) do
unitData.attr[attrName] = heroEntity:getTotalAttrValue(attrName) // DEFAULT_FACTOR unitData.attr[attrName] = heroEntity:getTotalAttrValue(attrName)
end end
---- 暴击率 ---- 暴击率

View File

@ -23,6 +23,7 @@ function DailyChallengeData:init(data)
self.buffIds = data.buff_id or GConst.EMPTY_TABLE self.buffIds = data.buff_id or GConst.EMPTY_TABLE
self.totalFightCount = data.total_challenge_count or 0 self.totalFightCount = data.total_challenge_count or 0
self.todayFightCount = data.today_challenge_count or 0 self.todayFightCount = data.today_challenge_count or 0
self.tasks[2].task_id = 5
self.initDay = Time:getBeginningOfServerToday() self.initDay = Time:getBeginningOfServerToday()
self.popTaskTime = LocalData:getChallengeTaskPopTime() self.popTaskTime = LocalData:getChallengeTaskPopTime()
self.diffLv = data.level or 1 self.diffLv = data.level or 1

View File

@ -69,6 +69,7 @@ function TalentData:onUpgrade(data)
self.stage = data.stage self.stage = data.stage
self.levels[data.id] = data.level self.levels[data.id] = data.level
self.attrDirty = true self.attrDirty = true
self:getAllAttr()
self:setDirty() self:setDirty()
end end
@ -78,6 +79,18 @@ function TalentData:getUpData()
return data return data
end end
function TalentData:isAllMax()
for id = 1, #TalentCfg do
local cfg = TalentCfg[id]
local lv = self:getLevels(id)
if lv and lv > 0 and cfg.attr then
for _, v in ipairs(cfg.attr) do
self.allAttr[v.type] = (self.allAttr[v.type] or 0) + v.num * lv
end
end
end
end
--@region 属性 --@region 属性
function TalentData:getAttrById(id) function TalentData:getAttrById(id)
local cfg = TalentCfg[id] local cfg = TalentCfg[id]