gitxsm преди 10 месеца
родител
ревизия
52629c1d22
променени са 2 файла, в които са добавени 79 реда и са изтрити 30 реда
  1. 9 20
      script/module/combat/BeSkill.lua
  2. 70 10
      script/module/combat/Skill.lua

+ 9 - 20
script/module/combat/BeSkill.lua

@@ -508,13 +508,8 @@ function onSkillID(obj,skillID)
 	return skillID
 end
 
--- 延迟加或者不加战斗帧的技能cmd
-local DELAY_FRAME_CMD ={
-	["qusan"] = 1,
-}
-
 
-local function use(attacker,targets,data,newFrame, packBuff)
+local function use(attacker,targets,data,newFrame, packBuff, hitObj)
 	if canUse(attacker,data) and canUseOnHit(targets and targets[1],data) then
 		--print("beskill realuse:",attacker.pos,data[1])
 		--local skillConfig = SkillExcel[data[1]]
@@ -529,22 +524,14 @@ local function use(attacker,targets,data,newFrame, packBuff)
            CombatImpl.afterBuff()
         end
 
-		local isAddFrame = false
 		if Skill.CMD[skillConfig.cmd] then
 			if newFrame or CombatImpl.isSkillFrameEmpty() then
 				--进入战斗时,未加入任何战斗帧触发被动技能时,先添加被动技能的战斗帧,可以在这个战斗帧上挂被动技能引发的额外作用
-                -- CombatImpl.addFrame()
-				-- CombatImpl.setSkillID(attacker, data[1])
-
-				if not DELAY_FRAME_CMD[skillConfig.cmd] then
-					CombatImpl.addFrame()
-					CombatImpl.setSkillID(attacker, data[1])
-				else
-					isAddFrame = true
-				end
+                CombatImpl.addFrame()
+				CombatImpl.setSkillID(attacker, data[1])
 
 			end
-			ret = Skill.CMD[skillConfig.cmd](attacker,skillConfig,targets, isAddFrame)
+			ret = Skill.CMD[skillConfig.cmd](attacker,skillConfig,targets, hitObj)
 		end	
 
 		--判断是否加喊话
@@ -1354,7 +1341,7 @@ function onRoundBegin(round)
 	end
 end
 
-function beforeFanji(obj)
+function beforeFanji(obj, hitObj, isEnd)
 	if not obj or obj.isPet then
 		return 
 	end
@@ -1362,7 +1349,8 @@ function beforeFanji(obj)
 	if obj and obj.hurtType == CombatDefine.PHY_HURT_TYPE then
 		if obj and obj.beSkillList and obj.beSkillList[BESKILL_TYPE37] then
 			for _,v in ipairs(obj.beSkillList[BESKILL_TYPE37]) do
-				use(obj,{},v)
+				-- use(obj,{},v)
+				use(obj, {}, v, nil, nil, hitObj)
 			end
 		end
 	else
@@ -1691,7 +1679,8 @@ function afterHit(attacker,target, isEnd)
 			use(attacker,{target},v)
 		end	
 	end
-	beforeFanji(attacker, isEnd)
+	-- beforeFanji(attacker, isEnd)
+	beforeFanji(attacker, target, isEnd)
 end
 
 

+ 70 - 10
script/module/combat/Skill.lua

@@ -393,11 +393,79 @@ function CMD.hp(obj,skillConfig,skillTargets)
 		limit = args[6] * CombatObj.getHpMax(obj) / 10000
 	end
 
+	local hpAddRate = CombatObj.getValue(obj,RoleDefine.ZAOCHENG_HP_ADD_RATE) / 10000
+	for _,target in ipairs(targets) do
+		if not target.bufferCmd["noHp"] then
+			hp = calcHp(obj,target,calcType,rate,limit,true)
+			hp = hp * (1 + hpAddRate)
+			hp = hp < 0 and 1 or hp
+
+            if hp > 0 and obj.isAllCalcHp == true then
+                if target.side == CombatDefine.DEFEND_SIDE then
+					hp = CombatImpl.commonArgs.hpLimit or hp
+				end
+				local d = CombatObj.updateHp(target,hp,nil,true,obj.pos,CombatObj.EXTRA_HP_TYPE)
+                local showHp = hp
+                if hp > 0 and d < 0 then
+                   showHp = hp * (-1)
+                end
+				CombatImpl.setExtraHit(target, showHp, CMD2ID["hp"])
+				CombatObj.onHpCB(target,d, obj.pos)
+            end 
+
+			if hp < 0 then
+				if target.side == CombatDefine.DEFEND_SIDE then
+					hp = CombatImpl.commonArgs.hpLimit or hp
+				end
+				local d = CombatObj.updateHp(target,hp,nil,true,obj.pos,CombatObj.EXTRA_HP_TYPE)
+                if hp > 0 and d < 0 then
+                   hp = hp * (-1)
+                end
+				CombatImpl.setExtraHit(target, hp, CMD2ID["hp"])
+				CombatObj.onHpCB(target,d, obj.pos)
+			end
+			ret[#ret+1] = target
+		end
+	end
+	return ret
+end
 
 
+function CMD.shixueHP(obj,skillConfig,skillTargets, hitObj)
+	local ret = {}
+	local args = obj.isPet and obj.args or skillConfig.args
+	local r = math.random(0,10000)
+	if args[4] and r > args[4] then 
+		return
+	end
+	local calcType = args[1]
+	local rate = args[2]
+	local targets = TargetMode.getTargets(obj, args[3], skillTargets)
+	local hp
+	local limit
+	if args[5] and args[5] > 0 then
+		limit = args[5] * CombatObj.getValue(obj,RoleDefine.ATK_COMBAT_NOW) / 10000
+	end
+	if not obj.isPet and args[6] and args[6] > 0 then
+		limit = args[6] * CombatObj.getHpMax(obj) / 10000
+	end
+
+	local targetBuffInfo
+	local res, _, buffIdx = CombatBuff.isStatus(obj, {"noShixue"})
+
+	local bl = true
+	if res and buffIdx then
+		local objBuffList = CombatBuff.getBuffer(obj)
+		targetBuffInfo = objBuffList[buffIdx]
+
+		if hitObj and targetBuffInfo and targetBuffInfo.attackPos == hitObj.pos then
+			bl = false
+		end
+	end
+
 	local hpAddRate = CombatObj.getValue(obj,RoleDefine.ZAOCHENG_HP_ADD_RATE) / 10000
 	for _,target in ipairs(targets) do
-		if not target.bufferCmd["noHp"] then
+		if not target.bufferCmd["noHp"] and bl then
 			hp = calcHp(obj,target,calcType,rate,limit,true)
 			hp = hp * (1 + hpAddRate)
 			hp = hp < 0 and 1 or hp
@@ -963,22 +1031,14 @@ function CMD.randcmd(obj,skillConfig,skillTargets)
 	return {}
 end
 
-function CMD.qusan(obj,skillConfig,skillTargets, isAddFrame)
+function CMD.qusan(obj,skillConfig,skillTargets)
 	if obj.isPet then return {} end
-	print("================qusan0000==============")
 	local args = skillConfig.args
 	local r = math.random(0,10000)
 	if r > args[3] then
-		print("================qusan==============", r, args[3])
 		return
 	end
 
-	-- 只有能驱散时才增加技能帧
-	if isAddFrame then
-		CombatImpl.addFrame()
-		CombatImpl.setSkillID(obj, skillConfig.id)
-	end
-
 	local qusanType = args[1]
 	local calcType = args[5] and args[5][1]
 	local rate = args[5] and args[5][2]