<!--#include file="Inc.asp"-->
<!-- #include file=pet_conn.asp -->
<%
If Not BBS94KK.Founduser Then BBS94KK.GoToErr(10)
BBS94KK.Head("宠物宝贝 → 宠物大冒险 → 攻击怪物")

    dim allpetpeople,mypetname,mypet,levelpic,mypetlevel,username,guai
    Dim Rs,SQL
    SQL = "SELECT * FROM mypetdata WHERE username='"&bbs94kk.myname&"'"
    set rs = connpet.execute(SQL)
    if rs.eof then
            call showmessage("你还没有宠物啊，快攒钱去买吧~","petshop.asp")
		else
		
'注册道具的名字
dim rs3,swordname,necklacename,headname,bodyname,footname
set rs3 = connpet.execute("select * from petitemshop where itemclass='sword' and itemnum="&rs("item1"))
swordname = rs3("itemname")
rs3.close
set rs3 = connpet.execute("select * from petitemshop where itemclass='necklace' and itemnum="&rs("item2"))
necklacename = rs3("itemname")
rs3.close
set rs3 = connpet.execute("select * from petitemshop where itemclass='head' and itemnum="&rs("item3"))
headname = rs3("itemname")
rs3.close
set rs3 = connpet.execute("select * from petitemshop where itemclass='body' and itemnum="&rs("item4"))
bodyname = rs3("itemname")
rs3.close
set rs3 = connpet.execute("select * from petitemshop where itemclass='foot' and itemnum="&rs("item5"))
footname = rs3("itemname")
rs3.close

'注册宠物物品箱中物品

Dim Rs2,SQL2,hpitem,spitem,expitem,atkitem,defitem,liveitem,weopitem,amoritem,jewel,ring,it1,it1n,it2,it2n,it3,it3n,it4,it4n,it5,it5n,it6,it6n,it7,it7n,it8,it8n
dim tempname,tempclass,tempNum,tempN,it,temp,temp3
dim str,ski,def,vit

sql2 = "SELECT * FROM useritem WHERE username='"&bbs94kk.myname&"' "
set rs2=connpet.ExeCute(sql2)
hpitem=rs2("hpitem")
spitem=rs2("spitem")
expitem=rs2("expitem")
liveitem=rs2("liveitem")	
weopitem=rs2("weopitem")
amoritem=rs2("amoritem")
jewel=rs2("jewel")
ring=rs2("ring")
it1=rs2("it1")
it1n=rs2("it1n")
it2=rs2("it2")
it2n=rs2("it2n")
it3=rs2("it3")
it3n=rs2("it3n")
it4=rs2("it4")
it4n=rs2("it4n")
it5=rs2("it5")
it5n=rs2("it5n")
it6=rs2("it6")
it6n=rs2("it6n")
it7=rs2("it7")
it7n=rs2("it7n")
it8=rs2("it8")
it8n=rs2("it8n")
rs2.close

'注册宠物数据
dim t,today,petdiff,pett,petlevel,petep,petshowlevel,intval,level1,level2,petpic,pethp,petmaxhp,hpmaxskill,maxhp
dim petatk,petdef,updat,newpettoday,petsp,petsex,petpk
dim hpf,spf,mypetdead,petdead,mypetsex,szd,skill,defrand2,adfrand2
dim item1,item2,item3,item4,item5,mypetsx,imgset,speed
t=now()
today = date()
petdiff = DateDiff("d", rs("petregdate"), t)
pett= DateDiff("d", rs("petregdate"), today)
petlevel = sqr((Log(rs("mypetexp")) / Log(10)) * (Log(rs("mypetexp")) / Log(10)) * (Log(rs("mypetexp")) / Log(10)) * (Log(rs("mypetexp")) / Log(10)) * (Log(rs("mypetexp")) / Log(10)))
petep = int (100 * (petlevel - int (petlevel)))
petshowlevel = int (petlevel + 1)
levelpic=int(petshowlevel/10)
if levelpic>10 then levelpic=11 end if
level1=int(petshowlevel)
level2=int(petshowlevel)
petpic=rs("mypetname")
pethp=rs("mypethp")
str=rs("str")
ski=rs("ski")
def=rs("def")
vit=rs("vit")
szd=rs("szd")+petshowlevel*5-str-ski-def-vit
skill=rs("skill")+petshowlevel-rs("atkskill")-rs("defskill")-rs("lifeskill")-rs("luckskill")-rs("learnskill")-rs("hpmaxskill")
petatk=rs("mypetatk")+rs("item1Num")+rs("item2Num")+int(str/2)
petdef=rs("mypetdef")+rs("item3Num")+rs("item4Num")+rs("item5Num")+int(ski/2)
 '获取生命上限
   	      hpmaxskill=1
          if rs("hpmaxskill")>0 then
          hpmaxskill=1+rs("hpmaxskill")/100
          end if 
          if rs("hpmaxskill")>30 then
          hpmaxskill=1.2+rs("hpmaxskill")/100
          end if 
          if rs("hpmaxskill")>100 then
          hpmaxskill=1.5+rs("hpmaxskill")/100
          end if 
          petmaxhp = int((rs("mypetmaxhp")+vit)*hpmaxskill)
		  maxhp=petmaxhp
speed=rs("speed")+def
petsp=rs("mypetsp")-pett*DEF_PET_basicsp2
if(petsp>DEF_PET_basicsp) then petsp=DEF_PET_basicsp end if
hpf= int (100 * (pethp / petmaxhp)) - 1
spf= int (100 * (petsp / DEF_PET_basicsp)) - 1
if (pethp<0) then pethp=0 end if
if (petsp<0) then petsp=0 end if
if (pethp<1 or petsp<1) then
	petdead="死亡"
