Преглед изворни кода

1.取消战斗时不能观看战斗录像的限制 2.增加英雄魔哪吒技能相关战斗代码

gitxsm пре 1 година
родитељ
комит
3bd9e5e4ed

+ 23 - 1
script/module/combat/CombatBuff.lua

@@ -1226,7 +1226,10 @@ function getExtraHurtRate(attacker,target,skillConfig)
 	local attackerHurtRat = 0
 	local biaoshiHurtRate = 0
 	local biaoshiCnt = 0
+	local moweiHurtRate = 0
 	local biaoshiCntLimit
+
+
 	if skillConfig.otherArgs.biaoshiHurtRate then
 		biaoshiCntLimit = skillConfig.otherArgs.biaoshiHurtRate[1]
 	end
@@ -1249,12 +1252,30 @@ function getExtraHurtRate(attacker,target,skillConfig)
 		end
 	end
 
+	--攻击者
+	for j = attacker.buffer[0], 1, -1 do
+		local obj = attacker
+		local buffer = obj.buffer[j]
+		local conf = BufferExcel.buffer[buffer.id]
+		if conf.cmd == "mowei" then --魔威
+			local nowHp = attacker.hp
+			local hpMax = CombatObj.getHpMax(attacker)
+			local percent = math.floor( (hpMax - nowHp )/hpMax * 100)
+			if percent >= 1 then
+				--moweiHurtRate = moweiHurtRate + (percent * conf.args[1])
+				moweiHurtRate = percent * conf.args[1]
+				break
+			end
+		end
+	end
+
+
 	guanxinzheHurtRate = guanxinzheHurtRate > 30000 and 30000 or guanxinzheHurtRate --300%限制
 	if biaoshiCntLimit and biaoshiCnt >= biaoshiCntLimit then
 		biaoshiHurtRate = skillConfig.otherArgs.biaoshiHurtRate[2]
 	end
 
-	local extraHurtRate = baojiHurtRate + guanxinzheHurtRate + huiheHurtRate + shandianHurtRate + attackerHurtRat + biaoshiHurtRate
+	local extraHurtRate = baojiHurtRate + guanxinzheHurtRate + huiheHurtRate + shandianHurtRate + attackerHurtRat + biaoshiHurtRate + moweiHurtRate
 	return extraHurtRate
 end
 
@@ -1768,6 +1789,7 @@ function qusan(target, qusanType,cnt)
 			delIndex[i] = nil
 		end
 	end
+
 	for k,v in ipairs(delIndex) do
 		local buffer = target.buffer[v]
 		if not buffer then break end

+ 55 - 0
script/module/combat/CombatCalc.lua

@@ -386,6 +386,61 @@ local function getExtraHurt(attacker, defender, skillConfig)
     -- 被动技能额外伤害
     extraHurt = extraHurt + BeSkill.getExtraHurt(attacker, defender, skillConfig)
 
+    --buff, debuff 数量差的额外伤害
+    if skillConfig.otherArgs.buffDiffHurt then
+        local condInfo = skillConfig.otherArgs.buffDiffHurt
+        local buffType1 = condInfo[1]   --buff类型1, 对应配置表buff中qusan分页中的type
+        local buffType2 = condInfo[2]   --buff类型2, 对应配置表buff中qusan分页中的type
+        local chooseType1 = condInfo[3]  --选择类型, 1-表示取被攻击者的某个属性, 2-取攻击者的某个属性
+        local calAttrType = condInfo[4] --用来计算伤害的属性类型, 与RoleDefine.lua中一致, 为0表示生命最大值
+        local calAttrRate = condInfo[5] --用来计算伤害的属性倍率, 万分比
+        local chooseType2 = condInfo[6]   --选择类型, 1-表示取被攻击者的某个属性, 2-取攻击者的某个属性
+        local limitAttrType = condInfo[7] --用来判断伤害上限的属性类型, 与RoleDefine.lua中属性一致
+        local limitAttrRate = condInfo[8]  --用来判断伤害上限的属性倍率, 多少倍就配多少
+
+        if buffType1 and buffType2 and chooseType1 and calAttrType and calAttrRate then
+            local buffCnt1 = CombatBuff.getCombatBufferCnt(defender, buffType1)
+            local buffCnt2 = CombatBuff.getCombatBufferCnt(defender, buffType2)
+            if buffCnt1 > buffCnt2 then
+                local calAttrValue = 0
+                local targetObj1 = defender
+                if chooseType1 == 2 then
+                    targetObj1 = attacker
+                end
+
+                if calAttrType == 0 then
+                    calAttrValue = CombatObj.getHpMax(targetObj1)
+                else
+                    calAttrValue = CombatObj.getValue(targetObj1, calAttrType)
+                end
+                local hurt = calAttrValue * (calAttrRate / 10000)
+                hurt = hurt * (buffCnt1 - buffCnt2)
+
+                --上限判断
+                if chooseType2 and limitAttrType and limitAttrRate then
+                    local limitAttrVale = 0
+                    local targetObj2 = attacker
+                    if chooseType2 == 1 then
+                        targetObj2 = defender
+                    end
+    
+                    if limitAttrType == 0 then
+                        limitAttrVale = CombatObj.getHpMax(targetObj2)
+                    else
+                        limitAttrVale = CombatObj.getValue(targetObj2, limitAttrType)
+                    end
+                    local limitHurt = limitAttrVale * limitAttrRate
+    
+                    if hurt > limitHurt then
+                        hurt = limitHurt
+                    end
+                end
+                extraHurt = extraHurt + hurt
+            end
+        end
+    end
+
+
     return extraHurt
 end
 

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

@@ -1466,9 +1466,9 @@ function repeatCombat(human, combatInfo)
 		return
 	end
 
