From 971a45722429ab67a325fefd95936f73682efb9e Mon Sep 17 00:00:00 2001 From: gaoxin Date: Wed, 29 Sep 2021 17:34:20 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=88=98=E6=96=97=E5=8A=9B=E3=80=91?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AE=A1=E7=AE=97=E5=9C=A8=E7=BC=96=E9=98=9F?= =?UTF-8?q?=E4=B8=8A=E7=9A=84=E4=BA=BA=E7=89=A9=E4=B8=B4=E6=97=B6=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=97=B6=E6=9C=AA=E8=AE=A1=E7=AE=97=E7=BC=96=E9=98=9F?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E5=B1=9E=E6=80=A7=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../~Lua/Common/GlobalDefine.lua | 3 +- .../Modules/Formation/FormationManager.lua | 12 ++++--- .../Modules/Formation/FormationPanelV2.lua | 2 +- .../~Lua/Modules/Hero/HeroPropManager.lua | 14 +++++--- .../~Lua/Modules/Hero/HeroTempPropManager.lua | 36 +++++++++++++++++++ .../Modules/RoleInfo/RoleUpStarLayout.lua | 7 +++- 6 files changed, 62 insertions(+), 12 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua b/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua index 5eb9902044..8ac4868c0a 100644 --- a/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua +++ b/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua @@ -1866,7 +1866,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 4690a84a5f..a4bdfbb3b1 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)