<%@ LANGUAGE=VBScript codepage ="936" %>
<!--#include file="sjfunc.asp"-->
<!--#include file="func.asp"-->
<!--#include file="../../mywp.asp"-->
<!--#include file="../../const3.asp"-->
<%
cwjh_name=Session("cwjh_name")
cwjh_grade=Session("cwjh_grade")
cwjh_jhdj=Session("cwjh_jhdj")
nowinroom=session("nowinroom")
%>
<!--#include file="pkif.asp"-->
<%
if cwjh_jhdj<jhdj_fz then
	Response.Write "<script language=JavaScript>{alert('提示：发招需要["&jhdj_fz&"]级以上才可以操作！');}</script>"
	Response.End
end if
if Instr(LCase(Application("cwjh_useronlinename"&nowinroom)),LCase(" "&cwjh_name&" "))=0 then 
	Session("cwjh_inthechat")="0" 
	Response.Redirect "chaterr.asp?id=001" 
end if
towho=Trim(Request.Form("towho"))
towhoway=Request.Form("towhoway")
saycolor=Request.Form("saycolor")
addwordcolor=Request.Form("addwordcolor")
addsays=Request.Form("addsays")
says=Trim(Request.Form("sy"))
'对暂离开、点哑穴判断
call dianzan(towho)
if len(says)>150 then 
says=Left(says,150)
says=lcase(says)
says=Replace(says,"&amp;","&")
end if
'对系统禁止字符处理
if cwjh_grade<9 then
says=bdsays(says)
end if
act=1
towhoway=0
i=instr(says,"$")
fnn1=mid(says,i+1)

'判断对npc操作
gw=left(towho,1)
if IsNumeric(gw)=true then
zz=split(gw,"级")
gw=1
else 
gw=0
end if  
if gw=1 then
   pk="【["&cwjh_name&"]技能】"
else
   pk="【技能】"
end if
says="<font color=red>"&pk&"<font color=" & saycolor & ">"+attack(mid(says,i+1),towho)+"</font>"
call chatsay(act,towhoway,towho,saycolor,addwordcolor,addsays,says)
function attack(fn1,to1)
Set conn=Server.CreateObject("ADODB.CONNECTION")
Set rs=Server.CreateObject("ADODB.RecordSet")
conn.open Application("cwjh_usermdb")
rs.open "select * from 用户 where 姓名='" & cwjh_name &"'",conn,2,2
if rs.eof or rs.bof then
    rs.close
	set rs=nothing	
	conn.close
	set conn=nothing
	Response.Write "<script language=JavaScript>{alert('提示：你不是江湖人，请登陆后进行操作！');}</script>"
	Response.End	
else
jhtx=rs("名单头像")
end if
juese=rs("角色")
if juese="" or juese="无" then
   	Response.Write "<script language=JavaScript>{alert('提示：你还没选择角色，请先选择角色！');}</script>"
	Response.End
	rs.close 
	set rs=nothing
	conn.close
	set conn=nothing
end if  
allvalue=rs("allvalue")
mymf=rs("mf")
if iswp(mymf,fn1)=0 then
	Response.Write "<script language=JavaScript>{alert('提示：你还没学习掌握["&trim(fn1)&"]技能！');}</script>"
	Response.End
	rs.close 
	set rs=nothing
	conn.close
	set conn=nothing
end if
if not(isnull(mymf)) then  
data1=split(mymf,";")  
data2=UBound(data1)  
for y=0 to data2-1  
data3=split(data1(y),"|") 
jndj=data3(1) 
erase data3  
next  
erase data1  
end if
'==============防御属性技能============
select case fn1
case "初级防御术","神圣战甲术","心灵启示","抗拒火环","幽灵盾","火识","困魔咒"
rs.close
rs.open "select * FROM 技能 WHERE 技能='" & trim(fn1) & "' and 角色='" & juese & "'",conn
if rs.eof or rs.bof then
	rs.close
	set rs=nothing	
	conn.close
	set conn=nothing
	Response.Write "<script language=JavaScript>{alert('提示：你的["& juese &"] 并没有这样的技能["& fn1 &"]呀！');}</script>"
	Response.End
