function battle_ai047(npcID)  --纸鬼
	local sg=flag.GetBattleValue(12700)
	if sg==0 then
		local ar=battle.GetRndNumber(1,10)
		if ar==1 then
			flag.SetBattleValue(12700,1)
			ui.Popo_Auto(86809,1,npcID,3,0) --竟然有人闯进幻境了吗？咦，还有个蜀山弟子？--竟然有人闯进幻境了吗？咦，还有个蜀山弟子？
			global.WaitForPopo()
		elseif ar==2 or ar==10 then
			flag.SetBattleValue(12700,1)
			ui.Popo_Auto(86810,1,npcID,3,0) --你们熟悉五灵的相生相克吗？不熟的话最好去温习一下，不然待会得吃苦头了~--你们熟悉五灵的相生相克吗？不熟的话最好去温习一下，不然待会得吃苦头了~
			global.WaitForPopo()
		elseif ar==3 then
			flag.SetBattleValue(12700,1)
			ui.Popo_Auto(86811,1,npcID,3,0) --水克火，火克雷，雷克风……风生火，火生土，土生……生……生啥？--水克火，火克雷，雷克风……风生火，火生土，土生……生……生啥？
			global.WaitForPopo()
		end
	end 	
	
	m=flag.GetBattleValue(12817)
    n=flag.GetBattleValue(12047)
    if m==npcID then
		id = npcID
		battle.MagicToNpc(id,1093,1)   --法术
		flag.SetBattleValue(12817,1)
	elseif m==1 then
		a=battle.GetRndNumber(1,10)
		if a>=1 and a<=5 then
			id = battle.GetRndPlayer()
			battle.SetDamageScale(2)
			if id==128 and battle.CheckNpcStat(npcID,734)==1 and battle.CheckPlayerStat(128,735)==1 and battle.GetRndNumber(1,10)<=3 then
                battle.SetDamageScale(9999)
				player.RemoveStat(0,64,731)
			end
			battle.AtkToPlayer(id,1)     --普通攻击
		else
			id = battle.GetRndPlayer()
			battle.SetDamageScale(1.4)
			if id==128 and battle.CheckNpcStat(npcID,734)==1 and battle.CheckPlayerStat(128,735)==1 and battle.GetRndNumber(1,10)<=3 then
                battle.SetDamageScale(9999)
				player.RemoveStat(0,64,731)
			end
			battle.AtkToPlayer(id,2)     --2号攻击
		end
		flag.SetBattleValue(12817,0)
	else
		if n~=4 then
			a=battle.GetRndNumber(1,10)
			if a>=1 and a<=5 then
				n=n+1
				flag.SetBattleValue(12047,n)
				id = battle.GetRndPlayer()
				if id==128 and battle.CheckNpcStat(npcID,734)==1 and battle.CheckPlayerStat(128,735)==1 and battle.GetRndNumber(1,10)<=3 then
                    battle.SetDamageScale(9999)
				    player.RemoveStat(0,64,731)
			    end
				battle.AtkToPlayer(id,1)     --普通攻击
			else
				id = battle.GetRndPlayer()
				battle.SetDamageScale(0.7)
				if id==128 and battle.CheckNpcStat(npcID,734)==1 and battle.CheckPlayerStat(128,735)==1 and battle.GetRndNumber(1,10)<=3 then
                    battle.SetDamageScale(9999)
				    player.RemoveStat(0,64,731)
			    end
				battle.AtkToPlayer(id,2)     --2号攻击
				flag.SetBattleValue(12047,0)
			end

		else
			id = battle.GetRndPlayer()
			battle.SetDamageScale(0.7)
			if id==128 and battle.CheckNpcStat(npcID,734)==1 and battle.CheckPlayerStat(128,735)==1 and battle.GetRndNumber(1,10)<=3 then
                battle.SetDamageScale(9999)
				player.RemoveStat(0,64,731)
			end
			battle.AtkToPlayer(id,2)
			flag.SetBattleValue(12047,0)
		end
	end
end