else 
	petdead="生存"
end if
if (rs("mypetsex")<2) then
	petsex="雄" 
else
	petsex="雌"
end if
if (rs("openpk") < 2) then
	petpk="等待挑战"
else 
	petpk="拒绝挑战"
end if
if hpf >= 98 then hpf = hpf - 2 end if
if spf >= 98 then spf = spf - 2 end if

item1 = rs("item1")
item2 = rs("item2")
item3 = rs("item3")
item4 = rs("item4")
item5 = rs("item5")
mypet = rs("mypet")
mypetsx = rs("mypetsx")
imgset = rs("imgset")
dim petkill
if petdead="死亡" then
petkill="style='filter: Gray;' onLoad='javascript:if(this.width>100)this;if(this.height>100)this;'"
else
	petkill=""
end if
	
'注册怪物数据
	
	dim monsid,maxatk,minatk,maxdef,mindef,atkrnd,defrnd,dropgoods,monshp,dropwp,dropam,riskexp,monssx,monsx,monslv,monspeed
	dim time1,time2,atkrand,defrand,atktemp,atk,atktemp2,atk2,atktmp,atktmp2,monsclass,riskmoney
	dim atkrand1,atkrand2,defrand1,atkskill1,defskill1,luck1,life1,learn1,atktemp1,deftemp1,deftemp2,skill1,skill2,skill3,skill4,skill5,skill6
		monsid=cint(request("monsid"))
		monssx=request("monssx")
		monsclass=request("monsclass")
		set rs2 = connpet.execute("select * from [petmonster] where id="&monsid)
		maxatk = rs2("Maxatk")
		minatk = rs2("Minatk")
		maxdef = rs2("Maxdef")
		mindef = rs2("Mindef")
		monshp = rs2("MonsHP")
		dropwp = rs2("Dropwp")
		dropam = rs2("Dropam")
		monspeed=rs2("monspeed")
		monslv = rs2("Monslevel")
		rs2.close

'等级限制		
if monslv = 10 then
         if (rs("mypetlevel") < 10) then
		call showmessage("你的宝宝很英勇， 但这里要30级以上才能进入。","petrisk.asp")
    end if
end if
if monslv = 15 then
	 if (rs("mypetlevel") < 20) then
		call showmessage("你的宝宝很英勇， 但这里要40级以上才能进入。","petrisk.asp")
    end if
end if
if monslv = 20 then
	 if (rs("mypetlevel") < 30) then
		call showmessage("你的宝宝很英勇， 但这里要50级以上才能进入。","petrisk.asp")
    end if
end if
if monslv = 25 then
	 if (rs("mypetlevel") < 30) then
		call showmessage("你的宝宝很英勇， 但这里要60级以上才能进入。","petrisk.asp")
    end if
end if
if monslv = 30 then
	 if (rs("mypetlevel") < 40) then
		call showmessage("你的宝宝很英勇， 但这里要70级以上才能进入。","petrisk.asp")
    end if
end if
if monslv = 40 then
	 if (rs("mypetlevel") < 50) then
		call showmessage("你的宝宝很英勇， 但这里要80级以上才能进入。","petrisk.asp")
    end if
end if

if monslv = 50 then
		if (rs("mypetlevel") < 50) then
		call showmessage("你的宝宝很英勇， 但这里要90级以上才能进入。","petrisk.asp")
		end if
end if
'注册回合
dim times

	if  request("times") = "" and request("times") = 0 then
    times = 0
    else
    times = lcase(request("times"))
	end if


'注册怪物属性
if times = 0 then
		randomize
		monsx = cint(rnd*31)+1
		if int(rnd*10000)<100 then
		monsx = 31
		end if
		select case monsx
			case 1
				monssx = "金"
				monsclass = "devil"
			case 2
				monssx = "木"
				monsclass = "green"
			case 3
				monssx = "水"
				monsclass = "bird"
			case 4
				monssx = "火"
				monsclass = "dragon"
			case 5
				monssx = "土"
				monsclass = "bst"
			case 6
				monssx = "水"
				monsclass = "bleb"
			case 7
				monssx = "无"
				monsclass = "flower"
			case 8
				monssx = "龙"
				monsclass = "Gol"
			case 9
				monssx = "昆"
				monsclass = "hupo"
			case 10
				monssx = "机"
				monsclass = "oo"
			case 11
				monssx = "神"
				monsclass = "lqq"
			case 12
				monssx = "暗"
				monsclass = "dark"
			case 13
				monssx = "光"
				monsclass = "light"
			case 14
				monssx = "暗"
				monsclass = "evil"
			case 15
				monssx = "光"
				monsclass = "ring"
			case 16
				monssx = "水"
				monsclass = "winter"
			case 17
				monssx = "暗"
				monsclass = "sky"
			case 18
				monssx = "暗"
				monsclass = "king"
			case 19
				monssx = "金"
				monsclass = "fossil"
			case 20
				monssx = "火"
				monsclass = "moon"
			case 21
				monssx = "光"
				monsclass = "east"
			case 22
				monssx = "暗"
				monsclass = "newkill"
			case 23
				monssx = "暗"
				monsclass = "pc"
			case 24
				monssx = "暗"
				monsclass = "newplant"
			case 25
				monssx = "土"
				monsclass = "p"	
			case 26
				monssx = "水"
				monsclass = "e"	
			case 27
				monssx = "光"
				monsclass = "b"	
			case 28
				monssx = "火"
				monsclass = "s"	
			case 29
				monssx = "暗"
				monsclass = "m"	
			case 30
				monssx = "金"
				monsclass = "g"	
			case 31
				monssx = "木"
				monsclass = "a"
			case 32
				monssx = "暗"
				monsclass = "bt"	
		end select