end if
jineng=rs("技能")
jnci=rs("词")'攻击的描述词
jnshuoming=rs("说明")'说明
jntj=rs("条件")'条件
jnshuxing=rs("属性")'是否为防御技能
juese=rs("角色")
jnshuzhi=rs("g")'杀伤力的参考数值
xhfl=int(jnshuzhi/100)'消耗法力
gif="<img src=rpg/"& rs("pic")&" height=70>"   '图片
jnjia=int(jnshuzhi*(1+jndj/10))
rs.close
rs.open "select * FROM 用户 WHERE 姓名='" & cwjh_name & "'",conn
if rs.eof or rs.bof then
	rs.close
	set rs=nothing	
	conn.close
	set conn=nothing
	Response.Write "<script language=JavaScript>{alert('提示：你不是江湖中人呀！');}</script>"
	Response.End
end if
if rs("角色")="" or rs("角色")="无" then
	rs.close
	set rs=nothing	
	conn.close
	set conn=nothing
	Response.Write "<script language=JavaScript>{alert('提示：您还没选择角色!');}</script>"
	Response.End
end if
if xhfl>rs("法力") then
	rs.close
	set rs=nothing	
	conn.close
	set conn=nothing
	Response.Write "<script language=JavaScript>{alert('提示：您的法力不足!');}</script>"
	Response.End
end if
conn.execute "update 用户 set 防御=防御+"& jnjia &",法力=法力-"& xhfl &" where 姓名='" & cwjh_name &"'"
   attack="##用["& juese &"]技能("& fn1 &")修练["&jndj&"级]{"&jnci&"}##消耗法力（"& xhfl & "）增长了防御（"& jnjia & "）点！"
'   Response.Write "<script language=JavaScript>{alert('提示：使用{"&juese&"}角色技能["&fn1&"]成功，防御上升"& jnjia &"点，法力消耗"& xhfl & "点！');}</script>"
'   Response.End
exit function
case "群体治疗术"
rs.close
rs.open "select * FROM 技能 WHERE 技能='" & trim(fn1) & "' and 角色='" & juese & "'",conn
if rs.eof or rs.bof then
	rs.close
	set rs=nothing	
	conn.close
	set conn=nothing
	Response.Write "<script language=JavaScript>{alert('提示：你的["& juese &"] 并没有这样的技能["& fn1 &"]呀！');}</script>"
	Response.End
end if
jineng=rs("技能")
jnci=rs("词")'攻击的描述词
jnshuoming=rs("说明")'说明
jntj=rs("条件")'条件
jnshuxing=rs("属性")'是否为防御技能
juese=rs("角色")
jnshuzhi=rs("g")'杀伤力的参考数值
xhfl=int(jnshuzhi/100)'消耗法力
gif="<img src=rpg/"& rs("pic")&" height=70>"   '图片
jnjia=int(jnshuzhi*(1+jndj/10))
rs.close
rs.open "select * FROM 用户 WHERE 姓名='" & cwjh_name & "'",conn
if rs.eof or rs.bof then
	rs.close
	set rs=nothing	
	conn.close
	set conn=nothing
	Response.Write "<script language=JavaScript>{alert('提示：你不是江湖中人呀！');}</script>"
	Response.End
end if
if rs("角色")="" or rs("角色")="无" then
	rs.close
	set rs=nothing	
	conn.close
	set conn=nothing
	Response.Write "<script language=JavaScript>{alert('提示：您还没选择角色!');}</script>"
	Response.End
end if
if xhfl>rs("法力") then
	rs.close
	set rs=nothing	
	conn.close
	set conn=nothing
	Response.Write "<script language=JavaScript>{alert('提示：您的法力不足!');}</script>"
	Response.End
