From 9e1cf32daa73d3ef53088fe449877ef3a09518d4 Mon Sep 17 00:00:00 2001 From: chenxi Date: Tue, 23 May 2023 19:02:30 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=8B=B1=E9=9B=84?= =?UTF-8?q?=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/global/global_const.lua | 1 + lua/app/ui/hero/hero_detail_ui.lua | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/app/global/global_const.lua b/lua/app/global/global_const.lua index 65e3625b..0b739a46 100644 --- a/lua/app/global/global_const.lua +++ b/lua/app/global/global_const.lua @@ -186,6 +186,7 @@ GConst.ATLAS_PATH = { UI_SETTING = "assets/arts/atlas/ui/setting.asset", ICON_TASK = "assets/arts/atlas/icon/task.asset", SHOP = "assets/arts/atlas/ui/shop.asset", + HERO = "assets/arts/atlas/ui/hero.asset", } GConst.TOUCH_EVENT = { diff --git a/lua/app/ui/hero/hero_detail_ui.lua b/lua/app/ui/hero/hero_detail_ui.lua index 95b46a8f..4ab62049 100644 --- a/lua/app/ui/hero/hero_detail_ui.lua +++ b/lua/app/ui/hero/hero_detail_ui.lua @@ -34,7 +34,7 @@ function HeroDetailUI:_display(lvChange) uiMap["hero_detail_ui.bg.atk_name"]:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_3)) uiMap["hero_detail_ui.bg.skill_icon"]:setSprite(GConst.ATLAS_PATH.ICON_SKILL_ROGUE, ModuleManager.HeroManager:getSkillRogueIcon(self.heroEntity:getUnlockRogueId())) - uiMap["hero_detail_ui.bg.hero_element"]:setSprite(GConst.ATLAS_PATH.ICON_HERO, ModuleManager.HeroManager:getMatchTypeIcon(self.heroEntity:getMatchType())) + uiMap["hero_detail_ui.bg.hero_element"]:setSprite(GConst.ATLAS_PATH.HERO, ModuleManager.HeroManager:getMatchTypeIcon(self.heroEntity:getMatchType())) local materials = self.heroEntity:getLvUpMaterials() or {} local fragmentCount = DataManager.BagData.ItemData:getItemNumById(self.heroEntity:getFragmentId()) From c5609f4867ab0cf4e96d80ee40129a0dacd2c3ea Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Tue, 23 May 2023 19:08:26 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=9A=84buff?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/module/battle/battle_const.lua | 2 ++ .../battle/helper/battle_buff_handle.lua | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/lua/app/module/battle/battle_const.lua b/lua/app/module/battle/battle_const.lua index 9611ef7f..99108f09 100644 --- a/lua/app/module/battle/battle_const.lua +++ b/lua/app/module/battle/battle_const.lua @@ -287,6 +287,8 @@ local BUFF_NAME = { SKILL_HURT_ADD = "skill_hurt_add", DEATH_SUMMON = "death_summon", LOCK = "lock", + SHIELD_REBOUND_400 = "shield_rebound_400", + SHIELD_ICE_REBOUND_400 = "shield_ice_rebound_400", } BattleConst.BUFF_NAME = BUFF_NAME diff --git a/lua/app/module/battle/helper/battle_buff_handle.lua b/lua/app/module/battle/helper/battle_buff_handle.lua index f063ca9c..1803da19 100644 --- a/lua/app/module/battle/helper/battle_buff_handle.lua +++ b/lua/app/module/battle/helper/battle_buff_handle.lua @@ -140,6 +140,20 @@ BattleBuffHandle.addShield = { target.unitEntity:addAttr(ATTR_NAME.SHIELD_REBOUND, 20000, false) return shieldNum end, + -- 反弹目标伤害的400%,直接写死 + [BUFF_NAME.SHIELD_REBOUND_400] = function(unitComp, buff, target, buffEffect) + local shieldNum = target.unitEntity:getMaxHp() * buff:getEffectNum() // DEFAULT_FACTOR + target:addShield(shieldNum, buffEffect) + target.unitEntity:addAttr(ATTR_NAME.SHIELD_REBOUND, 40000, false) + return shieldNum + end, + -- 反弹目标伤害的400%,直接写死 + [BUFF_NAME.SHIELD_ICE_REBOUND_400] = function(unitComp, buff, target, buffEffect) + local shieldNum = target.unitEntity:getMaxHp() * buff:getEffectNum() // DEFAULT_FACTOR + target:addShield(shieldNum, buffEffect) + target.unitEntity:addAttr(ATTR_NAME.SHIELD_REBOUND, 40000, false) + return shieldNum + end, } BattleBuffHandle.removeShield = { @@ -147,6 +161,14 @@ BattleBuffHandle.removeShield = { target.unitEntity:addAttr(ATTR_NAME.SHIELD_REBOUND, -20000, false) target:removeShield(buffEffect) end, + [BUFF_NAME.SHIELD_REBOUND_400] = function(unitComp, buff, target, buffEffect) + target.unitEntity:addAttr(ATTR_NAME.SHIELD_REBOUND, -40000, false) + target:removeShield(buffEffect) + end, + [BUFF_NAME.SHIELD_ICE_REBOUND_400] = function(unitComp, buff, target, buffEffect) + target.unitEntity:addAttr(ATTR_NAME.SHIELD_REBOUND, -40000, false) + target:removeShield(buffEffect) + end, } local function _takeEffectShield(unitComp, buff, target, buffEffect) From 715408f15f508eb46fcdafe6ff9a365f845a91b1 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Tue, 23 May 2023 20:09:09 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=8F=8D=E5=87=BB=E8=A1=A8=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/module/battle/team/battle_team.lua | 13 ++++++++++--- lua/app/ui/battle/battle_ui.lua | 10 +++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/lua/app/module/battle/team/battle_team.lua b/lua/app/module/battle/team/battle_team.lua index 653df0bb..8128adfe 100644 --- a/lua/app/module/battle/team/battle_team.lua +++ b/lua/app/module/battle/team/battle_team.lua @@ -554,10 +554,17 @@ function BattleTeam:onActionOver() self:getMainUnit().unitEntity:clearCounterAttackCount() local teamAction = function() - self.battleController.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ATK_STEP - self.battleController.curTeam = self.battleController.atkTeam ---- 普攻 - local skillMatch = self:getMainUnit().unitEntity:getMatchType() + local skillMatch + if self.side == BattleConst.SIDE_ATK then + self.battleController.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ATK_STEP + self.battleController.curTeam = self.battleController.atkTeam + skillMatch = self:getMainUnit().unitEntity:getMatchType() + else + self.battleController.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_DEF_STEP + self.battleController.curTeam = self.battleController.defTeam + end + self:useNormalSkill(skillMatch, counterAttackCount, true, BattleConst.EFFECT_TYPE.COUNTERATTACK, function() self.battleController:enterNextTeamAction() end) diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index c908cd6a..428e6d0e 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -530,16 +530,24 @@ end function BattleUI:initCounterAttack() self.counterAttackNode = self.uiMap["battle_ui.battle_root.battle_number_node.counter_attack"] self.counterTx = self.uiMap["battle_ui.battle_root.battle_number_node.counter_attack.text_number"] + self.counterTxTmp = self.counterTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO) + self.counterTxbgComp = self.uiMap["battle_ui.battle_root.top_node.counter_attack.bg"] self.counterAttackNode:setVisible(false) end function BattleUI:showCounterAttack(count, side) local x = 280 + local horizontal = 180 if side == GConst.BattleConst.SIDE_ATK then x = -280 + horizontal = 0 + self.counterTxTmp.alignment = CS.TMPro.TextAlignmentOptions.MidlineLeft + else + self.counterTxTmp.alignment = CS.TMPro.TextAlignmentOptions.MidlineRight end + self.counterTxbgComp:setEulerAngles(0, horizontal, 0) self.counterAttackNode:setAnchoredPositionX(x) - self.counterTx:setText(I18N:getGlobalText(I18N.GlobalConst.COUNTER_ATTACK_DESC) .. "+" .. count) + self.counterTx:setText(I18N:getGlobalText(I18N.GlobalConst.COUNTER_ATTACK_DESC) .. "x" .. count) self.counterAttackNode:setVisible(true) end From bff772a1de5e971b83714125d87d7bc8e172bb68 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Wed, 24 May 2023 10:01:36 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=8A=80=E8=83=BD=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E6=8E=A5=E5=85=A5=E8=81=94=E7=BD=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/common/bi_report.lua | 1 + lua/app/common/event_manager.lua | 3 +- lua/app/module/battle/battle_manager.lua | 18 ++++++++ .../battle/controller/battle_controller.lua | 8 +++- lua/app/proto/proto_msg_type.lua | 6 +++ .../ui/battle/battle_skill_select_comp.lua | 41 +++++++++++++++++-- lua/app/ui/battle/battle_ui.lua | 6 +++ lua/app/userdata/battle/battle_data.lua | 17 ++++++++ 8 files changed, 95 insertions(+), 5 deletions(-) diff --git a/lua/app/common/bi_report.lua b/lua/app/common/bi_report.lua index 77396059..f77dccef 100644 --- a/lua/app/common/bi_report.lua +++ b/lua/app/common/bi_report.lua @@ -78,6 +78,7 @@ BIReport.ITEM_GET_TYPE = { SUMMON = "Summon", PLAYER_LV_UP = "PlayerLvUp", GOLD_PIG = "GoldPig", + BATTLE_SKILL_REFRESH = "BattleSkillRefresh", } BIReport.ADS_CLICK_TYPE = { diff --git a/lua/app/common/event_manager.lua b/lua/app/common/event_manager.lua index 8af4354b..20e2c3ce 100644 --- a/lua/app/common/event_manager.lua +++ b/lua/app/common/event_manager.lua @@ -25,7 +25,8 @@ EventManager.CUSTOM_EVENT = { LOGIN_REQ_SUCCESS = "LOGIN_REQ_SUCCESS", DAILY_TASK_ADD_PROGRESS = "DAILY_TASK_ADD_PROGRESS", BOSS_ENTER_ANI_OVER = "BOSS_ENTER_ANI_OVER", - TIME_TRIGGERED_NEW_EMAIL = "TIME_TRIGGERED_NEW_EMAIL" -- 邮件到时间请求是否有新邮件 + TIME_TRIGGERED_NEW_EMAIL = "TIME_TRIGGERED_NEW_EMAIL", -- 邮件到时间请求是否有新邮件 + SKILL_REFRESH_SUCC = "SKILL_REFRESH_SUCC", -- BORAD_TOUCH_BEGIN = "BORAD_TOUCH_BEGIN", -- BORAD_TOUCH_OVER = "BORAD_TOUCH_OVER" } diff --git a/lua/app/module/battle/battle_manager.lua b/lua/app/module/battle/battle_manager.lua index 099e0450..01420281 100644 --- a/lua/app/module/battle/battle_manager.lua +++ b/lua/app/module/battle/battle_manager.lua @@ -22,6 +22,24 @@ function BattleManager:showBoxOpenUI(rewards, callback) UIManager:showUI("app/ui/battle/battle_box_open_ui", {rewards = rewards, callback = callback}) end +function BattleManager:reqSkillRefresh(isAd) + if not isAd then + local cost = GFunc.getConstReward("refresh_skill_cost") + if not GFunc.checkCost(GFunc.getRewardId(cost), GFunc.getRewardNum(cost), true) then + return + end + end + + self:sendMessage(ProtoMsgType.FromMsgEnum.BattleSkillRefreshReq, {ad = isAd}, {}, self.rspSkillRefresh, BIReport.ITEM_GET_TYPE.BATTLE_SKILL_REFRESH, true) +end + +function BattleManager:rspSkillRefresh(result) + if result.err_code == GConst.ERROR_STR.SUCCESS then + DataManager.BattleData:addRefreshSkillCount(result.reqData.ad) + EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.SKILL_REFRESH_SUCC) + end +end + function BattleManager:playBattle(battleType, params, returnFunc) params = params or {} if self.battleController then -- 同一时间只能有一场战斗 diff --git a/lua/app/module/battle/controller/battle_controller.lua b/lua/app/module/battle/controller/battle_controller.lua index e976f226..ebd07266 100644 --- a/lua/app/module/battle/controller/battle_controller.lua +++ b/lua/app/module/battle/controller/battle_controller.lua @@ -1624,7 +1624,7 @@ function BattleController:findSkillInfluenceGrids() end end -function BattleController:getRandomSkillList(getCount, onlyCommonSkill) +function BattleController:getRandomSkillList(getCount, onlyCommonSkill, excludeMap) local fixedList = self:getFixedRogueSkill() if fixedList[1] then return table.remove(fixedList, 1) @@ -1668,6 +1668,12 @@ function BattleController:getRandomSkillList(getCount, onlyCommonSkill) return table.shuffle(result) end + + if excludeMap then + for skillId, _ in pairs(excludeMap) do + map[skillId] = true + end + end for elementType, list in pairs(skillPool) do if self.battleData:isUnlockedSkillElementType(elementType) then diff --git a/lua/app/proto/proto_msg_type.lua b/lua/app/proto/proto_msg_type.lua index 22694295..8a75a20b 100644 --- a/lua/app/proto/proto_msg_type.lua +++ b/lua/app/proto/proto_msg_type.lua @@ -82,6 +82,8 @@ local ProtoMsgType = { [3440328467] = "PigLevelUpNtf", [3555824176] = "TaskDailyInfoReq", [3555826009] = "TaskDailyInfoRsp", + [3597633120] = "BattleSkillRefreshReq", + [3597634953] = "BattleSkillRefreshRsp", [3607879254] = "AuthReq", [3607881087] = "AuthRsp", [3624439233] = "NewMailNtf", @@ -186,6 +188,8 @@ local ProtoMsgType = { PigLevelUpNtf = 3440328467, TaskDailyInfoReq = 3555824176, TaskDailyInfoRsp = 3555826009, + BattleSkillRefreshReq = 3597633120, + BattleSkillRefreshRsp = 3597634953, AuthReq = 3607879254, AuthRsp = 3607881087, NewMailNtf = 3624439233, @@ -290,6 +294,8 @@ local ProtoMsgType = { PigLevelUpNtf = "PigLevelUpNtf", TaskDailyInfoReq = "TaskDailyInfoReq", TaskDailyInfoRsp = "TaskDailyInfoRsp", + BattleSkillRefreshReq = "BattleSkillRefreshReq", + BattleSkillRefreshRsp = "BattleSkillRefreshRsp", AuthReq = "AuthReq", AuthRsp = "AuthRsp", NewMailNtf = "NewMailNtf", diff --git a/lua/app/ui/battle/battle_skill_select_comp.lua b/lua/app/ui/battle/battle_skill_select_comp.lua index 98220432..153d6457 100644 --- a/lua/app/ui/battle/battle_skill_select_comp.lua +++ b/lua/app/ui/battle/battle_skill_select_comp.lua @@ -19,7 +19,6 @@ end function BattleSkillSelectComp:_display() local uiMap = self:getUIMap() - uiMap["battle_select_skill_comp.skill_node.ad_btn.tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_3)) local bg2 = uiMap["battle_select_skill_comp.bg_2"] bg2:setVisible(self.onlyCommonSkill) local bg = uiMap["battle_select_skill_comp.bg_1"] @@ -32,6 +31,7 @@ function BattleSkillSelectComp:_display() bg:setVisible(true) end + self:refreshBtns() self:refreshRogueSkill() end @@ -43,11 +43,18 @@ function BattleSkillSelectComp:_addListeners() end SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.BATTLE_SKILL_REFRESH, function() - self.skillList = ModuleManager.BattleManager.battleController:getRandomSkillList(nil, self.onlyCommonSkill) - self:refreshRogueSkill() + ModuleManager.BattleManager:reqSkillRefresh(true) end) end) + uiMap["battle_select_skill_comp.skill_node.diamond_btn"]:addClickListener(function() + if not ModuleManager.BattleManager.battleController then + return + end + + ModuleManager.BattleManager:reqSkillRefresh(false) + end) + self.canvasGroup = uiMap["battle_select_skill_comp.skill_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP) self.canvasGroup.alpha = 1 self.bg = uiMap["battle_select_skill_comp.bg_1"] @@ -62,6 +69,34 @@ function BattleSkillSelectComp:_addListeners() end) end +function BattleSkillSelectComp:refreshBtns() + local uiMap = self:getUIMap() + uiMap["battle_select_skill_comp.skill_node.ad_btn.tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_3)) + uiMap["battle_select_skill_comp.skill_node.diamond_btn.tx"]:setText(GFunc.getRewardNum(GFunc.getConstReward("refresh_skill_cost"))) + + local cfgAdCount = GFunc.getConstIntValue("ad_refresh_skill") + local cfgRefreshCount = GFunc.getConstIntValue("diamond_refresh_skill") + cfgAdCount + local adCount = DataManager.BattleData:getADRefreshSkillCount() + local refreshCount = DataManager.BattleData:getRefreshSkillCount() + local showAdBtn = cfgAdCount > adCount + uiMap["battle_select_skill_comp.skill_node.ad_btn"]:setActive(showAdBtn) + local showBtn = refreshCount < cfgRefreshCount + if showAdBtn then + showBtn = false + end + uiMap["battle_select_skill_comp.skill_node.diamond_btn"]:setActive(showBtn) +end + +function BattleSkillSelectComp:getNewRandomSkill() + self:refreshBtns() + local excludeMap = {} + for _, id in ipairs(self.skillList) do + excludeMap[id] = true + end + self.skillList = ModuleManager.BattleManager.battleController:getRandomSkillList(nil, self.onlyCommonSkill, excludeMap) + self:refreshRogueSkill() +end + function BattleSkillSelectComp:refreshRogueSkill() local uiMap = self:getUIMap() if not self.selectSkillCells then diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index 428e6d0e..ff40fb45 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -79,6 +79,12 @@ function BattleUI:_addListeners() self:addEventListener(EventManager.CUSTOM_EVENT.SHOW_ELIMINATION_TUTORAIL, function(posIdList) self:showTutorialFinger(posIdList) end) + + self:addEventListener(EventManager.CUSTOM_EVENT.SKILL_REFRESH_SUCC, function(posIdList) + if self.selectSkillComp then + self.selectSkillComp:getNewRandomSkill() + end + end) end function BattleUI:_bind() diff --git a/lua/app/userdata/battle/battle_data.lua b/lua/app/userdata/battle/battle_data.lua index bf3af345..400ebf0a 100644 --- a/lua/app/userdata/battle/battle_data.lua +++ b/lua/app/userdata/battle/battle_data.lua @@ -27,6 +27,8 @@ function BattleData:init() self.lockElementMap = {} self.data.timeSpeed = 1 self.data.lvDirty = false + self.adRefreshSkillCount = 0 + self.refreshSkillCount = 0 BattleSkillEntity.sid = 0 self.atkTeam = self:initTeam(BattleConst.SIDE_ATK) self.defTeam = self:initTeam(BattleConst.SIDE_DEF) @@ -532,6 +534,21 @@ function BattleData:useCommonSelectSkillCount() return true end +function BattleData:addRefreshSkillCount(isAd) + if isAd then + self.adRefreshSkillCount = self.adRefreshSkillCount + 1 + end + self.refreshSkillCount = self.refreshSkillCount + 1 +end + +function BattleData:getRefreshSkillCount() + return self.refreshSkillCount +end + +function BattleData:getADRefreshSkillCount() + return self.adRefreshSkillCount +end + function BattleData:initTeam(side) local data = nil if side == BattleConst.SIDE_ATK then