gitxsm 1 год назад
Родитель
Сommit
9ebd6eb33f

+ 1 - 0
script/module/combat/CombatImpl.lua

@@ -158,6 +158,7 @@ function setData(pos, hero)
 	obj.relic.relicID = hero.relic and hero.relic.relicID or 0
 	obj.relic.star = hero.relic and hero.relic.star or 0
 	obj.skillList = hero.skillList or {}
+	obj.formationPos = hero.formationPos
     if CombatDefine.isBackup(obj) == CombatDefine.BACKUP_TYPE0 then
 	   obj.beSkillList = hero.beSkillList or {}
     else

+ 4 - 3
script/module/combat/CombatLogic.lua

@@ -172,7 +172,7 @@ function getCombatObjList(human, side, combatType, args)
 
 	if moduleFn.getCombatObjList then
 		local objList, helpList, rolebase, formation,jiban = moduleFn.getCombatObjList(human, side, args, combatType)
-		if objList then 
+		if objList then
 			return objList, helpList, rolebase ,formation,jiban
 		end
 	end
@@ -1179,6 +1179,7 @@ local function setCombatInfo(formation,objList, side)
 				-- 出战英雄站位
 			if CombatPosLogic.checkPos(formation,index, side) then
 				local pos = CombatDefine.SIDE2POS[side][index]
+				obj.formationPos = index
 				CombatImpl.setData(pos, obj)
 			end
 		end
@@ -1285,8 +1286,8 @@ function combatBegin(human, mapID, param, combatType, cbParam, isSaodang)
  	combatInfo.defHelp = defHelp or {}
  	combatInfo.defFormation = defFormation
 	combatInfo.defJiban = defJiban
-	combatInfo.posAttr[CombatDefine.ATTACK_SIDE] = CombatPosLogic.getPosAttr(attacker, atkFormation)
-	combatInfo.posAttr[CombatDefine.DEFEND_SIDE] = CombatPosLogic.getPosAttr(defender, defFormation)
+	combatInfo.posAttr[CombatDefine.ATTACK_SIDE] = CombatPosLogic.getPosAttr(attacker)
+	combatInfo.posAttr[CombatDefine.DEFEND_SIDE] = CombatPosLogic.getPosAttr(defender)
 	combatInfo.jiban[CombatDefine.ATTACK_SIDE] = JibanLogic.getJiban(attacker,atkJiban)
 	combatInfo.jiban[CombatDefine.DEFEND_SIDE] = JibanLogic.getJiban(defender,defJiban) 
 	combatInfo.maxRound = getMaxRound(human,combatType)

+ 39 - 24
script/module/combat/CombatPosLogic.lua

@@ -418,27 +418,9 @@ function posAttrQuery(human)
 end
 
 
-local function calcSinglePosAttr(posCfg, pos, obj)
-	local idx = 0
-	for k, v in ipairs(posCfg.pos) do
-		if v == pos then
-			idx = k
-			break
-		end
-	end
-
-	local posAttr = posCfg.attr[idx]
-	for _, v in ipairs(posAttr or {}) do
-		local attrType = v[1]
-		local attrValue = v[2]
-		obj.sysAttr[attrType] = (obj.sysAttr[attrType] or 0) + attrValue
-		obj.isSysAttrChange = true
-	end
-end
 
 
-
-function getPosAttr(objList, formation)
+function getPosAttr(objList)
 	local campList = {}
 	for i = 1,CombatDefine.COMBAT_HERO_CNT do
 		local obj = objList[i]
@@ -455,17 +437,43 @@ function getPosAttr(objList, formation)
 	    caclCampAttr(attr, camp, cnt)
 	end
 
+	return attr
+end
+
+
+
+local function calcSinglePosAttr(posCfg, pos, obj)
+	local idx = 0
+	for k, v in ipairs(posCfg.pos) do
+		if v == obj.formationPos then
+			idx = k
+			break
+		end
+	end
+
+	local posAttr = posCfg.attr[idx]
+	for _, v in ipairs(posAttr or {}) do
+		local attrType = v[1]
+		local attrValue = v[2]
+		obj.sysAttr[attrType] = (obj.sysAttr[attrType] or 0) + attrValue
+		obj.isSysAttrChange = true
+	end
+end
+
+local function posAttrAdd(formation, posList)
 	--阵法中单个位置的属性加成
 	local posCfg = getFormationConfig(formation)
 	if posCfg then
-		for pos, obj in pairs(objList) do
-			calcSinglePosAttr(posCfg, pos, obj)
+		for _,pos in ipairs(posList) do
+			local obj = CombatImpl.objList[pos]
+			if obj then
+				calcSinglePosAttr(posCfg, pos, obj)
+			end
 		end
 	end
+end
 
 
-	return attr
-end
 
 function onFightBegin(human)
 	-- 获取进攻方种族属性
@@ -481,7 +489,7 @@ function onFightBegin(human)
 			end
 		end
 	end
-	
+
 	-- 获取防御方种族属性
 	local attrs2 = human.combat.posAttr[2]
 	if attrs2 then
@@ -495,6 +503,13 @@ function onFightBegin(human)
 			end
 		end
 	end
+
+
+	--阵法中位置的属性加成
+	posAttrAdd(human.combat.atkFormation, CombatDefine.SIDE2POS[CombatDefine.ATTACK_SIDE])
+
+	posAttrAdd(human.combat.defFormation, CombatDefine.SIDE2POS[CombatDefine.DEFEND_SIDE])
+
 end
 
 -- 获得 怪物组的 光环  血量加成

+ 1 - 0
script/module/platform/RebateLogic.lua

@@ -78,6 +78,7 @@ function NS_Rebate_Do(channelId, serverId, account)
     if not human or not human.db or not human.db._id then
         local logInfo = string.format("channelId: %s, serverId: %s, account: %s, result: %s, time: %s",
             channelId, serverId, account, "defeat", os.time())
+
         Log.write(Log.LOGID_OSS_REBATE, logInfo)
 
         return