end if
if rs("组名")="" and rs("组名")="无" then
	rs.close
	set rs=nothing	
	conn.close
	set conn=nothing
	Response.Write "<script language=JavaScript>{alert('提示：此项功能是给组队内同伴提供治疗术，你什么组队都不参加怎么成？！');}</script>"
	Response.End
else
    zudui="yes"
    zuname=rs("组名")
end if
rs.close

if zudui="yes" then
rs.open "select * from 组队 where 组名='"&zuname&"'",conn,1,3
 if not (rs.eof and rs.bof) then
    znumber=rs("组员数")
    zuyuan=rs("组员")
    jnjia=jnjia*(znumber-1)
 end if
rs.close
rs.open "select * from 用户 where 组名='"&zuname&"'",conn,1,3
conn.execute "update 用户 set 体力=体力+"& jnjia &",法力=法力-"& xhfl &" where 组名='" & zuname &"'"
   attack="##用["& juese &"]技能("& fn1 &")修练["&jndj&"级]{"&jnci&"}##消耗法力（"& xhfl & "），组队内所有成员{"&zuyuan&"}共{"&znumber&"}人,增长了体力（"& jnjia & "）点！"
'   Response.Write "<script language=JavaScript>{alert('提示：使用{"&juese&"}角色技能["&fn1&"]成功，组队内所有成员增长了体力"& jnjia &"点，法力消耗"& xhfl & "点！');}</script>"
'   Response.End
exit function
end if
end select
'==============防御属性结束============
rs.close
rs.open "select * from 用户 where 姓名='" & to1 &"'",conn,2,2
if rs.eof then
   rs.close
  rs.open "select * from [怪物区] where 怪物='" & to1 &"'",conn,2,2
   if rs.eof then
      wt=""
   else
      wt="guaiwu"
   end if
else
   wt="ren"
end if
rs.close
select case wt
'=========================================对人的攻击判断=====================================================
case "ren"
rs.open "select * from 用户 where 姓名='" & to1 &"'",conn,2,2
dlsj=DateDiff("n",rs("登录"),now())
if dlsj<2 and cwjh_grade<10 then
	rs.close
	set rs=nothing	
	conn.close
	set conn=nothing
        attack="##，你不能对%%进行攻击，%%上线还没到2分钟啊！"
        exit function
end if
if rs("门派")="出家" and cwjh_grade<10 then
	rs.close
	set rs=nothing	
	conn.close
	set conn=nothing
        attack="##，你不能对%%进行攻击，他是出家人！"
        exit function
end if
sj=DateDiff("n",rs("死亡时间"),now())
if sj<15 and rs("宝物")="无" and cwjh_grade<10 then
	rs.close
	set rs=nothing	
	conn.close
	set conn=nothing
        attack="##，你不能对%%进行攻击，他刚刚被别人杀死，还是先放过他吧！"
        exit function
end if
if rs("等级")<=18 and rs("宝物")="无" and cwjh_grade<10 then
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
        attack="##，你不能对%%进行攻击，不要对初入江湖新手操作！"
        exit function
end if
if rs("保护")=True and cwjh_grade<10 and zstt<3 then
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
        attack="##，你不能对%%进行攻击，对方正在练功保护请不要偷袭!"
        exit function
end if
rs.close
rs.open "select * from 用户 where 姓名='" & cwjh_name &"'",conn
if rs("门派")="出家" and cwjh_grade<10 then
	rs.close
	set rs=nothing	
	conn.close
	set conn=nothing
        attack="##，你不能对%%进行攻击，你是出家人不可以操作!"
        exit function
end if
dlsj=DateDiff("n",rs("登录"),now())
if dlsj<2 and cwjh_grade<10 then
	rs.close
	set rs=nothing	
	conn.close
	set conn=nothing
        attack="##，你不能对%%进行攻击，你上线还不到2分钟就不要再杀人了！"
        exit function
