Просмотр исходного кода

跨服功能与精灵相关的战斗逻辑修改

gitxsm 6 месяцев назад
Родитель
Сommit
f69c5be432

+ 6 - 3
script/common/InnerProto.lua

@@ -85,7 +85,8 @@ LW_COMBAT_DATA = {
   {"helpList",                      "table"},
   {"roleBase",                      "table"},
   {"formation",                     "int"},
-  {"jiBan",                         "table"}
+  {"jiBan",                         "table"},
+  {"elfList",                        "table"}
 }
 
 -----------------------------------------------------------------------------------------
@@ -234,7 +235,8 @@ LW_COMBAT_GETINFO_SEND =
   {"tHelpList",           "table"},
   {"tRoleBase",           "table"},
   {"formation",           "int"},
-  {"tJiBan",              "table"}
+  {"tJiBan",              "table"},
+  {"tElfList",            "table"},
 }
 
 WL_COMBAT_GETINFO_SEND = 
@@ -245,7 +247,8 @@ WL_COMBAT_GETINFO_SEND =
   {"tHelpList",           "table"},
   {"tRoleBase",           "table"},
   {"formation",           "int"},
-  {"tJiBan",              "table"}
+  {"tJiBan",              "table"},
+  {"tElfList",            "table"},
 }
 
 -------------------- 请求跨服切磋结束 ---------------------------

+ 1 - 0
script/module/areaBattle/AreaBattleCS.lua

@@ -903,6 +903,7 @@ function BattleDataHanle(msg)
                 roleBase = msg.roleBase,
                 formation = msg.formation,
                 jiBan = msg.jiBan,
+                elfList = msg.elfList,
             }
         end
     end

+ 2 - 1
script/module/battleDataManager/BattleDataNS.lua

@@ -48,7 +48,7 @@ function CreateBattleData(fd, msg)
         local args  = {
             [1] = playerUuid
         }
-        local objList, helpList, rolebase, formation,jiban = moduleFn.getCombatObjList(nil, CombatDefine.DEFEND_SIDE, args, msg.combatType)
+        local objList, helpList, rolebase, formation,jiban, elfList = moduleFn.getCombatObjList(nil, CombatDefine.DEFEND_SIDE, args, msg.combatType)
         if objList then
             tMsgData.errCode = MiddleDefine.MIDDLE_GET_COMBAT_OK
             tMsgData.objList = objList
@@ -56,6 +56,7 @@ function CreateBattleData(fd, msg)
             tMsgData.roleBase = rolebase
             tMsgData.formation = formation
             tMsgData.jiBan = jiban
+            tMsgData.elfList = elfList or {}
             InnerMsg.sendMsg(0, tMsgData)
         else
             print("[BattleDataNS] 获取对战英雄列表失败")

+ 24 - 2
script/module/combat/CombatLogicCS.lua

@@ -11,6 +11,7 @@ local JibanLogic = require("combat.JibanLogic")
 local BeSkill = require("combat.BeSkill")
 local CombatObj = require("combat.CombatObj")
 local RoleDefine = require("role.RoleDefine")
+local CombatLogic = require("combat.CombatLogic")
 
 -- 初始combatInfo
 local function initCombatInfo(human, combatType, mapID)
@@ -32,6 +33,7 @@ local function initCombatInfo(human, combatType, mapID)
 	combatInfo.bufferUseList = nil 	-- 战斗buff
 	combatInfo.objList = nil  		-- 战斗英雄列表
 	combatInfo.helpList = nil  		-- 战斗魔兽列表
+	combatInfo.elfList = nil  		-- 战斗精灵列表
 	combatInfo.rewardItem = {} 		-- 奖励
 	combatInfo.endParam = nil 		-- 额外参数
 	combatInfo.isVideo = nil 		-- 是否录像	
@@ -94,6 +96,22 @@ local function setHelp(helpList, side)
 	end
 end
 
+-- 设置精灵出战
+local function setElf(elfList, side)
+	if not elfList or not next(elfList) then
+		return
+	end
+
+	for index = 1, CombatDefine.COMBAT_ELF_CNT do
+		local elfObj = elfList[index]
+		if elfObj then
+			local pos = CombatDefine.SIDE2ELFPOS[side][index]
+			CombatImpl.setElf(pos, elfObj)
+		end
+	end
+end
+
+
 -- 为了战斗回放,某些数据需要保存
 local function copyToCombatInfo(combatInfo)
 	combatInfo.isWin = CombatImpl.result.isWin
