diff --git a/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua b/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua index be0d3fe4bc..8238bc7945 100644 --- a/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua +++ b/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua @@ -1873,7 +1873,8 @@ FormationTypeDef = { FourElement_MAGIC = 3003, FourElement_TAOIST = 3004, - FORMATION_TEMPORARY = 10000, --临时编队 + FORMATION_TEMPORARY = 10000, --临时编队, 编队用 + FORMATION_TEMPORARY_PROP = 10001, -- 临时编队, 属性计算用 } --编队需要拉取主线 diff --git a/Assets/ManagedResources/~Lua/Modules/Formation/FormationManager.lua b/Assets/ManagedResources/~Lua/Modules/Formation/FormationManager.lua index 591f69594a..49a09e5f4f 100644 --- a/Assets/ManagedResources/~Lua/Modules/Formation/FormationManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Formation/FormationManager.lua @@ -118,9 +118,13 @@ function this.UpdateFormation(msg) this.CheckGuildFightDefendFormation() end --刷新临时编队数据 -function this.UpdateTemporaryFormation(TeamPosInfo) +function this.UpdateTemporaryFormation(teamId, TeamPosInfo) + if teamId < FormationTypeDef.FORMATION_TEMPORARY then + LogError("临时编队ID错误") + return + end local curFormation = {} - curFormation.teamId = FormationTypeDef.FORMATION_TEMPORARY + curFormation.teamId = teamId curFormation.teamName = "临时" curFormation.teamHeroInfos = {} curFormation.teamPokemonInfos = {} @@ -129,9 +133,9 @@ function this.UpdateTemporaryFormation(TeamPosInfo) table.insert(curFormation.teamHeroInfos, TeamPosInfo[j]) end end - this.formationList[FormationTypeDef.FORMATION_TEMPORARY] = curFormation + this.formationList[teamId] = curFormation -- 设置临时编队为脏数据 - HeroPropManager.SetFormationPropDirty(FormationTypeDef.FORMATION_TEMPORARY) + HeroPropManager.SetFormationPropDirty(teamId) end -- function this.SetCurFormationIndex() -- local curIndex = 1 diff --git a/Assets/ManagedResources/~Lua/Modules/Formation/FormationPanelV2.lua b/Assets/ManagedResources/~Lua/Modules/Formation/FormationPanelV2.lua index a1548787f1..2c77486e5f 100644 --- a/Assets/ManagedResources/~Lua/Modules/Formation/FormationPanelV2.lua +++ b/Assets/ManagedResources/~Lua/Modules/Formation/FormationPanelV2.lua @@ -362,7 +362,7 @@ function this.SetCardsData() end LogGreen("刷新编队·············· ") - FormationManager.UpdateTemporaryFormation(this.choosedList) + FormationManager.UpdateTemporaryFormation(FormationTypeDef.FORMATION_TEMPORARY, this.choosedList) this.formationPower = 0--战力 this.formationPowerOld = 0--战力 --元素共鸣 diff --git a/Assets/ManagedResources/~Lua/Modules/Hero/HeroPropManager.lua b/Assets/ManagedResources/~Lua/Modules/Hero/HeroPropManager.lua index b3874fce24..8bc5e556b5 100644 --- a/Assets/ManagedResources/~Lua/Modules/Hero/HeroPropManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Hero/HeroPropManager.lua @@ -269,20 +269,24 @@ function this.GetHeroProp(dId, formationId, NoFuncProp) -- Log_Prop("减益属性") -- this.CountDeProp(dId, allPropList) - + local isTempHero = HeroTempPropManager.IsTempHeroID(dId) -- 判断是否需要加入团队属性加成 - if formationId and FormationManager.CheckFormationHasId(formationId, dId) then + if formationId and (FormationManager.CheckFormationHasId(formationId, dId) or isTempHero) then local formationList = FormationManager.GetFormationByID(formationId) table.walk(formationList.teamHeroInfos, function(teamInfo) + local heroId = teamInfo.heroId + if isTempHero and teamInfo.tempHeroId then + heroId = teamInfo.tempHeroId + end -- 团队属性加成 - if teamInfo.heroId then + if heroId then Log_Prop("团队属性") - local teamProp = this.GetTeamData(teamInfo.heroId) + local teamProp = this.GetTeamData(heroId) LogGreenTable_Prop(teamProp) DoubleTableCompound(allPropList, teamProp) -- 团队条件属性加成 Log_Prop("团队条件属性") - local conTeamProp = this.GetConditionTeamData(teamInfo.heroId, dId) + local conTeamProp = this.GetConditionTeamData(heroId, dId) LogGreenTable_Prop(conTeamProp) DoubleTableCompound(allPropList, conTeamProp) end diff --git a/Assets/ManagedResources/~Lua/Modules/Hero/HeroTempPropManager.lua b/Assets/ManagedResources/~Lua/Modules/Hero/HeroTempPropManager.lua index 9c10782b95..a6686ba792 100644 --- a/Assets/ManagedResources/~Lua/Modules/Hero/HeroTempPropManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Hero/HeroTempPropManager.lua @@ -15,6 +15,13 @@ function this.IsTempHeroID(tempId) end return false end +-- 根据临时ID获取did +function this.GetDynamicIdByTempId(tempId) + if this.IsTempHeroID(tempId) then + return string.gsub(tempId, "TEMP_", "") + end + return tempId +end -- 复制一个神将数据,不影响原数据 function this.CreateTempHero(dId) if this.IsTempHeroID(dId) then @@ -48,15 +55,44 @@ function this.ClearTempHero(tempId) HeroPropManager.ClearHeroData(tempId) end +-- 更新用于计算临时属性的编队 +function this.UpdateTempFormation(tempId, formationId) + local dId = this.GetDynamicIdByTempId(tempId) + local teamInfo = FormationManager.GetFormationByID(formationId) + local heroList = {} + if teamInfo and teamInfo.teamHeroInfos and #teamInfo.teamHeroInfos > 0 then + for _, hero in ipairs(teamInfo.teamHeroInfos) do + local h = {} + h.heroId = hero.heroId + h.position = hero.position + -- 将对应的人替换成临时数据 + if h.heroId == dId then + h.tempHeroId = tempId + end + table.insert(heroList, h) + end + -- 刷新用于计算临时属性的编队 + FormationManager.UpdateTemporaryFormation(FormationTypeDef.FORMATION_TEMPORARY_PROP, heroList) + end +end + -- 获取临时英雄属性 function this.GetTempHeroProp(tempId, formationId) if this.IsTempHeroExist(tempId) then + if formationId then + this.UpdateTempFormation(tempId, formationId) + formationId = FormationTypeDef.FORMATION_TEMPORARY_PROP + end return HeroPropManager.GetHeroProp(tempId, formationId) end end -- 获取临时英雄属性 function this.GetTempHeroPower(tempId, formationId) if this.IsTempHeroExist(tempId) then + if formationId then + this.UpdateTempFormation(tempId, formationId) + formationId = FormationTypeDef.FORMATION_TEMPORARY_PROP + end return HeroPowerManager.GetHeroPower(tempId, formationId) end end diff --git a/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleUpStarLayout.lua b/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleUpStarLayout.lua index 5d4a168b83..1db01ec0a6 100644 --- a/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleUpStarLayout.lua +++ b/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleUpStarLayout.lua @@ -299,7 +299,12 @@ function RoleUpStarLayout:UpdateHeroUpStarProUpShow() local tempDId, tempData = HeroTempPropManager.CreateTempHero(curHeroData.dynamicId) tempData.upStarId = upStarRankUpConfig.Id tempData.breakId = curHeroData.breakId - local nextallAddProVal = HeroTempPropManager.GetTempHeroProp(tempDId) + local nextallAddProVal = {} + if isUpZhen then + nextallAddProVal = HeroTempPropManager.GetTempHeroProp(tempDId, FormationTypeDef.FORMATION_NORMAL) + else + nextallAddProVal = HeroTempPropManager.GetTempHeroProp(tempDId) + end HeroTempPropManager.ClearTempHero(tempDId)-- 清理 this:ProShow(this.atkPro_UpStar,allAddProVal,HeroProType.Attack,nextallAddProVal)