end if
if rs("保护")=True and cwjh_grade<10 then
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
        attack="##，你不能对%%进行攻击，你正在练功保护请不要发招！"
        exit function
end if
if rs("杀人数")>=int(Application("cwjh_killman"))  and cwjh_grade<10 then
	conn.execute "update 用户 set 保护=false where 姓名='" & cwjh_name &"'"
	rs.close
	set rs=nothing	
	conn.close
	set conn=nothing
        attack="##，你不能对%%进行攻击，你作恶太多，超过江湖杀人上限"& Application("cwjh_killman") &"不能再发招了！"
        exit function
end if
myfl=rs("法力")
mytl=rs("体力")
rs.close
'开始技能
rs.open "select * FROM 技能 WHERE 技能='" & trim(fn1) & "' and 角色='" & juese & "'",conn
if rs.eof or rs.bof then
	set rs=nothing	
	conn.close
	set conn=nothing
	Response.Write "<script language=JavaScript>{alert('提示："&juese&"并没有这样的技能["&fn1&"]呀！');}</script>"
	Response.End
end if
jnci=rs("词")'攻击的描述词
jnshuoming=rs("说明")'说明
jntj=rs("条件")'条件
jnshuxing=rs("属性")'是否为防御技能
juese=rs("角色")
jnshuzhi=rs("g")'消耗的法力
xhfl=int(jnshuzhi/10)
xhtl=int(jnshuzhi/200)
gif="<img src=rpg/"& rs("pic")&" height=70>"   '图片

if xhfl>myfl or xhtl>mytl then
	rs.close
	set rs=nothing	
	conn.close
	set conn=nothing
	Response.Write "<script language=JavaScript>{alert('提示：您的法力或体力不足!');}</script>"
	Response.End
end if
'对方的判断
rs.close
rs.open "select * FROM 用户 where 姓名='" & to1 &"'",conn
to1=rs("姓名")
to1_dj=rs("等级")
tofy=rs("防御")

killer=int((jnshuzhi-tofy)*(1+jndj/10))
if killer>0 then
	conn.execute "update 用户 set 道德=道德-20,法力=法力-"& xhfl &",体力=体力-"& xhtl &" where 姓名='"& cwjh_name &"'"
	conn.execute "update 用户 set 道德=道德-20,体力=体力-"& killer &" where 姓名='"& to1 &"'"
    djinfo="##武功高强，杀伤%%体力["& killer &"点]，自己损失体力["& xhtl &"点]"

else
	if abs(killer)>5000 then 
	   killer=5000
	else
       killer=int(abs(killer)/10)
    end if
	conn.execute "update 用户 set 道德=道德-20,法力=法力-" & xhfl & ",体力=体力-"& xhtl & " where 姓名='" & cwjh_name &"'"
	conn.execute "update 用户 set 道德=道德-20,体力=体力-"& killer & " where 姓名='" & to1 &"'"
	djinfo="##武功技不如人，杀伤%%体力["& killer &"点]，自己损失体力["& xhtl &"点]"	
end if
rs.close
rs.open "select 体力 from 用户 where 姓名='" & cwjh_name &"'",conn,2,2
mytl=rs("体力")
rs.close
rs.open "select 体力 from 用户 where 姓名='" & to1 &"'",conn,2,2
totl=rs("体力")
randomize timer
wav=int(rnd*13)+1
mywav="wav"&wav&".wav"
if mytl<-100 then
	xinxi="由于%%的内力深厚，##只感觉眼前一些，双腿一蹬，灵魂飞往封神台报到去……"
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	call boot(cwjh_name,"发招，操作者："&cwjh_name&",[角色"&juese&"]唉，技不如人"&fn1)
	exit function
else
 if totl<-100 then
	xinxi="由于##的内力深厚，%%只感觉眼前一些，双腿一蹬，灵魂飞往封神台报到去了……"
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	call boot(cwjh_name,"发招，操作者："&to1&",[角色："&juese&"]唉，技不如人"&fn1)
	exit function
  end if