@@ -104,6 +122,7 @@ local function copyToCombatInfo(combatInfo)
 	combatInfo.bufferUseList = Util.copyTable(CombatImpl.bufferUseList)
 	combatInfo.objList = Util.copyTable(CombatImpl.objList)	
 	combatInfo.helpList = Util.copyTable(CombatImpl.helpList)
+	combatInfo.elfList = Util.copyTable(CombatImpl.elfList)
 	combatInfo.totalAtkCnt = CombatImpl.totalAtkCnt
 end
 
@@ -173,6 +192,7 @@ local function onFightBegin(human, combatType, cbParam, param)
 	-- SkinLogic.onFightBegin(human) -- 处理皮肤属性, 这里原来逻辑也有问题,先不处理
 	CombatPosLogic.onFightBegin(human)
 	recalcHpFightBegin(human, combatType, cbParam)
+	CombatLogic.ElfInheritHeroAttr()
 end
 
 
@@ -191,10 +211,10 @@ function combatBegin(attackerInfo, defenderInfo, combatType, onFightEndFunc, ext
 
 
 	local defender, defHelp = defenderInfo.objList, defenderInfo.helpList
-    local defRBase, defFormation, defJiban = defenderInfo.roleBase, defenderInfo.formation, defenderInfo.jiBan
+    local defRBase, defFormation, defJiban, defElfList = defenderInfo.roleBase, defenderInfo.formation, defenderInfo.jiBan, defenderInfo.elfList
 
 	local attacker, atkHelp = attackerInfo.objList, attackerInfo.helpList
-    local atkRBase, atkFormation, atkJiban =  attackerInfo.roleBase, attackerInfo.formation, attackerInfo.jiBan
+    local atkRBase, atkFormation, atkJiban, atkElfList = attackerInfo.roleBase, attackerInfo.formation, attackerInfo.jiBan,attackerInfo.elfList
 
 	if not (attacker and next(attacker)) then
 		return
@@ -240,6 +260,8 @@ function combatBegin(attackerInfo, defenderInfo, combatType, onFightEndFunc, ext
 	setCombatInfo(defFormation, defender, CombatDefine.DEFEND_SIDE)
 	setHelp(atkHelp, CombatDefine.ATTACK_SIDE)
 	setHelp(defHelp, CombatDefine.DEFEND_SIDE)
+	setElf(atkElfList, CombatDefine.ATTACK_SIDE)
+	setElf(defElfList, CombatDefine.DEFEND_SIDE)
 	CombatImpl.setMaxRound(combatInfo.maxRound)
 	CombatImpl.setFightMode(combatInfo.fightMode)
 

+ 3 - 1
script/module/middle/MiddleCommonLogic.lua

@@ -234,7 +234,7 @@ function MiddleCommonLogic_CombatBegin_WL(fd, msg)
         local args  = {
             [1] = nDesUID
         }
-        local objList, helpList, rolebase, formation,jiban = moduleFn.getCombatObjList(nil, CombatDefine.DEFEND_SIDE, args, msg.nCombatType)
+        local objList, helpList, rolebase, formation,jiban, elfList = moduleFn.getCombatObjList(nil, CombatDefine.DEFEND_SIDE, args, msg.nCombatType)
         if objList then
             tMsgData.nResult = MiddleDefine.MIDDLE_GET_COMBAT_OK
             tMsgData.tObjList = objList
@@ -242,6 +242,7 @@ function MiddleCommonLogic_CombatBegin_WL(fd, msg)
             tMsgData.tRoleBase = rolebase
             tMsgData.formation = formation
             tMsgData.tJiBan = jiban
+            tMsgData.tElfList = elfList or {}
             InnerMsg.sendMsg(0, tMsgData)
         else
             print("[MiddleCommonLogic_CombatBegin_WL] 获取对战英雄列表失败")
@@ -289,6 +290,7 @@ function MiddleCommonLogic_CombatBegin_SendWL(fd, msg)
         defRBase = msg.tRoleBase,
         defFormation = msg.formation,
         defJiban = msg.tJiBan,
+        defElfList = msg.tElfList,
     }
 
     YunYingLogic.onCallBack(human, "friendCombat", 1)

+ 1 - 0
script/module/middle/MiddleConnect.lua

@@ -429,6 +429,7 @@ function LW_COMBAT_GETINFO_SEND(fd, msg)
     tMsgData.tRoleBase = msg.tRoleBase
     tMsgData.formation = msg.formation
     tMsgData.tJiBan = msg.tJiBan
+    tMsgData.tElfList = msg.tElfList
 
     InnerMsg.sendMsg(nSrcFD, tMsgData)
     print("[LW_COMBAT_GETINFO_SEND] 发送 WL_COMBAT_GETINFO_SEND")