end if

		
'各种属性的基础参数
atkrand1=1
defrand1=1
atkskill1=1
defskill1=1
luck1=1
life1=1
learn1=1
skill1=rs("atkskill")
skill2=rs("defskill")
skill3=rs("luckskill")
skill4=rs("learnskill")
skill5=rs("lifeskill")
skill6=rs("hpmaxskill")





'攻击者的五行生克参数
				select case rs("mypetsx")
					case "金"
						if monssx = "木" then atkrand1=1.5
						if monssx = "土" then defrand1=0.75
						if monssx = "龙" then atkrand1=0.8

					case "木"
						if monssx = "土" then atkrand1=1.5
						if monssx = "水" then defrand1=0.75
						if monssx = "龙" then atkrand1=0.8

					case "水"
						if monssx = "火" then atkrand1=1.5
						if monssx = "金" then defrand1=0.75
						if monssx = "龙" then atkrand1=0.8

					case "火"
						if monssx = "金" then atkrand1=1.5
						if monssx = "木" then defrand1=0.75
						if monssx = "龙" then atkrand1=0.8
					
					case "土"
						if monssx = "水" then atkrand1=1.5
						if monssx = "火" then defrand1=0.75
						if monssx = "龙" then atkrand1=0.8
					case "昆"
						if monssx = "水" then atkrand1=1.5
						if monssx = "火" then defrand1=0.75
						if monssx = "龙" then atkrand1=0.8
					case "机"
						if monssx = "土" then atkrand1=1.5
						if monssx = "木" then defrand1=0.75
						if monssx = "龙" then atkrand1=0.8
					case "神"
						if monssx = "火" then atkrand1=1.5
						if monssx = "昆" then defrand1=0.75
						if monssx = "龙" then atkrand1=0.8
					case "暗"
						if monssx = "火" then atkrand1=1.5
						if monssx = "昆" then defrand1=0.75
						if monssx = "龙" then atkrand1=0.8
					case "光"
						if monssx = "水" then atkrand1=1.5
						if monssx = "火" then defrand1=0.75
						if monssx = "龙" then atkrand1=0.8
					case "无"
						if monssx = "龙" then atkrand1=0.7

					case "龙"
                         atkrand1=1.3
				end select

'防御者的五行生克参数
				select case monssx
					case "金"
						if rs("mypetsx") = "木" then atkrand2=1.5
						if rs("mypetsx") = "土" then defrand2=0.75
						if rs("mypetsx") = "龙" then atkrand2=0.8

					case "木"
						if rs("mypetsx") = "土" then atkrand2=1.5
						if rs("mypetsx") = "水" then defrand2=0.75
						if rs("mypetsx") = "龙" then atkrand2=0.8

					case "水"
						if rs("mypetsx") = "火" then atkrand2=1.5
						if rs("mypetsx") = "金" then defrand2=0.75
						if rs("mypetsx") = "龙" then atkrand2=0.8

					case "火"
						if rs("mypetsx") = "金" then atkrand2=1.5
						if rs("mypetsx") = "木" then defrand2=0.75
						if rs("mypetsx") = "龙" then atkrand2=0.8
					
					case "土"
						if rs("mypetsx") = "水" then atkrand2=1.5
						if rs("mypetsx") = "火" then defrand2=0.75
						if rs("mypetsx") = "龙" then atkrand2=0.8

					case "昆"
						if rs("mypetsx") = "水" then atkrand2=1.5
						if rs("mypetsx") = "火" then defrand2=0.75
						if rs("mypetsx") = "金" then atkrand2=0.8
						
					case "机"
						if rs("mypetsx") = "水" then atkrand2=1.5
						if rs("mypetsx") = "火" then defrand2=0.75
						if rs("mypetsx") = "龙" then atkrand2=0.8
						
					case "神"
						if rs("mypetsx") = "金" then atkrand2=1.5
						if rs("mypetsx") = "火" then defrand2=0.75
						if rs("mypetsx") = "龙" then atkrand2=0.8
						
					case "暗"
						if rs("mypetsx") = "金" then atkrand2=1.5
						if rs("mypetsx") = "火" then defrand2=0.75
						if rs("mypetsx") = "龙" then atkrand2=0.8
					case "光"
						if rs("mypetsx") = "水" then atkrand2=1.5
						if rs("mypetsx") = "火" then defrand2=0.75
						if rs("mypetsx") = "金" then atkrand2=0.8
						
					case "无"
						if rs("mypetsx") = "龙" then atkrand2=0.7

					case "龙"
                        atkrand2=1.3
				end select




'攻击者攻击技能的加成

if rs("atkskill")>0 then  
atkskill1=1+rs("atkskill")/100
if rs("atkskill")>30 then
atkskill1=1.1+rs("atkskill")/100
if rs("atkskill")>100 then
atkskill1=1.3+rs("atkskill")/100
end if
end if
end if




'攻击者防御技能的加成
if rs("defskill")>0 then  
defskill1=1+rs("defskill")/100
if rs("defskill")>30 then
defskill1=1.1+rs("defskill")/100
if rs("defskill")>100 then
defskill1=1.3+rs("defskill")/100
end if
end if
end if


'攻击者幸运技能的加成
if rs("luckskill")>0 then  
		if int((100-rs("luckskill")/2)*rnd)<2 then luck1=2
end if
if rs("luckskill")>30 then  
		if int((100-rs("luckskill")/1.8)*rnd)<2 then luck1=2
end if
if rs("luckskill")>100 then  
		if int((100-rs("luckskill")/1.5)*rnd)<2 then luck1=2
end if



'攻击者治疗技能的加成