-	if isCombating(human) then
-		return Broadcast.sendErr(human, Lang.COMBAT_VIDEO_LOOK_ERR_ING)
-	end
+	-- if isCombating(human) then
+	-- 	return Broadcast.sendErr(human, Lang.COMBAT_VIDEO_LOOK_ERR_ING)
+	-- end
 	
 	combatInfo.isVideo = true
 	human.combat = combatInfo	

+ 3 - 3
script/module/combat/CombatVideo.lua

@@ -191,9 +191,9 @@ end
 -- 战斗回放
 function lookCombatVideo(human, videoUuid, lookType)
 
-    if CombatLogic.isCombating(human) then
-		return Broadcast.sendErr(human, Lang.COMBAT_VIDEO_LOOK_ERR_ING)
-	end
+    -- if CombatLogic.isCombating(human) then
+	-- 	return Broadcast.sendErr(human, Lang.COMBAT_VIDEO_LOOK_ERR_ING)
+	-- end
 
     if not videoUuid or videoUuid == "" then return end
     local combatVideo = getCombatVideo(videoUuid)

+ 13 - 6
script/module/combat/Skill.lua

@@ -83,25 +83,32 @@ local function realUse(obj, skillID, fanjiTargets,otherArgs)
 
 		attack(obj, targets, skillConfig)
 
-		--战斗对象有分摊buff后导致会分摊debuff的修改, 如果需要更新到线上就把注释打开
-		--targets = TargetMode.getTargets(obj, skillConfig.targetMode, fanjiTargets, nil, true, skillConfig.type == CombatDefine.SKILL_TYPE1, skillID)
+		--local targets2 = TargetMode.getTargets(obj, skillConfig.targetMode, fanjiTargets, nil, true, skillConfig.type == CombatDefine.SKILL_TYPE1, skillID)
+		
+		local newTargets = {}
+		for _, lObj in ipairs(targets) do
+			if not lObj.addByfentan then
+				newTargets[#newTargets+1] = lObj
+			end
+		end
+
 
 		if not fanjiTargets and skillConfig.otherArgs.addBuffBeforeCmd then
-			CombatBuff.onHit(obj,targets,skillConfig)
+			CombatBuff.onHit(obj,newTargets,skillConfig)
 		end
 
 		--额外作用
 		local cmdTargets
 		if CMD[skillConfig.cmd] then
-		   cmdTargets = CMD[skillConfig.cmd](obj, skillConfig, targets)
+		   cmdTargets = CMD[skillConfig.cmd](obj, skillConfig, newTargets)
 		end
         
 		if not fanjiTargets then
 			if not skillConfig.otherArgs.addBuffBeforeCmd then
-				CombatBuff.onHit(obj,targets,skillConfig,cmdTargets,otherArgs)
+				CombatBuff.onHit(obj,newTargets,skillConfig,cmdTargets,otherArgs)
 			end
 		end
-		BeSkill.onHit(obj,targets,skillID)
+		BeSkill.onHit(obj,newTargets,skillID)
         
 		CombatImpl.totalAtkCnt = CombatImpl.totalAtkCnt + 1
 	end

+ 13 - 8
script/module/combat/TargetMode.lua

@@ -58,6 +58,7 @@ local function handlerInit(attacker, targetMode)
        local obj = getObj(pos)
        if obj then
            obj.fentq = nil
+		   obj.addByfentan = nil --更新标识
        end
     end
 end
@@ -102,7 +103,8 @@ local function handlerFenTan(attacker, targetMode, skillTargets, cmdTargets, ski
            end
 
            if not find then
-              targets[#targets + 1] = obj
+				obj.addByfentan = true --增加一个标识,表示是该对象是由于拥有"fentan" buff 额外加入对象列表的
+              	targets[#targets + 1] = obj
            end
        end
     end
@@ -203,9 +205,9 @@ function getTargets(attacker, targetMode, skillTargets, cmdTargets, checkChaofen
         end
 
 		--战斗对象有分摊buff后导致会分摊debuff的修改, 如果需要更新到线上就把注释打开
-		--if isNeedFentanObjs then
+		if isNeedFentanObjs then
 			handlerFenTan(attacker, targetMode, skillTargets, cmdTargets, skillID)
-		--end
+		end
     end
     local ret = { }
     for _, v in ipairs(targets) do
@@ -522,12 +524,12 @@ local function handler31(attacker,targetMode)
 		posList = CombatDefine.ROW2POS
 	end
 	local targetObjList = {}
-	for _,list in ipairs(posList[targetSide]) do 
+	for _,list in ipairs(posList[targetSide]) do
 		local objList = {}
 		for i = 1,#list do 
 			local obj = getObj(list[i])
 			-- 确认是武将(英雄)
-			if canTarget(obj) and obj.isPet then 
+			if canTarget(obj) and not obj.isPet then
 				table.insert(objList,obj)
 			end
 		end
@@ -535,15 +537,16 @@ local function handler31(attacker,targetMode)
 			targetObjList = objList
 		end
 	end
+
+
 	-- 筛选最后的targets
 	table.shuffle(targetObjList)
-	for i = 1,#targetObjList do 
+	for i = 1,#targetObjList do
 		targets[#targets+1] = targetObjList[i]
-		if #targets >= cnt then 
+		if #targets >= cnt then
 			break
 		end
 	end
-
 end
 
 --随机 选择目标 多次
@@ -1153,6 +1156,8 @@ local function handler30(attacker,targetMode)
 	end
 end
 
+
+
 ------------------------------ 分界线 ------------------------------
 -- 目前是一样了,等策划配置好skill表后删掉 @mafei
 local function handler3(attacker,targetMode)