function  battle_bai020(npcID)--枯木
	
	
	local wqx=flag.GetBattleValue(33037)--文星反转回合数
	if wqx>0 then
	flag.SetBattleValue(33037,wqx-1)
	if wqx-1==3 then
	flag.SetBattleValue(33038,2)--标记下一回合说话
	end
	    if wqx==3 and flag.GetBattleValue(33038)==2 then
		flag.SetBattleValue(33038,1)--屏蔽说话，标记觉醒阶段
		
		npc.ChangeDef(90000,-1350)
		npc.ChangeMagicDef(90000,0,-110)
		npc.ChangeMagicDef(90000,1,-110)
		npc.ChangeMagicDef(90000,2,-110)
		npc.ChangeMagicDef(90000,3,-110)
		npc.ChangeMagicDef(90000,4,-110)
		npc.ChangeMagicDef(90000,5,-110)
		npc.ChangeMagicDef(90000,7,-120)
		
		global.EnableSkipDialog(0)
        ui.Dialog_t(170709,529,1,0,1,0,2.5)--你……！你不是我的二叔！
		--wt(3)
		global.EnableSkipDialog(1)
		ui.Message(170710)--夏侯瑾轩恨意觉醒
		--wt(2)
        end
		if wqx==1 and flag.GetBattleValue(33038)==1 then
		flag.SetBattleValue(33038,0)--结束
		
		npc.ChangeDef(90000,1350)
		npc.ChangeMagicDef(90000,0,110)
		npc.ChangeMagicDef(90000,1,110)
		npc.ChangeMagicDef(90000,2,110)
		npc.ChangeMagicDef(90000,3,110)
		npc.ChangeMagicDef(90000,4,110)
		npc.ChangeMagicDef(90000,5,110)
		npc.ChangeMagicDef(90000,7,120)
		
		global.EnableSkipDialog(0)
        ui.Dialog_t(170721,516,1,0,1,0,2.5)--从来尽是愁，千古空留恨……
		--wt(4)
		global.EnableSkipDialog(1)
		
		end
	end
	if wqx>3 then
	flag.SetBattleValue(33039,1)
	else
	flag.SetBattleValue(33039,0)
	end
	global.Print(wqx)
	
	
	
	local m=flag.GetBattleValue(16001)
	local p=flag.GetBattleValue(16003)  --魔球召唤回合控制
	m=m+1
	flag.SetBattleValue(16001,m)
	local hp=battle.GetSelfHP(2)
	local r=flag.GetBattleValue(16015)   --第一次进入2阶段
	
	if flag.GetBattleValue(33075)~=2 and hp<=95 then
	    battle.MagicToNpc(0,1087,1)
		npc.ChangeHP(1,1,0,100)
	else
	
	if hp>70 then
		
		if battle.CheckNpcPlace(6)==1 then
			p=0
		end
		if p==0 then
			
			battle.MagicToNpc(npcID,310,1)
			
			flag.SetBattleValue(16003,1)   --回合行为控制
			flag.SetBattleValue(16008,10)  --魔球大小记录
			flag.SetBattleValue(16009,2)  --魔球位置记录
			flag.SetBattleValue(16010,50)  --魔球血量记录
			battle.ActionTwice()
		elseif p==1 then
			flag.SetBattleValue(16003,2)
			id=battle.GetPlaceNpcID(6)
			flag.SetBattleValue(16005,id)
			npc.SetHP(id,npc.GetHP(id,0)/2)
			battle.Skip()
		else
			id=flag.GetBattleValue(16005) --记录魔球npcID
			hpq=npc.GetHP(id,1)
			if m%4==0 or hpq<=20 then
				battle.MagicToNpc(id,270,1)
			else
				a=battle.GetRndNumber(1,10)
				if a>=1 and a<=3 then
				    if wqx>3 then
				    battle.SetSkillScale(-100)
					elseif wqx>0 and wqx<=3 then
					battle.SetSkillScale(150)
					end
					battle.MagicToPlayer(0,260,1)
				elseif a>=4 and a<=5 then
				    if wqx>3 then
				    battle.SetSkillScale(-100)
					elseif wqx>0 and wqx<=3 then
					battle.SetSkillScale(150)
					end
					battle.MagicToPlayer(0,262,1)
				elseif a>=6 and a<=8 then
				    battle.MagicToNpc(id,311,1)
				else
				    if wqx>3 then
				    battle.SetSkillScale(-100)
					elseif wqx>0 and wqx<=3 then
					battle.SetSkillScale(150)
					end
					battle.MagicToPlayer(0,263,1)
				end
			end
		end


	elseif hp>30 and hp<=70 then
	
		local i=battle.CheckNpcPlace(2)   --判断复制人
		local j=battle.CheckNpcPlace(3)   --判断复制人
		if r==0 then
			m=0
			flag.SetBattleValue(16001,m)
			flag.SetBattleValue(16015,1)
		end
		if m%5==0 and (i==1 or j==1) then
			ui.Dialog_t(86996,606,0,npcID,0,0,2)--虚冥幻灭，逆破重生！--虚冥幻灭，逆破重生！
			if flag.GetBattleValue(16004)==0 then   --进入第二阶段，删除魔球
				id5=flag.GetBattleValue(16005)
				npc.Destroy(id5)
				flag.SetBattleValue(16004,1)
			end
			
			id=battle.GetRndPlayer()
			if id==1 then
				battle.MagicToPlayer(id,264,1)
				battle.BeginSummon()
				if battle.CheckNpcPlace(2)==1 then 
					battle.AddNpc(6028,2) --暗影.夏侯
					global.CallScript(16504)
				else
					battle.AddNpc(6028,3) --暗影.夏侯
					global.CallScript(16505)
				end
			elseif id==2 then
				battle.MagicToPlayer(id,265,1)
				battle.BeginSummon()
				if battle.CheckNpcPlace(2)==1 then
					battle.AddNpc(6029,2) --暗影.瑕
					global.CallScript(16504)
				else
					battle.AddNpc(6029,3) --暗影.瑕
					global.CallScript(16505)
				end
			elseif id==8 then
				battle.MagicToPlayer(id,266,1)
				battle.BeginSummon()
				if battle.CheckNpcPlace(2)==1 then
					battle.AddNpc(6030,2) --暗影.暮菖兰
					global.CallScript(16504)
				else
					battle.AddNpc(6030,3) --暗影.暮菖兰
					global.CallScript(16505)
				end
			end
		else
			a=battle.GetRndNumber(1,10)
			if a>=1 and a<=4 then
				if wqx>3 then
				battle.SetSkillScale(-100)
				elseif wqx>0 and wqx<=3 then
				battle.SetSkillScale(150)
				end
				battle.MagicToPlayer(0,261,1)
			elseif a>=5 and a<=8 then
				if wqx>3 then
				battle.SetSkillScale(-100)
				elseif wqx>0 and wqx<=3 then
				battle.SetSkillScale(150)
				end
				battle.MagicToPlayer(0,263,1)
			else
				if wqx>3 then
				battle.SetSkillScale(-100)
				elseif wqx>0 and wqx<=3 then
				battle.SetSkillScale(150)
				end
				battle.MagicToPlayer(0,267,1)
			end
		end
	else
		local i=battle.CheckNpcPlace(2)   --判断复制人
		local j=battle.CheckNpcPlace(3)   --判断复制人
		if r==1 and (i==0 or j==0) then
			if i==0 and j==1 then
				if npc.GetTemplateID(battle.GetPlaceNpcID(2))==6028 then
				    if wqx>3 then
				    battle.SetSkillScale(-100)
				    elseif wqx>0 and wqx<=3 then
				    battle.SetSkillScale(150)
				    end
					battle.MagicToPlayer(0,312,1)
					npc.Destroy(battle.GetPlaceNpcID(2))
				elseif npc.GetTemplateID(battle.GetPlaceNpcID(2))==6029 then
				    if wqx>3 then
				    battle.SetSkillScale(-100)
				    elseif wqx>0 and wqx<=3 then
				    battle.SetSkillScale(150)
				    end
					battle.MagicToPlayer(0,313,1)
					npc.Destroy(battle.GetPlaceNpcID(2))
				elseif npc.GetTemplateID(battle.GetPlaceNpcID(2))==6030 then
				    if wqx>3 then
				    battle.SetSkillScale(-100)
				    elseif wqx>0 and wqx<=3 then
				    battle.SetSkillScale(150)
				    end
					battle.MagicToPlayer(0,314,1)
					npc.Destroy(battle.GetPlaceNpcID(2))
				end
			elseif i==1 and j==0 then
				if npc.GetTemplateID(battle.GetPlaceNpcID(3))==6028 then
				    if wqx>3 then
				    battle.SetSkillScale(-100)
				    elseif wqx>0 and wqx<=3 then
				    battle.SetSkillScale(150)
				    end
					battle.MagicToPlayer(0,312,1)
					npc.Destroy(battle.GetPlaceNpcID(3))
				elseif npc.GetTemplateID(battle.GetPlaceNpcID(3))==6029 then
				    if wqx>3 then
				    battle.SetSkillScale(-100)
				    elseif wqx>0 and wqx<=3 then
				    battle.SetSkillScale(150)
				    end
					battle.MagicToPlayer(0,313,1)
					npc.Destroy(battle.GetPlaceNpcID(3))
				elseif npc.GetTemplateID(battle.GetPlaceNpcID(3))==6030 then
				    if wqx>3 then
				    battle.SetSkillScale(-100)
				    elseif wqx>0 and wqx<=3 then
				    battle.SetSkillScale(150)
				    end
					battle.MagicToPlayer(0,314,1)
					npc.Destroy(battle.GetPlaceNpcID(3))
				end			
			elseif i==0 and j==0 then
				if (npc.GetTemplateID(battle.GetPlaceNpcID(2))==6028 and npc.GetTemplateID(battle.GetPlaceNpcID(3))==6029) or (npc.GetTemplateID(battle.GetPlaceNpcID(3))==6028 and npc.GetTemplateID(battle.GetPlaceNpcID(2))==6029) then
				    if wqx>3 then
				    battle.SetSkillScale(-100)
				    elseif wqx>0 and wqx<=3 then
				    battle.SetSkillScale(150)
				    end
					battle.MagicToPlayer(0,315,1)
					npc.Destroy(battle.GetPlaceNpcID(2))
					npc.Destroy(battle.GetPlaceNpcID(3))
				elseif (npc.GetTemplateID(battle.GetPlaceNpcID(2))==6028 and npc.GetTemplateID(battle.GetPlaceNpcID(3))==6030) or (npc.GetTemplateID(battle.GetPlaceNpcID(3))==6028 and npc.GetTemplateID(battle.GetPlaceNpcID(2))==6030) then
				    if wqx>3 then
				    battle.SetSkillScale(-100)
				    elseif wqx>0 and wqx<=3 then
				    battle.SetSkillScale(150)
				    end
					battle.MagicToPlayer(0,316,1)
					npc.Destroy(battle.GetPlaceNpcID(2))
					npc.Destroy(battle.GetPlaceNpcID(3))
				elseif (npc.GetTemplateID(battle.GetPlaceNpcID(2))==6030 and npc.GetTemplateID(battle.GetPlaceNpcID(3))==6029) or (npc.GetTemplateID(battle.GetPlaceNpcID(3))==6030 and npc.GetTemplateID(battle.GetPlaceNpcID(2))==6029) then
				    if wqx>3 then
				    battle.SetSkillScale(-100)
				    elseif wqx>0 and wqx<=3 then
				    battle.SetSkillScale(150)
				    end
					battle.MagicToPlayer(0,317,1)
					npc.Destroy(battle.GetPlaceNpcID(2))
					npc.Destroy(battle.GetPlaceNpcID(3))
				elseif npc.GetTemplateID(battle.GetPlaceNpcID(2))==6028 and npc.GetTemplateID(battle.GetPlaceNpcID(3))==6028 then
				    if wqx>3 then
				    battle.SetSkillScale(-100)
				    elseif wqx>0 and wqx<=3 then
				    battle.SetSkillScale(150)
				    end
					battle.MagicToPlayer(0,312,1)
					npc.Destroy(battle.GetPlaceNpcID(2))
					npc.Destroy(battle.GetPlaceNpcID(3))
				elseif npc.GetTemplateID(battle.GetPlaceNpcID(2))==6029 and npc.GetTemplateID(battle.GetPlaceNpcID(3))==6029 then
				    if wqx>3 then
				    battle.SetSkillScale(-100)
				    elseif wqx>0 and wqx<=3 then
				    battle.SetSkillScale(150)
				    end
					battle.MagicToPlayer(0,313,1)
					npc.Destroy(battle.GetPlaceNpcID(2))
					npc.Destroy(battle.GetPlaceNpcID(3))
				elseif npc.GetTemplateID(battle.GetPlaceNpcID(2))==6030 and npc.GetTemplateID(battle.GetPlaceNpcID(3))==6030 then
				    if wqx>3 then
				    battle.SetSkillScale(-100)
				    elseif wqx>0 and wqx<=3 then
				    battle.SetSkillScale(150)
				    end
					battle.MagicToPlayer(0,314,1)
					npc.Destroy(battle.GetPlaceNpcID(2))
					npc.Destroy(battle.GetPlaceNpcID(3))
				end			
			end
			flag.SetBattleValue(16015,2)
		else	
	
			if m%5==0 then
				if wqx>3 then
				battle.SetSkillScale(-100)
				elseif wqx>0 and wqx<=3 then
				battle.SetSkillScale(150)
				end
				battle.MagicToPlayer(0,268,1)
			else			
				a=battle.GetRndNumber(1,10)
				if a>=1 and a<=4 then
				    if wqx>3 then
				    battle.SetSkillScale(-100)
				    elseif wqx>0 and wqx<=3 then
				    battle.SetSkillScale(150)
				    end
					battle.MagicToPlayer(0,261,1)
				elseif a>=5 and a<=8 then
				    if wqx>3 then
				    battle.SetSkillScale(-100)
				    elseif wqx>0 and wqx<=3 then
				    battle.SetSkillScale(150)
				    end
					battle.MagicToPlayer(0,267,1)
				else
				    if wqx>3 then
				    battle.SetSkillScale(-100)
				    elseif wqx>0 and wqx<=3 then
				    battle.SetSkillScale(150)
				    end
					battle.MagicToPlayer(0,268,1)
				end
			end
		end
	end

	end

end