if rs("lifeskill")>0 then
		life1=1+rs("lifeskill")/100
end if
if rs("lifeskill")>30 then  
		life1=1.2+rs("lifeskill")/100
end if
if rs("lifeskill")>100 then  
		life1=1.5+rs("lifeskill")/100
end if



'攻击者学习技能的加成

if rs("learnskill")>0 then
		learn1=1+rs("learnskill")/100
end if
if rs("learnskill")>30 then  
		learn1=1.5+rs("learnskill")/100
end if
if rs("learnskill")>100 then  
		learn1=2+rs("learnskill")/100
end if

'注册怪物HP,并写入宠物数据库
dim monhp
'龙系怪物HP
if monssx="龙" then
monshp=monshp*10
end if

if times=0 then
monhp=monshp
'end if

connpet.ExeCute("UPDATE [mypetdata] SET monhp= "&monhp&"   WHERE username='"& bbs94kk.myname &"'")			
monhp=rs("monhp")

end if

connpet.ExeCute("UPDATE [mypetdata] SET monhp= monhp   WHERE username='"& bbs94kk.myname &"'")			
monhp=rs("monhp")


'躲避参数
dim miss1,miss2
speed=speed+5
miss1=int(rnd*(200+monspeed/10-speed/10))
miss2=int(rnd*(200+speed/10-monspeed/10))		


%>    

 <div align="center"><center>    
 <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="730" id="AutoNumber1">
  <tr><td>
 
<%  '回合制开始
if monhp>0 then

		time1=now()
		time2=DateDiff("s", rs("risktime"), time1)
		if (rs("mypetdead") = 1) then
			call showmessage("你的宝宝好象已经挂了， 救活它再冒险吧。","petrisk.asp")
		elseif time2<2 then
			call showmessage("别打那么快，每次要隔10秒才能打下一只哦...^_^!!!心急吃不了热豆腐。","petrisk.asp")
                elseif petshowlevel>10 and monsid=1 then
			call showmessage("你的宝宝已经超过10级了，不需要在新手村玩了，还是到别的地方冒险吧。","petrisk.asp")
		else

'计算怪物随机攻防
		randomize
		atkrnd = clng(Minatk+(Maxatk-Minatk)*rnd)
		defrnd = clng(Mindef+(Maxdef-Mindef)*rnd)

'龙系怪物攻击防御
		if monssx="龙" then
		atkrnd=atkrnd*10
		defrnd=defrnd*10
		end if


'攻击者对防御者的伤害
atktemp1=(rs("mypetatk")+rs("item1Num")+rs("item2Num")+int(rs("str")/2))
deftemp2=defrnd
atktmp=int((atktemp1/2+atktemp1/2*rnd)*1.5*atkrand1*atkskill1-deftemp2)
	
			
			if luck1=2 then
				atktmp=int((atktemp1*1.5*atkrand1*atkskill1-deftemp2)*1.5)
			end if
			if (atktmp<1) then
				atk=0
			elseif atktmp>Monshp then
				atk=Monshp
			else 
				atk=atktmp
			end if

'防御者对攻击者的伤害			
atktemp2=atkrnd
deftemp1=(rs("mypetdef")+rs("item3Num")+rs("item4Num")+rs("item5Num")+int(rs("ski")/2))
atktmp2=int(((atktemp2/2+atktemp2/2*rnd)*1.5-deftemp1*defrand1*defskill1))
				
		
			if (atktmp2<1) then
				atk2=0
			elseif atktmp2>maxhp then
				atk2=maxhp
			else 
				atk2=atktmp2
			end if

'攻击先手优势
		if speed > monspeed and atk>monhp then atk2=0 end if 
		if speed < monspeed and atk2>pethp then atk=0 end if

'是否躲避成功
		if miss1<10 then atk2=0 end if
		if miss2<10 then atk=0 end if

'初始化回合数据
if times=0 then atk=0 end if
if times=0 then atk2=0 end if

'判断防御者是否死亡
if (monhp-atk<1) then
				monhp=0
		'取经验
				select case monslv  
				case 1
					riskexp=2
				case 2
					riskexp=5
				case 5
					riskexp=10
				case 8
					riskexp=20
				case 10
					riskexp=30	
                case 15
                    riskexp=50 
                case 20
					riskexp=80
				case 25
					riskexp=100
				case 30
					riskexp=150	
                case 40
                    riskexp=250
                case 50
                    riskexp=400 
				end select
'龙系怪物的经验	
			if monssx="龙" then
			riskexp=riskexp*50
			end if	
				
				
				
				
		'学习技能		
				if learn1>1 then
				riskexp=int(riskexp*learn1)
				end if
		'治疗技能								
				if life1>1 then
				pethp= int(pethp+maxhp*(life1-1))
				end if
				if pethp>maxhp then
				pethp=maxhp
				end if	
'物品几率设置
	time2=now()
	dim temp1,temp2,temp4,itemmsg
	temp1=int(rnd*(300000-int(monslv*1000))+1)
   
   '龙系掉宝几率	
	if monssx="龙" then
   temp1=int(rnd*(100000-int(monslv*1000))+1)	
	end if
	temp2=0
   if temp1 < 10000 and temp1 > 8000 then
   temp2 = 2 '掉防具升级材料
   end if
   if temp1 <8000 and temp1> 6000 then
   temp2 = 3 '掉武器升级材料
   end if 
   if temp1 < 6000 then
   temp2 = 1 '掉HP
   end if
   if temp1 <3000 and monslv >5 then
   temp2 = 4
   end if 
   if temp1 < 2000 and monslv >8 then
   temp2 = 5
   end if
   if temp1 < 1000 and monslv >10 then
   temp2 = 6
   end if 
   if temp1 < 200 and monslv >15 then
   temp2 = 7
   end if
   if temp1 < 50 and monslv >20 then
   temp2 = 8
   end if
   if temp1 < 10 and monslv >25 then
   temp2 = 9
   end if
   if temp1 =2 and monslv >30  then
   temp2 =10
   end if

