function battle_bai004(npcID)--雪女
	
	local sg=flag.GetBattleValue(16222)	--语言提示打法
	local m=flag.GetBattleValue(16001)
	local n=flag.GetBattleValue(16002)
	local x=flag.GetBattleValue(16003)
	local y=flag.GetBattleValue(16004)
	local l=npc.GetHP(npcID,1)
	
	if l>=80 then
		a = battle.GetRndNumber(1,10)
		if a>=1 and a<=4 then
			id = battle.GetRndPlayer()
			battle.MagicToPlayer(id,220,1)     --冰梭
		elseif a>=5 and a<7 then
			battle.MagicToPlayer(0,221,1)   --天雹破空
		else
			id = battle.GetRndPlayer()
			battle.MagicToPlayer(id,223,1)   --吹雪
		end
	else
		if m==0 then
			if x==0 then
				if battle.CheckNpcPlace(2)==1 or battle.CheckNpcPlace(3)==1 or battle.CheckNpcPlace(4)==1 or battle.CheckNpcPlace(7)==1 then
					flag.SetBattleValue(16003,1)	
					battle.MagicToNpc(npcID,226,1)
				else
					if battle.CheckNpcPlace(3)==0 then
						id1=battle.GetPlaceNpcID(3)
						npc.ChangeHP(1,0,id1,-15)		
					end
					if battle.CheckNpcPlace(2)==0 then
						id2=battle.GetPlaceNpcID(2)	
						npc.ChangeHP(1,0,id2,-15)	
					end
					if battle.CheckNpcPlace(4)==0 then
						id3=battle.GetPlaceNpcID(4)	
						npc.ChangeHP(1,0,id3,-15)	
					end
					if battle.CheckNpcPlace(7)==0 then
						id4=battle.GetPlaceNpcID(7)	
						npc.ChangeHP(1,0,id4,-15)	
					end
					
					global.Wait(2)
					m=2
					flag.SetBattleValue(16001,m)
					a = battle.GetRndNumber(1,10)
					if a>=1 and a<=3 then
						id = battle.GetRndPlayer()
						battle.MagicToPlayer(id,220,1)     --冰梭
					elseif a>=4 and a<5 then
						battle.MagicToPlayer(0,221,1)   --天雹破空
					elseif a>=6 and a<8 then
						id = battle.GetRndPlayer()
						battle.MagicToPlayer(id,223,1)   --吹雪		
					else
						battle.MagicToPlayer(0,224,1)   --怨女冰心
					end
				end
			else
				flag.SetBattleValue(16001,1)			
				flag.SetBattleValue(16003,0)
				id1=battle.GetPlaceNpcID(3)
				if id1>y then	
					npc.SetHP(id1,450)	
					flag.SetBattleValue(16004,id1)
					
				end
				id2=battle.GetPlaceNpcID(2)	
				if id2>y then	
					npc.SetHP(id2,450)		
					flag.SetBattleValue(16004,id2)
				end	
				id3=battle.GetPlaceNpcID(4)	
				if id3>y then				
					npc.SetHP(id3,450)	
					flag.SetBattleValue(16004,id3)
				end
				id4=battle.GetPlaceNpcID(7)	
				if id4>y then				
					npc.SetHP(id4,450)
					flag.SetBattleValue(16004,id4)
				end		
				battle.Skip()
			end
		elseif m>=1 and m<=3 then
			--if x==0 then
			--	flag.SetBattleValue(16003,1)				
			--	battle.MagicToNpc(0,227,3)
				if battle.CheckNpcPlace(3)==0 then
					id1=battle.GetPlaceNpcID(3)
					npc.ChangeHP(1,0,id1,-15)		
				end
				if battle.CheckNpcPlace(2)==0 then
					id2=battle.GetPlaceNpcID(2)	
					npc.ChangeHP(1,0,id2,-15)	
				end
				if battle.CheckNpcPlace(4)==0 then
					id3=battle.GetPlaceNpcID(4)	
					npc.ChangeHP(1,0,id3,-15)	
				end
				if battle.CheckNpcPlace(7)==0 then
					id4=battle.GetPlaceNpcID(7)	
					npc.ChangeHP(1,0,id4,-15)	
				end
				
				if sg==0 then   --战斗对话提示
					flag.SetBattleValue(16222,1)
					local zid=battle.GetRndPlayer()
					if zid==1 then
						uid=522
					elseif zid==2 then
						uid=183
					elseif zid==4 then
						uid=127
					elseif zid==8 then
						uid=166	
					elseif zid==32 then
						uid=552
					end
					ui.Dialog(86953,uid,0,0,zid,0)--可恶，那几个被冰冻的村民情况不妙，得想办法保护他们！
					ui.Message(170752)--提示：对村民使用药品不存在收益惩罚
				end
				
				--npc.SetAnim(90000,17)
				--battle.ActionTwice()
			--else
				--flag.SetBattleValue(16003,0)
				global.Wait(1.5)
				m=m+1
				flag.SetBattleValue(16001,m)
				a = battle.GetRndNumber(1,10)
				if a>=1 and a<=3 then
					id = battle.GetRndPlayer()
					battle.MagicToPlayer(id,220,1)     --冰梭
				elseif a>=4 and a<5 then
					battle.MagicToPlayer(0,221,1)   --天雹破空
				elseif a>=6 and a<8 then
					id = battle.GetRndPlayer()
					battle.MagicToPlayer(id,223,1)   --吹雪		
				else
					battle.MagicToPlayer(0,224,1)   --怨女冰心
				end
			--end
		elseif m==4 then                       --检查冰人剩余情况
			m=m+1
			flag.SetBattleValue(16001,m)
			i=0
			j=0
			if battle.CheckNpcPlace(3)==0 then
				i=i+1
				id=battle.GetPlaceNpcID(3)
				if npc.GetHP(id,1)==100 then
					i=i+1
				end
			else
				j=j+1
			end
			if battle.CheckNpcPlace(2)==0 then
				i=i+1
				id=battle.GetPlaceNpcID(2)
				if npc.GetHP(id,1)==100 then
					i=i+1
				end				
			else
				j=j+1
			end
			if battle.CheckNpcPlace(4)==0 then
				i=i+1
				id=battle.GetPlaceNpcID(4)
				if npc.GetHP(id,1)==100 then
					i=i+1
				end				
			else
				j=j+1
			end
			if battle.CheckNpcPlace(7)==0 then
				i=i+1
				id=battle.GetPlaceNpcID(7)
				if npc.GetHP(id,1)==100 then
					i=i+1
				end				
			else
				j=j+1
			end
		
			if i==8 then
				flag.SetBattleValue(16002,1)
				ui.Dialog(86954,688,2,npcID,0,0)--可恶，竟然将他们保护得这么好。
				npc.SetAnim(npcID,219,1)
				battle.Skip()
			elseif i>0 and j==0 then
				flag.SetBattleValue(19007,1)
				flag.SetBattleValue(16002,2)
				ui.Dialog(86955,688,2,npcID,0,0)--呵，这么照顾村民……不过还没结束呢。
				battle.MagicToNpc(npcID,222,1)
			elseif j>0 then
				flag.SetBattleValue(19006,2)
				flag.SetBattleValue(19007,1)
				flag.SetBattleValue(16002,3)
				ui.Dialog(86956,689,2,npcID,0,0)--人类魂魄能增长我的精元，用你们的命跟村民对换吧！
				battle.MagicToPlayer(0,225,1)   --怨女冰心结算
				global.WaitForBattleSEEnd(4512)
				battle.ActionTwice()
			end
		elseif m==5 then
			if battle.CheckNpcPlace(2)==1 or battle.CheckNpcPlace(3)==1 or battle.CheckNpcPlace(4)==1 or battle.CheckNpcPlace(7)==1 then
				flag.SetBattleValue(16003,1)	
				battle.MagicToNpc(npcID,226,1)
			elseif x==1 then
				flag.SetBattleValue(16001,6)			
				flag.SetBattleValue(16003,0)
				id1=battle.GetPlaceNpcID(3)
				if id1>y then	
					npc.SetHP(id1,450)	
					flag.SetBattleValue(16004,id1)
					
				end
				id2=battle.GetPlaceNpcID(2)	
				if id2>y then	
					npc.SetHP(id2,450)		
					flag.SetBattleValue(16004,id2)
				end	
				id3=battle.GetPlaceNpcID(4)	
				if id3>y then				
					npc.SetHP(id3,450)	
					flag.SetBattleValue(16004,id3)
				end
				id4=battle.GetPlaceNpcID(7)	
				if id4>y then				
					npc.SetHP(id4,450)
					flag.SetBattleValue(16004,id4)
				end		
				battle.Skip()
			else
				m=7
				flag.SetBattleValue(16001,m)
				if battle.CheckNpcPlace(3)==0 then
					id1=battle.GetPlaceNpcID(3)
					npc.ChangeHP(1,0,id1,-2)		
				end
				if battle.CheckNpcPlace(2)==0 then
					id2=battle.GetPlaceNpcID(2)	
					npc.ChangeHP(1,0,id2,-2)	
				end
				if battle.CheckNpcPlace(4)==0 then
					id3=battle.GetPlaceNpcID(4)	
					npc.ChangeHP(1,0,id3,-2)	
				end
				if battle.CheckNpcPlace(7)==0 then
					id4=battle.GetPlaceNpcID(7)	
					npc.ChangeHP(1,0,id4,-2)	
				end
				
				global.Wait(1.5)
				if n==1 then
					a = battle.GetRndNumber(1,10)				
					if a>=1 and a<=5 then
						id = battle.GetRndPlayer()
						battle.MagicToPlayer(id,220,1)     --冰梭
					else
						battle.MagicToPlayer(0,221,1)   --天雹破空
					end
				elseif n==2 then
					a = battle.GetRndNumber(1,10)
					if a>=1 and a<=4 then
						id = battle.GetRndPlayer()
						battle.MagicToPlayer(id,220,1)     --冰梭
					elseif a>=5 and a<7 then
						battle.MagicToPlayer(0,221,1)   --天雹破空
					else
						id = battle.GetRndPlayer()
						battle.MagicToPlayer(id,223,1)   --吹雪
					end
				elseif n==3 then
					a = battle.GetRndNumber(1,10)				
					if a>=1 and a<=5 then
						id = battle.GetRndPlayer()
						battle.MagicToPlayer(id,223,1)   --吹雪
					else
						battle.MagicToPlayer(0,224,1)   --怨女冰心
					end
				end
				
			end
		elseif m>=6 then	
			m=m+1
			if m==10 then
				m=0
			end
			flag.SetBattleValue(16001,m)
				if battle.CheckNpcPlace(3)==0 then
					id1=battle.GetPlaceNpcID(3)
					npc.ChangeHP(1,0,id1,-2)		
				end
				if battle.CheckNpcPlace(2)==0 then
					id2=battle.GetPlaceNpcID(2)	
					npc.ChangeHP(1,0,id2,-2)	
				end
				if battle.CheckNpcPlace(4)==0 then
					id3=battle.GetPlaceNpcID(4)	
					npc.ChangeHP(1,0,id3,-2)	
				end
				if battle.CheckNpcPlace(7)==0 then
					id4=battle.GetPlaceNpcID(7)	
					npc.ChangeHP(1,0,id4,-2)	
				end
				
				global.Wait(1.5)
			
			if n==1 then
				a = battle.GetRndNumber(1,10)				
				if a>=1 and a<=5 then
					id = battle.GetRndPlayer()
					battle.MagicToPlayer(id,220,1)     --冰梭
				else
					battle.MagicToPlayer(0,221,1)   --天雹破空
				end
			elseif n==2 then
				a = battle.GetRndNumber(1,10)
				if a>=1 and a<=4 then
					id = battle.GetRndPlayer()
					battle.MagicToPlayer(id,220,1)     --冰梭
				elseif a>=5 and a<7 then
					battle.MagicToPlayer(0,221,1)   --天雹破空
				else
					id = battle.GetRndPlayer()
					battle.MagicToPlayer(id,223,1)   --吹雪
				end
			elseif n==3 then
				a = battle.GetRndNumber(1,10)				
				if a>=1 and a<=5 then
					id = battle.GetRndPlayer()
					battle.MagicToPlayer(id,223,1)   --吹雪
				else
					battle.MagicToPlayer(0,224,1)   --怨女冰心
				end
			end
		end
	end
	
end