xinxi="##和%%都受了极重的内伤，到底鹿死谁手，尚未可知……"
end if
attack="##用["& juese &"]招式("& fn1 &")修练["&jndj&"级]攻击"&gif&"%%,{"&jnci&"}[<font color=red><b>"&djinfo&"</b></font>]，{<font color=green><b>"&xinxi&"</b></font>}……"
rs.close'=========================================判断怪物===========================================================
case "guaiwu"
	Response.Write "<script language=JavaScript>{alert('怪物区已经设置禁打！');}</script>"
	Response.End
rs.open "select * from 怪物区 where 怪物='"&to1&"'",conn
gwgongji=rs("攻击")
gwfangyu=rs("防御")
gwshuoming=rs("说明")
gwjifenjia=int((gwgongji+gwfangyu)/2)
myjifenjia=int((gwshuoming/cwjh_jhdj)*gwjifenjia)
if rs("kill")<0 then
conn.execute "update 怪物区 set kill=体力,杀人数=杀人数+1,操作时间=now() where 怪物='"&to1&"'"
end if
sj=DateDiff("n",rs("操作时间"),now())
if sj<1 then
	ss=1-sj
	Response.Write "<script language=JavaScript>{alert('此怪物已经死亡，请你等上["& ss &"]分钟,再操作！');}</script>"
	Response.End
	rs.close
	set rs=nothing	
	conn.close
	set conn=nothing
end if
rs.close
rs.open "select * from 用户 where 姓名='" & cwjh_name &"'",conn,2,2
mytili=rs("体力")
myfali=rs("法力")
rs.close
'开始技能
rs.open "select * FROM 技能 WHERE 技能='" & trim(fn1) & "' and 角色='" & juese & "'",conn
if rs.eof or rs.bof then
	rs.close
	set rs=nothing	
	conn.close
	set conn=nothing
	Response.Write "<script language=JavaScript>{alert('提示：你的["& juese &"] 并没有这样的技能["& fn1 &"]呀！');}</script>"
	Response.End
end if
jnci=rs("词")'攻击的描述词
jnshuoming=rs("说明")'说明
jntj=rs("条件")'条件
jnshuxing=rs("属性")'是否为防御技能
juese=rs("角色")
jnshuzhi=rs("g")'杀伤力的参考数值
xhfl=int(jnshuzhi/10)'消耗法力
xhtl=int(jnshuzhi/200)'消耗体力
gif="<img src=rpg/"& rs("pic")&" height=70>"   '图片
if xhfl>myfali or xhtl>mytili then
	rs.close
	set rs=nothing	
	conn.close
	set conn=nothing
	Response.Write "<script language=JavaScript>{alert('提示：您的法力或体力不足!');}</script>"
	Response.End
end if
rs.close
rs.open "select * from 怪物区 where 怪物='"&to1&"'",conn
if not rs.bof and not rs.eof then
gwgj=rs("攻击")
gwfy=rs("防御")
gwtl=rs("体力")
killer=jnshuzhi-int((gwfy+gwgj+gwtl)/3)
end if
rs.close
rs.open "select * from 用户 where 姓名='" & cwjh_name &"'",conn,2,2
randomize timer
wav=int(rnd*13)+1
mywav="wav"&wav&".wav"
randomize timer
dz=int(rnd*9)+1
select case dz
case 1
 dz_ok="一掌四式"
case 2
 dz_ok="葵花宝典"
case 3
 dz_ok="亢龙有悔"
case 4
 dz_ok="乾坤大挪移"
case 5
 dz_ok="回马枪"
case 6
 dz_ok="金蛇吐雾"
case 7
 dz_ok="守护兽狂咬"
case 8
 dz_ok="隔山打牛"
case 9
 dz_ok="如来神掌"