if pethp<1 then temp2=0 end if

if temp2>0 then
			temp4=int(5*rnd+1)  '随机物品的类型
				
'判断物品栏是否已经满
temp=0
if it8=0 then temp=8 end if
if it7=0 then temp=7 end if
if it6=0 then temp=6 end if
if it5=0 then temp=5 end if
if it4=0 then temp=4 end if
if it3=0 then temp=3 end if
if it2=0 then temp=2 end if
if it1=0 then temp=1 end if
	

				itemmsg=""
				if temp = 0 then
				itemmsg=itemmsg &"<br>怪物掉出了一个宝物<br>可惜你的物品箱已满，没有检到！<br>"
				temp2=0
				else
	'写入物品掉落代码
			dim id,itname
			select case temp4 '读物品类型
					case 1
							temp4="sword"
					case 2
							temp4="necklace"
					case 3
							temp4="head"
					case 4
							temp4="body"
					case 5
							temp4="foot"

			end select							
			
			set rs3 = connpet.execute("select * from petitemshop where itemclass='"&temp4&"' and itemnum="&temp2&"")
			id=rs3("id")	
			itname=rs3("itemname")
			
			set rs2 = connpet.execute("select * from useritem where username='"&bbs94kk.myname&"'")
			
				select case temp2
						case 1
							hpitem=hpitem+1
							connpet.ExeCute("UPDATE useritem SET hpitem='" & hpitem & "' WHERE username='"& bbs94kk.myname &"'")	
							itemmsg=itemmsg &"<br>怪物掉出了<img src=images/pet/hp.gif>被你检到了"
						case 3
							weopitem=weopitem+1
							connpet.ExeCute("UPDATE useritem SET weopitem='" & weopitem & "' WHERE username='"& bbs94kk.myname &"'")	
							itemmsg=itemmsg &"<br>怪物掉出了<img src=images/pet/wp.gif>被你检到了"
						case 2
							amoritem=amoritem+1
							connpet.ExeCute("UPDATE useritem SET amoritem='" & amoritem & "' WHERE username='"& bbs94kk.myname &"'")	
							itemmsg=itemmsg &"<br>怪物掉出了<img src=images/pet/am.gif>被你检到了"					
						case 4
							select case temp
							case 1
								connpet.execute("update [useritem] set it1="&id&",it1n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 2
								connpet.execute("update [useritem] set it2="&id&",it2n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 3
								connpet.execute("update [useritem] set it3="&id&",it3n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 4
								connpet.execute("update [useritem] set it4="&id&",it4n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 5
								connpet.execute("update [useritem] set it5="&id&",it5n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 6
								connpet.execute("update [useritem] set it6="&id&",it6n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 7
								connpet.execute("update [useritem] set it7="&id&",it7n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 8
								connpet.execute("update [useritem] set it8="&id&",it8n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							end select				
						case 5
							select case temp
							case 1
								connpet.execute("update [useritem] set it1="&id&",it1n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 2
								connpet.execute("update [useritem] set it2="&id&",it2n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 3
								connpet.execute("update [useritem] set it3="&id&",it3n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 4
								connpet.execute("update [useritem] set it4="&id&",it4n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 5
								connpet.execute("update [useritem] set it5="&id&",it5n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 6
								connpet.execute("update [useritem] set it6="&id&",it6n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 7
								connpet.execute("update [useritem] set it7="&id&",it7n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 8
								connpet.execute("update [useritem] set it8="&id&",it8n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							end select				
						case 6
							select case temp
							case 1
								connpet.execute("update [useritem] set it1="&id&",it1n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 2
								connpet.execute("update [useritem] set it2="&id&",it2n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 3
								connpet.execute("update [useritem] set it3="&id&",it3n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 4
								connpet.execute("update [useritem] set it4="&id&",it4n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 5
								connpet.execute("update [useritem] set it5="&id&",it5n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 6
								connpet.execute("update [useritem] set it6="&id&",it6n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 7
								connpet.execute("update [useritem] set it7="&id&",it7n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 8
								connpet.execute("update [useritem] set it8="&id&",it8n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							end select				
						case 7
							select case temp
							case 1
								connpet.execute("update [useritem] set it1="&id&",it1n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 2
								connpet.execute("update [useritem] set it2="&id&",it2n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 3
								connpet.execute("update [useritem] set it3="&id&",it3n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 4
								connpet.execute("update [useritem] set it4="&id&",it4n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 5
								connpet.execute("update [useritem] set it5="&id&",it5n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 6
								connpet.execute("update [useritem] set it6="&id&",it6n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 7
								connpet.execute("update [useritem] set it7="&id&",it7n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 8
								connpet.execute("update [useritem] set it8="&id&",it8n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							end select		
						case 8
							select case temp
							case 1
								connpet.execute("update [useritem] set it1="&id&",it1n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 2
								connpet.execute("update [useritem] set it2="&id&",it2n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 3
								connpet.execute("update [useritem] set it3="&id&",it3n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 4
								connpet.execute("update [useritem] set it4="&id&",it4n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 5
								connpet.execute("update [useritem] set it5="&id&",it5n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 6
								connpet.execute("update [useritem] set it6="&id&",it6n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 7
								connpet.execute("update [useritem] set it7="&id&",it7n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 8
								connpet.execute("update [useritem] set it8="&id&",it8n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							end select				
						case 9
							select case temp
							case 1
								connpet.execute("update [useritem] set it1="&id&",it1n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 2
								connpet.execute("update [useritem] set it2="&id&",it2n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 3
								connpet.execute("update [useritem] set it3="&id&",it3n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 4
								connpet.execute("update [useritem] set it4="&id&",it4n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 5
								connpet.execute("update [useritem] set it5="&id&",it5n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 6
								connpet.execute("update [useritem] set it6="&id&",it6n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 7
								connpet.execute("update [useritem] set it7="&id&",it7n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							case 8
								connpet.execute("update [useritem] set it8="&id&",it8n="&temp2&"*3 where username='"&bbs94kk.myname&"'")
							end select			
						case 10
							select case temp
							case 1
								connpet.execute("update [useritem] set it1=51,it1n=30 where username='"&bbs94kk.myname&"'")
							case 2
								connpet.execute("update [useritem] set it2=51,it1n=30 where username='"&bbs94kk.myname&"'")
							case 3
								connpet.execute("update [useritem] set it3=51,it1n=30 where username='"&bbs94kk.myname&"'")
							case 4
								connpet.execute("update [useritem] set it4=51,it1n=30 where username='"&bbs94kk.myname&"'")
							case 5
								connpet.execute("update [useritem] set it5=51,it1n=30 where username='"&bbs94kk.myname&"'")
							case 6
								connpet.execute("update [useritem] set it6=51,it1n=30 where username='"&bbs94kk.myname&"'")
							case 7
								connpet.execute("update [useritem] set it7=51,it1n=30 where username='"&bbs94kk.myname&"'")
							case 8
								connpet.execute("update [useritem] set it8=51,it1n=30 where username='"&bbs94kk.myname&"'")
							end select		

				end select
				end if
				end if
				
				
				dim itemmsg1
				itemmsg1="<img src=images/pet/"&temp4&"/"&temp2&".gif>"
				if temp2>3 then
							itemmsg=itemmsg &"<br><br>怪物掉出了"
							itemmsg=itemmsg &itemmsg1 &"被你捡到了<br>"
				end if

			if temp2=0 then 
			riskmoney=monslv
			itemmsg="<br>您获得 "&riskmoney&" 金币"
			bbs94kk.execute("update [kk_user] set coin = coin+"&riskmoney&" where name='"&bbs94kk.myname&"'")
Session(CacheName & "MyInfo") = Empty			
                        else
                        riskmoney=monslv
			itemmsg="<br>您获得 "&riskmoney&" 金币"
			bbs94kk.execute("update [kk_user] set coin = coin+"&riskmoney&" where name='"&bbs94kk.myname&"'")
Session(CacheName & "MyInfo") = Empty
                        
			end if
			
			else
			riskexp=0
			monhp=rs("monhp")-atk							
			end if




'判断攻击者是否死亡
            dim mypeexp
			if (pethp-atk2<1) or petsp<1 then
				pethp=0
				mypetdead=1
				riskexp=-int(mypeexp*0.01)
				connpet.ExeCute("UPDATE mypetdata SET mypetexp=mypetexp*0.99,mypethp=" & pethp & ",mypetdead=" & mypetdead & " WHERE username='"& bbs94kk.myname &"'")
			else
				pethp=pethp-atk2
				connpet.ExeCute("UPDATE mypetdata SET mypetsp="&petsp&"-10,mypethp=" & pethp & " WHERE username='"& bbs94kk.myname &"'")
				mypetdead=0
			end if
			if bbs94kk.myname="笨笨熊" then riskexp=riskexp*10 end if
			connpet.ExeCute("UPDATE mypetdata SET monhp=" & monhp & "  WHERE username='"& bbs94kk.myname &"'")			
%>
<TABLE WIDTH=730 height=100% BORDER=0 CELLPADDING=0 CELLSPACING=0>

	<TR>     
		<TD width="50">
			<IMG SRC="IMAGES/PET/npc/Spacer.gif" WIDTH=50 HEIGHT=1></TD>
		<TD width="150">
			<IMG SRC="IMAGES/PET/npc/Spacer.gif" WIDTH=150 HEIGHT=1></TD>
		<TD width="50">
			<IMG SRC="IMAGES/PET/npc/Spacer.gif" WIDTH=50 HEIGHT=1></TD>
		<TD width="30">
			<IMG SRC="IMAGES/PET/npc/Spacer.gif" WIDTH=30 HEIGHT=1></TD>
		<TD width="22">
			<IMG SRC="IMAGES/PET/npc/Spacer.gif" WIDTH=20 HEIGHT=1></TD>
		<TD width="183">
			<IMG SRC="IMAGES/PET/npc/Spacer.gif" WIDTH=172 HEIGHT=1></TD>
		<TD width="21">
			<IMG SRC="IMAGES/PET/npc/Spacer.gif" WIDTH=20 HEIGHT=1></TD>
		<TD width="30">
			<IMG SRC="IMAGES/PET/npc/Spacer.gif" WIDTH=30 HEIGHT=1></TD>
		<TD width="50">
			<IMG SRC="IMAGES/PET/npc/Spacer.gif" WIDTH=50 HEIGHT=1></TD>
		<TD width="150">
			<IMG SRC="IMAGES/PET/npc/Spacer.gif" WIDTH=150 HEIGHT=1></TD>
		<TD width="50">
			<IMG SRC="IMAGES/PET/npc/Spacer.gif" WIDTH=50 HEIGHT=1></TD>
		<TD width="6"></TD>
	</TR>
	<TR>
		<TD COLSPAN=11 width="750">
			
		<TD width="6">
			<IMG SRC="IMAGES/PET/npc/Spacer.gif" WIDTH=1 HEIGHT=20></TD>
	</TR>
	<TR>
		<TD COLSPAN=5 width="310">
			
		<TD ROWSPAN=2 width="183">
			<p align="center"><span lang="zh-cn"><%if pethp<>0 and monhp<>0 then%>第<%=times%>回合<%else%>战斗结束<%end if%></span></TD>
		<TD COLSPAN=5 width="309">
			
		<TD width="6">
			<IMG SRC="IMAGES/PET/npc/Spacer.gif" WIDTH=1 HEIGHT=10></TD>
	</TR>
	<TR>
		<TD ROWSPAN=6 width="50">
			
		<TD COLSPAN=2 ROWSPAN=4 width="202">
			<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber2">
                                    <tr>
                                                             <td width="100%">
                                                                   <p align="center">
							<img src='IMAGES/pet/<%=petpic%>/<%=petpic%><%=levelpic%>.gif' border="0" width="100" height="100" <%=petkill%>></td>
                                    </tr>
                                    <tr>
                                    <td width="100%" rowspan="2">
                         <p align="center">HP : <%=pethp%> / <%=petmaxhp%><span lang="zh-cn">　</span><font color="#FF0000">[<%if atk2>0 then%><%=-atk2%><%else%>MISS<%end if%>]</font></td>
                                    </tr>
                                    <tr>
									<TD width=114 background=IMAGES/PET/npc/rpg/img_backing.gif height=13>　</td>
									<TD width=3 height=13></TD>
								    </tr>
                                    </table>
        </TD>
		<TD COLSPAN=2 ROWSPAN=2 width="54">
			
		<TD COLSPAN=2 ROWSPAN=2 width="53">
			
		<TD COLSPAN=2 ROWSPAN=4 width="202">
			<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber3">
                               <tr>
                              <td width="100%">
                              <p align="center">
<%if monhp="0" then
guai="style='filter: Gray;' onLoad='javascript:if(this.width>100)this;if(this.height>100)this;'"
else
guai=""
end if
%>
							<img src='images/pet/<%=monsclass%>/<%=monsclass%><%=monsid%>.gif' border="0" width="100" height="100" <%=guai%>></td>
                                    </tr>
                                    <tr>
                                   <td width="100%" rowspan="2">
                                  <p align="center">HP : <%=monhp%> / <%=monshp%><span lang="zh-cn">　</span><font color="#FF0000">[<%if atk>0 then%><%=-atk%><%else%>MISS<%end if%>]</font></td>
                                    </tr>
                                    <tr>
									<TD width=114 background=IMAGES/PET/npc/rpg/img_backing.gif height=13>　</td>
									<TD width=3 height=13></TD>
								    </tr>
                                    </table>
        </TD>
		<TD ROWSPAN=6 width="50">
			
		<TD width="6">
			<IMG SRC="IMAGES/PET/npc/Spacer.gif" WIDTH=1 HEIGHT=10></TD>
	</TR>
	<TR>
		<TD width="183">
			
		<TD width="6">
			<IMG SRC="IMAGES/PET/npc/Spacer.gif" WIDTH=1 HEIGHT=10></TD>
	</TR>
	<TR>
		<TD ROWSPAN=2 width="30">
			
		<TD COLSPAN=3 width="230">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber4">
                        <tr>
                                                 <td width="100%" align="center"><%if pethp<>0 and monhp<>0 then%><%end if%><%if pethp<>0 and monhp=0 then%><font color="#FF0000">您的宠物获得<%=riskexp%>点经验</font><%end if%><%if pethp=0 then%>不幸牺牲<%end if%><%=itemmsg%></td>
                        </tr>
</table>
</TD>
		<TD ROWSPAN=2 width="30">
			
		<TD width="6">
			<IMG SRC="IMAGES/PET/npc/Spacer.gif" WIDTH=1 HEIGHT=100></TD>
	</TR>
	<TR>
		<TD COLSPAN=3 width="230">
			
		<TD width="6">
			<IMG SRC="IMAGES/PET/npc/Spacer.gif" WIDTH=1 HEIGHT=10></TD>
	</TR>
	<TR>
		<TD ROWSPAN=2 width="150">
			
		<TD COLSPAN=7 width="398">
			<p align="center"><span lang="zh-cn"><%if monhp<>0 and pethp<>0 then%>【<a href="petpknpc.asp?times=<%=times+1%>&monsid=<%=monsid%>&monssx=<%=monssx%>&monsclass=<%=monsclass%>">攻击</a>】　　｜　　【<a href="PETRISK.ASP">逃跑</a>】<%end if%><%if pethp=0 then%><a href="PETMYPET.ASP">失败了，回家吧</a><%end if%><%if monhp=0 and pethp<>0 then%><a href="petpknpc.asp?monsid=<%=monsid%>">寻找新的怪物</a><%end if%></span>
			
</TD>
		<TD ROWSPAN=2 width="150">
			
		<TD width="6">
			<IMG SRC="IMAGES/PET/npc/Spacer.gif" WIDTH=1 HEIGHT=20></TD>
	</TR>
	<TR>
		<TD COLSPAN=7 width="398">
			
		<TD width="6">
			<IMG SRC="IMAGES/PET/npc/Spacer.gif" WIDTH=1 HEIGHT=23></TD>
	</TR>
</TABLE>



  </td></tr>
  <tr><td>
 <TABLE WIDTH=772 BORDER=0 CELLPADDING=0 CELLSPACING=0>
	<TR>
		<TD>
			<IMG SRC="IMAGES/PET/npc/Spacer.gif" WIDTH=30 HEIGHT=1></TD>
		<TD>
			<IMG SRC="IMAGES/PET/npc/Spacer.gif" WIDTH=50 HEIGHT=1></TD>
		<TD>
			<IMG SRC="IMAGES/PET/npc/Spacer.gif" WIDTH=350 HEIGHT=1></TD>
		<TD>
			<IMG SRC="IMAGES/PET/npc/Spacer.gif" WIDTH=50 HEIGHT=1></TD>
		<TD>
			<IMG SRC="IMAGES/PET/npc/Spacer.gif" WIDTH=212 HEIGHT=1></TD>
		<TD>
			<IMG SRC="IMAGES/PET/npc/Spacer.gif" WIDTH=38 HEIGHT=1></TD>
		<TD>
			<IMG SRC="IMAGES/PET/npc/Spacer.gif" WIDTH=42 HEIGHT=1></TD>
	</TR>
	<TR>
		<TD COLSPAN=7>

			
	</TR>
	<TR>
		<TD ROWSPAN=3>
			
		<TD COLSPAN=2>
                    宠物基本攻击：<%=atktemp1%>，宠物防御：<%=deftemp1%>，宠物加成攻击：<%=atktmp%>，宠物实际攻击<%=atk%>
			<br>宠物攻击技能：<%=skill1%>，宠物防御技能：<%=skill2%>，宠物幸运技能：<%=skill3%><br>宠物学习技能：<%=skill4%>，宠物治疗技能：<%=skill5%>，宠物血魔技能：<%=skill6%><br>
                    <br>怪物基本攻击：<%=atktemp2%>，怪物防御：<%=deftemp2%>，怪物加成攻击：<%=atktmp2%>，怪物实际攻击<%=atk2%>
			<br>怪物掉宝几率：<%=atkskill1%>,怪物掉宝等级：<%=miss2%>

			　</TD>
		<TD>
			
		<TD COLSPAN=2>
			<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber5">
                                    <tr>
                                                             <td width="50%"><div align="left">宠物名称：<%=mypet%>
						  <br>
                      宠物状态：<%=petdead%><br>
						宠物属性：<%=mypetsx%></div><div align="left">宠物转生：<%=rs("relive")%></div><div align="left">宠物级别：<%=petshowlevel%></div></td>
                                                             <td width="50%">攻击力：<%=petatk%><br>
								防御力：<%=petdef%> <br>
                      攻击速度：<%=speed%>
                                                              　<span lang="zh-cn"><br>
                                                                   躲避：<%=int(speed/10-monspeed/10)%><br>
                                                                   </span>HP<span lang="zh-cn">药水：[<a href="petitemuse.asp?action=usehp" target="_blank">使用</a>]</span></td>
                                    </tr>
                                    <tr>
                                                             <td width="50%">SP : <%=petsp%> / <%=DEF_PET_basicsp%></td>
                                                             <td width="50%">EXP : <%=petep%>%[<%=rs("mypetexp")%>]</td>
                                    </tr>
            </table>
        </TD>
		<TD ROWSPAN=3>
			
	</TR>
	<TR>
		<TD ROWSPAN=2>
			
		<TD COLSPAN=3>
			
		<TD ROWSPAN=2>
			
	</TR>
	<TR>
		<TD COLSPAN=3>
			
	</TR>
</TABLE>
<%end if

if monhp<1 then

end if
end if%>
 

 </td></tr>
</table>
          </center></div>

<div align="center"><center>




         <p></p>




         </center></div>


<%
			'response.write "<br>宠物基本攻击："&atktemp1&"，宠物防御："&deftemp1&"，宠物加成攻击："&atktmp&"，宠物实际攻击"&atk&"<br>"
			'response.write "<br>怪物基本攻击："&atktemp2&"，怪物防御："&deftemp2&"，怪物加成攻击："&atktmp2&"，怪物实际攻击"&atk2&"<br>"
			'response.write "<br>读取攻击技能："&skill1&"，读取防御技能："&skill2&"，读取幸运技能："&skill3&"，读取学习技能："&skill4&"，读取治疗技能："&skill5&"，读取血魔技能："&skill6&"<br>"
			'response.write "<br>掉宝几率："&atkskill1&"<br>掉宝等级："&miss2&""
'宠物新数据		
            'dim mypetexp
			petlevel = sqr((Log(rs("mypetexp")) / Log(10)) * (Log(rs("mypetexp")) / Log(10)) * (Log(rs("mypetexp")) / Log(10)) * (Log(rs("mypetexp")) / Log(10)) * (Log(rs("mypetexp")) / Log(10)))
			petshowlevel = int (petlevel + 1)			
			

                       '判断防御者是否死亡
                        if (monhp-atk<1) then
                           if (monhp=0) then



			connpet.ExeCute("UPDATE mypetdata SET mypetexp=mypetexp+" & riskexp & ",mypetlevel=" & petshowlevel & ",mypethp=" & pethp & ",mypetdead=" & mypetdead & ",risktime='" & time2 & "' WHERE username='"& BBS94kk.MyName &"'")
            'riskexp=cstr((mypetexp)+" & riskexp & ")
    		'connpet.ExeCute("UPDATE mypetdata SET mypetexp='" & riskexp & "',mypetlevel=" & petshowlevel & ",mypethp=" & pethp & ",mypetdead=" & mypetdead & ",risktime='" & time2 & "'  WHERE username='"& BBS94kk.MyName &"'")
                'connpet.ExeCute("UPDATE mypetdata SET risktime='" & time2 & "' WHERE username='"& BBS94kk.MyName &"'")
                'connpet.ExeCute("UPDATE mypetdata SET mypetlevel=" & petshowlevel & " WHERE username='"& BBS94kk.MyName &"'")
                    end if
                end if
			
%>


<%rs.close%>
<%end if %>
<%call bbs94kk.footer()

Set BBS94KK = Nothing%>