end select
if rs("体力")<-100 then
	attack="##<bgsound src=wav/gj/"&mywav&" loop=1>用["& juese &"]技能("& fn1 &")修练["&jndj&"级]{"&jnci&"}攻击"&gif&"%%,[<font color=red><b>"&djinfo&"</b></font>]使得[%%]体力下降:<font color=red>-"& killer &"</font>点,自己被[%%]用了一招<fonr color=red>["&dz_ok&"]</font>,使得体力下降:<font color=red>-"& mekill &"</font>点,##武技不如人，被%%活活咬死……"
    conn.execute "update 怪物区 set 杀人数=杀人数+1 where 怪物='" & to1 &"'"
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
    call boot(cwjh_name,"被怪物咬死，操作者："&cwjh_name&",["&juese&"]唉，技不如人"&fn1)
	exit function
end if
rs.close
rs.open "select * from 怪物区 where 怪物='"&to1&"'",conn
if  rs.bof or rs.eof then
	rs.close
	set rs=nothing	
	conn.close
	set conn=nothing
	Response.Write "<script language=JavaScript>{alert('提示：找不到怪物数据！');}</script>"
	Response.End
end if
gwgj=rs("攻击")
gwfy=rs("防御")
gwtl=rs("体力")
killer=jnshuzhi-int((gwfy+gwgj+gwtl)/3)
if killer>0 then
	conn.execute "update 用户 set 道德=道德-20,法力=法力-" & xhfl & ",体力=体力-"& xhtl & " where 姓名='" & cwjh_name &"'"
	conn.execute "update 怪物区 set kill=kill-"&int(killer/15)&" where 怪物='" & to1 &"'"
	djinfo="##武功高强,杀伤怪物体力"&int(killer/15)&"点"
        mekill=abs(int(killer/30))
        killer=int(killer/15)
else
	if abs(killer)>5000 then killer=5000
        killer=int(abs(killer)/10)
	mekill=killer*10
        conn.execute "update 用户 set 法力=法力-" & xhfl & ",体力=体力-"&mekill&" where 姓名='" & cwjh_name &"'"
	conn.execute "update 怪物区 set kill=kill-"&killer&" where 怪物='" & to1 &"'"
	djinfo="##武功技不如人，杀伤怪物体力"&killer&"点"
end if
if rs("kill")>-100 then
    fanji="<font color=red>【["&to1&"]反击】<font color=" & saycolor & ">由于##惹到了[%%]，[%%]奋一切力量，使出了一招<font color=red>["&dz_ok&"]</font>，使得##体力下降:<font color=red>-"& xhtl &"</font>点."
else
    fanji="怪物区守护兽%%体力下降"&killer&"点四处逃窜"
end if
if cwjh_jhdj>rs("说明") then
       conn.execute "update 用户 set allvalue=allvalue+"& myjifenjia & " where 姓名='" & cwjh_name &"'"
         attack="##<bgsound src=wav/daipu.wav loop=1>用["& juese &"]技能("& fn1 &")修练["&jndj&"级]{"&jnci&"}攻击"&gif&"[%%],["&djinfo&"]{"&fanji&"}，%%哪是##的对手，但是，##除了得到积分（"& myjifenjia & "）点外没得到任何东西！"
else
       conn.execute "update 用户 set allvalue=allvalue+"& myjifenjia & " where 姓名='" & cwjh_name &"'"
         attack="##<bgsound src=wav/daipu.wav loop=1>用["& juese &"]技能("& fn1 &")修练["&jndj&"级]{"&jnci&"}攻击"&gif&"[%%],["&djinfo&"]{"&fanji&"}，%%哪是##的对手，被活活打死!~##得到积分（"& myjifenjia & "）点！"
end if
'==============最后============
set rs=nothing	
conn.close
set conn=nothing
case else
Response.Write "<script language=JavaScript>{alert('提示：找不到攻击对象！');}</script>"
Response.End
end select
end function
%>