var ckin=false,$=Math.abs,time1=null,round=Math.round,random=Math.random //全局,变量加速.
var bodywid=document.body.offsetWidth,bodyhei=document.body.offsetHeight
var fmwid=0,fmhei=0,fmleft=0,fmtop=0,mewid=0,mehei=0,mex=0,mey=0
var dtwenjian="",dtname="",sd_duihua=false,sd_onload=true,sd_sd=false
var anquanqu=false //安全区确认
var huanyuantime=5  //异常还原功能冷却时间
var zdbushu=0,zdbushu2=0 //记录行走步数,达到上限进入怪遭遇状态

var wj=[]  //超BT数组+JSON思路,武将存取,BT进行到底....思路发明:风云舞
for(var i=0;i<10;i++){
wj[i]={name:"",yuanming:"",xingbie:"",src:"",
lv:0,lv2:0,hp1:0,hp2:0,mp1:0,mp2:0,
nu1:0,nu2:0,act1:0,act2:0,
mct1:0,mct2:0,def:0,mef:0,jingque:0,
shanbi:0,sudu:0,
baoji:0,exp1:0,exp2:0,yili:0,haogan:0,chengdu:"普通"
}
}

 //队长属性配置
var wjshuxing="name,yuanming,xingbie,src,lv,lv2,hp1,hp2,mp1,mp2,nu1,nu2,act1,act2,mct1,mct2,def,mef,jingque,shanbi,sudu,baoji,exp1,exp2,yili,haogan,chengdu".split(",")
for(var i=0;i<wjshuxing.length;i++){
eval("wj[0]."+wjshuxing[i]+"=xml.getpz('人设','"+wjshuxing[i]+"')");
}
wj[0].haogan=100;wj[0].xingbie="男性";wj[0].chengdu="神葩级";
wj[0].src=wj[0].xingbie=="女性"?"img/touxiang/4.gif":"img/touxiang/3.gif";yuantouxiang.src=wj[0].src;

rpg={  //全队总属性
zhuanzhi:"0=命中之人",qianneng:[],zdbushu:120,cunkuan:200,ckshangxian:0,ghmeleft:0,
gametime:0,yd:xml.getpz("人设","yd"),yd2:xml.getpz("人设","yd2"),
mingwang:xml.getpz("人设","mingwang"),yuanling:xml.getpz("人设","yuanling"),
glod:xml.getpz("人设","glod"),hj:xml.getpz("人设","hj"),luck:xml.getpz("人设","luck"),
qingshang:xml.getpz("人设","qingshang"),wenxian:"",ciyuan:1,zuobi:0,

dian:[3],usedian:xml.getpz("人设","usedian"),
wp:[40],ck:[48],zb:[],
sjdt:[],zy:[],jn:[59],
kill:[],dropwp:[],  //击杀记录和物品掉出记忆
cg:[],rw:[],  //完成的任务记录
allkilllen:0,fuhuoshu:0,cykillnoboss:0,cykillboss:0  //追加的复活、杀怪总数、次元杀怪记录等
}
rpg.cg="aizhicheng1=0,aizhicheng2=0,aolinpisi1=0,anlingdongku1=0,anlingdongku2=0,anyanggonghui=0,anyangzuiqiang=0,baimuda1=0,baimuda2=0,beihaidao1=0,biwudahui1=0,biwudahui2=0,buhuicaoyuan1=0,chuyin1=0,chuyin2=0,chuyin3=0,ciyuanchuansong=0,diyuzhiwu=0,dongdukou1=0,faxisi1=0,faxisi2=0,gedoujie1=0,gedoujie2=0,gh1=0,gh2=0,gh3=0,gh4=0,gh5=0,gh6=0,gh7=0,guangyuzhou=0,hadisi=0,heiyuzhou=0,huangquan1=0,huangquan2=0,huangquan3=0,jingling1=0,jingling2=0,jinzita1=0,maoxiandao1=0,mingwangdian1=0,mingwangdian2=0,mingwangdian3=0,mingwangdian4=0,mota1=0,mota2=0,mota3=0,nuoya1=0,nuoya2=0,nuoya3=0,nuoya4=0,ouyangfeng=0,poxiaocun1=0,poxiaocun2=0,sahala=0,shenghua=0,shengyu1=0,shengyu2=0,shengyu3=0,shenmiheiying=0,shenshuo=0,shenshuojiejie1=0,shenshuojiejie2=0,shuaigejingsha=0,taozi=0,lilisi1=0,lilisi2=0,lilisi3=0,wocao1=0,xiakexing1=0,xiyou1=0,xiyou2=0,xiyou3=0,xiyou4=0,xiyou5=0,xuebao=0,yatelandisi1=0,yatelandisi2=0,yatelandisi3=0,yiciyuanzhimen=0,yinhe1=0,yinhe2=0,zhanguo1=0,zhanguo2=0,zzzj1=0,zzzj2=0".split(",");

rpg.dian[0]=xml.getpz("人设","loaddian");rpg.dian[1]=xml.getpz("人设","loaddian");
rpg.dian[2]=xml.getpz("人设","loaddian");rpg.dian[3]=xml.getpz("人设","loaddian");
rpg.ck[0]="wp=哈哈卡=30";rpg.ck[1]="wp=A型还魂草=1";rpg.ck[2]="wp=神魔源泉=1";rpg.ck[3]="wp=烟花弹=3";

var temp1=sjdtdom.getElementsByTagName("sjdt"),temp2=-1  //装在初始开启世界传送点
for(var i=0;i<temp1.length;i++){
if(temp1[i].getAttribute("load")=="默认开启")rpg.sjdt[++temp2]=temp1[i].getAttribute("name")
}
rpg.zb[3]="防护盔";rpg.zb[11]="绿色披风";rpg.zb[14]="飞马之翼";rpg.zb[20]="初生之剑";
rpg.zb[25]="铁护手";rpg.zb[27]="猎盾";

rpg.jn[0]="奋力一击=1";rpg.jn[1]="光弧球=1";rpg.jn[2]="治愈术=1";
rpg.jn[3]="定点清除=1";

rpg.wp[0]="wp=A型红药=5";rpg.wp[1]="wp=A型蓝药=3";rpg.wp[2]="wp=A型还魂草=2";rpg.wp[3]="wp=俘获绳=6";rpg.wp[6]="wp=哈哈卡=30";
rpg.wp[7]="wp=回程券=3";
rpg.wp[8]="zb=丝衣=1";rpg.wp[9]="zb=梦幻纹章1级=1";rpg.wp[10]="zb=银戒指=1";rpg.wp[20]="wp=奥义:雷光破=1";

rpg.wp[39]=null;

rpg.zy[0]="命中之人";
var selwj=wj[0]
function getcolor(){
var colors=Math.floor(random()*16777215).toString(16)
while(colors.length<6)colors=Math.floor(Math.random()*16777215).toString(16)
return colors
}
function huanyuan(){  //异常还原
if(!confirm("异常还原提示:\n\n1:单击确定=立即还原,单击取消=取消不执行\n2:确定后,将强制退出战斗,人物强制时空穿梭至就近城市\n3:每使用一次,将有20分钟的再次使用限制,即冷却时间\n4:此功能只推荐在游戏出错,人物卡住无法继续的情况下使用\n\n5:请你最后确认!"))return;
if(huanyuantime>0)return alert("使用权限冷却中:\n\n还有 "+huanyuantime+" 秒冷却时间,才能使用请等待")
zd.jieshu();xml.loaddt("chengshi",xml.guishu);return huanyuantime=1200
}
function addzt(mubiao,addztname,addztweili,miao){  //状态追加
if(addztname=="晕了"&&getzt(mubiao,"晕了","gw")!=null)return;  //已麻痹不可连晕
if(mubiao.szt=="无"){mubiao.szt=new Array(20);for(var i=0;i<mubiao.szt.length;i++)mubiao.szt[i]=""}
var num=0;if(mubiao==me){
for(var i=0;i<ztimg.length;i++){if(ztimg[i].ztname==addztname){num=i;break;}}
}else{
var ztlen=mubiao.szt.length;
for(var i=0;i<ztlen;i++){  //判断是否重复
if(mubiao.szt[i]!=""&&mubiao.szt[i].split("=")[0]==addztname){
mubiao.szt[i]="";break;}}
for(var i=0;i<ztlen;i++){if(mubiao.szt[i]==""){num=i;break;}}
}
if(miao==0){mubiao.szt[num]=""}else{mubiao.szt[num]=addztname+"="+addztweili+"="+miao}  //miao有可能是表示秒,或者回合
if(mubiao!=me)return;
if(ztimg[num].go!=null)clearInterval(ztimg[num].go);
ztimg[num].ztweili=addztweili;ztimg[num].miao=miao;ztimg[num].miao2=miao
ztimg[num].onmousemove=function(){showtmk("状态:"+ztimg[num].ztname+",威力:"+ztimg[num].ztweili+",持续:"+ztimg[num].miao+"-"+ztimg[num].miao2+"秒/回合")}
ztimg[num].style.display="";ztimg[num].go=setInterval(function(){ztimg[num].miao-=5;
if(num==8){selwj.hp1-=Math.ceil(selwj.hp2*parseInt(ztimg[num].ztweili)/100);if(selwj.hp1<=0)selwj.hp1=1;gx_rpg()}
if(num==9){selwj.mp1-=Math.ceil(selwj.mp2*parseInt(ztimg[num].ztweili)/100);if(selwj.mp1<=0)selwj.mp1=0;gx_rpg()}
if(ztimg[num].miao<=0){clearInterval(ztimg[num].go);ztimg[num].go=null;ztimg[num].style.display="none";mubiao.szt[num]="";}},5000)
}
function getzt(mubiao,ztname,returnall){  //获取状态
if(mubiao.szt=="无")return null
for(var i=0;i<mubiao.szt.length;i++){
if(mubiao.szt[i]!=""&&mubiao.szt[i].split("=")[0]==ztname)break;
}
if(i==mubiao.szt.length)return null
if(returnall!=null)return mubiao.szt[i]+"="+i  //怪状态返回
return parseInt(mubiao.szt[i].split("=")[1]);  //玩家
}
function gdtext(gdx,gdy,gdtext,gdsize){  //滚动信息
var newdiv=document.createElement("DIV")
newdiv.style.zIndex=35000;newdiv.style.fontWeight="bold";newdiv.style.whiteSpace="nowrap"
newdiv.style.fontSize=gdsize==null?"15px":gdsize+"px";newdiv.style.color="black";newdiv.innerHTML=gdtext;
newdiv.style.left=gdsize==null?gdx-bodywid:(bodywid/2)-(gdsize*gdtext.length/2)-bodywid;
newdiv.style.top=gdsize==null?gdy:bodyhei/2-(gdsize/2);
var newdiv2=document.createElement("DIV");
newdiv2.style.zIndex=35000;newdiv2.style.fontWeight="bold";newdiv2.style.whiteSpace="nowrap"
newdiv2.style.fontSize=gdsize==null?"15px":gdsize+"px";newdiv2.style.color=getcolor();newdiv2.innerHTML=gdtext;
newdiv2.style.left=gdsize==null?gdx+bodywid:(bodywid/2)-(gdsize*gdtext.length/2)+bodywid;
newdiv2.style.top=gdsize==null?gdy+2:bodyhei/2-(gdsize/2)+2;
var zongchang=$(parseInt(newdiv.style.left))+parseInt(newdiv2.style.left);newdiv.bushu=6
newdiv.go=setInterval(function(){
if(newdiv.bushu--<1){
clearInterval(newdiv.go);newdiv.bushu=gdsize==null?40:80;
while(newdiv.suijix==null||newdiv.suijix==0){newdiv.suijix=round(3-(random()*6))};
while(newdiv.suijiy==null||newdiv.suijiy==0){newdiv.suijiy=round(3-(random()*6))};
newdiv.style.left=gdsize==null?gdx:newdiv.offsetLeft;newdiv2.style.left=newdiv.offsetLeft+1
newdiv.go=setInterval(function(){
if(newdiv.bushu--<1){
clearInterval(newdiv.go);document.body.removeChild(newdiv);document.body.removeChild(newdiv2);
}else{var templ=newdiv.offsetLeft,tempt=newdiv.offsetTop
if(gdsize!=null){newdiv2.style.color=getcolor();var tempsize1=gdsize+round(gdsize/4-(gdsize/2*random()));
newdiv.style.fontSize=tempsize1;newdiv2.style.fontSize=gdsize+round(gdsize/4-(gdsize/2*random()));}
newdiv.style.left=templ-newdiv.suijix;newdiv.style.top=tempt-newdiv.suijiy
if(templ<0){newdiv.style.left=0}else if(templ+newdiv.offsetWidth>bodywid){newdiv.style.left=bodywid-newdiv.offsetWidth}
if(tempt<0){newdiv.style.top=0}else if(tempt+newdiv.offsetHeight>bodyhei){newdiv.style.top=bodyhei-newdiv.offsetHeight}
newdiv2.style.left=newdiv.offsetLeft+1;newdiv2.style.top=newdiv.offsetTop+2
}
},30);
}else{
newdiv.style.left=newdiv.offsetLeft+(zongchang/12);newdiv2.style.left=newdiv2.offsetLeft-(zongchang/12);
}
},30)
document.body.appendChild(newdiv);document.body.appendChild(newdiv2);
if(gdx+newdiv.offsetWidth>bodywid){newdiv.style.left=bodywid-newdiv.offsetWidth;newdiv2.style.left=newdiv.offsetLeft+1}
}
function getchengdu(obj,shuxing){
var chengdu="",col1="",col2=""
if(obj.getAttribute(shuxing)!=null){chengdu="("+obj.getAttribute(shuxing)+")"}else{return null}
if(chengdu=="(神葩级)"){col1="blue";col2="#5F60FF"}
if(chengdu=="(神说级)"){col1="red";col2="#EC1C10"}
if(chengdu=="(神魔级)"){col1="orange";col2="#ED6A44"}
if(chengdu=="(传说级)"){col1="lime";col2="#20D714"}
if(chengdu=="(帝王级)"){col1="yellow";col2="#D2D619"}
if(chengdu=="(经典级)"){col1="#FD7AF2";col2="#E8CFF5"}
return chengdu+","+col1+","+col2
}
function showtmk(neirong1,tit1,color1,color2){  //透明框控制
if(event.button!=0)return tmk1.style.visibility="hidden"
tmk1.style.left=event.x+10;tmk1.style.top=event.y+10;
if(tmk1.offsetLeft+tmk1.offsetWidth>bodywid)tmk1.style.left=event.x-tmk1.offsetWidth-10
if(tmk1.offsetTop+tmk1.offsetHeight>bodyhei)tmk1.style.top=bodyhei-tmk1.offsetHeight
if(tmk1.style.visibility=="hidden"){tmk1.style.visibility="visible";}
if(tmk1.oldneirong==neirong1)return;tmk1.oldneirong=neirong1;neirong1=neirong1.replace(/\\n/g,"<br>");

var chengdu="",col1="white",col2="white";
if(neirong1.indexOf("wupin or zhuangbei%#&@!-$^=")==0){
var rpgwp=neirong1.split("="),getwp1=xml.getwp(rpgwp[1],rpgwp[2])
var thechengdu=getchengdu(getwp1,"程度");if(thechengdu!=null){chengdu=thechengdu.split(",")[0];col1=thechengdu.split(",")[1];col2=thechengdu.split(",")[2]}
if(rpgwp[1]=="wp"){  //是物品
var temphj="";if(getwp1.getAttribute("hj")!=null)temphj="<font style='color:yellow'>金价 "+getwp1.getAttribute("hj")+"两</font><br>"
var tempbaohu="";if(getwp1.getAttribute("保护")!=null)tempbaohu="<font style='color:yellow'>保护 "+getwp1.getAttribute("保护")+"</font><br>"
var thehelp=getwp1.getAttribute("help");if(thehelp==null)thehelp="";
if(rpgwp[2].indexOf("诗歌:")==0)thehelp="<font style='color:orange;'>原著:"+getwp1.getAttribute("v1")+"</font><br>经典的诗歌一首,阅读后将永久记载于文献记载中!"
if(rpgwp[2].indexOf("资料:")==0||rpgwp[2].indexOf("石板:")==0||rpgwp[2].indexOf("神说:")==0)thehelp="<font style='color:green;'>原著:"+getwp1.getAttribute("v1")+"</font><br>游戏中罕见的资料,阅读后将永久记载于文献记载中!"
if(rpgwp[2].indexOf("对决门:")==0)thehelp="使用级别:"+getwp1.getAttribute("v2")+"<br>时空错列超级战书,召唤连死人都必须穿梭时空应战的魔力"
if(rpgwp[2].indexOf("远古宝藏")==0)thehelp="这是10大宝藏之一,海贼王?皇室珍宝?外星遗产?不得而知!"

tmk1.innerHTML="<font style='color:"+col1+";font-weight:bold;'>"+rpgwp[2]+chengdu+" - 物品</font><br>&nbsp;<br><font style='color:"+col2+"'>"+temphj+"价值 "+wpzb.getjiage(getwp1)+"<br>"+tempbaohu+thehelp.replace(/\\n/g,"<br>")+"</font>";
}
if(rpgwp[1]=="zb"){  //是装备
var temptit=[],j=3;src1="zb";
var thechengdu=getchengdu(getwp1,"程度");if(thechengdu!=null){chengdu=thechengdu.split(",")[0];col1=thechengdu.split(",")[1];col2=thechengdu.split(",")[2]}
for(var j=j;j<getwp1.attributes.length;j++){
var tname=getwp1.attributes[j].name,tvalue=getwp1.attributes[j].value
if(tname=="程度"||tname=="mark"||tname=="hj"||tname=="max"||tname=="fenjie")continue;
var qnfenge=[];if(tname=="潜能"){qnfenge=getwp1.getAttribute("潜能").split(",");
for(var ii=0;ii<qnfenge.length;ii++){qnfenge[ii]=qnfenge[ii].split("=")[0]+"="+wpzb.jinglianjia(qnfenge[ii].split("=")[1],wpzb.getjinglian(rpgwp[2]))
if((ii+1)%3==0&&ii+1<qnfenge.length)qnfenge[ii]+="<br>潜能"}
temptit[j]="潜能 "+qnfenge.join(",")+"<br>";continue;
}
if(tname=="级别"){
var temphj="";if(getwp1.getAttribute("hj")!=null)temphj="<font style='color:yellow'>金价 "+getwp1.getAttribute("hj")+"两</font><br>"
if(getwp1.getAttribute("价值")==null)temphj+="价值 "+wpzb.getjiage(getwp1)+"<br>";
temptit[j]="&nbsp;<br>"+temphj+"级别要求 "+tvalue+"<br>";continue;
}
if(tname=="传奇"||tname=="保护"){temptit[j]="&nbsp;<br><font style=color:red>"+tname+" "+tvalue.replace(/\\n/g,"<br>")+"</font><br>";continue;}
if(tname.indexOf("心要求")==1){temptit[j]=tname+" "+tvalue+"<br>"}else{
temptit[j]=tname+" "+wpzb.jinglianjia(tvalue,wpzb.getjinglian(rpgwp[2]))+"<br>"}
}  //end for j;
tmk1.innerHTML="<font style='color:"+col1+";font-weight:bold;'>"+rpgwp[2].replace(/\$\$\$(\d+)/g,"<font style='color:red;font-weight:bold'>+$1</font>")+chengdu+" - "+getwp1.getAttribute("lei")+"</font> <br>&nbsp;<br><font style='color:"+col2+";'>"+temptit.join("")+"</font>"
}
}else if(neirong1.indexOf("guaiwu or boos%#&@!-$^=")==0){  //怪物
var xmlgw=xml.getgw(neirong1.split("=")[1]),evobj=event.srcElement,booshelp=""
var thechengdu=getchengdu(xmlgw,"boos");
if(thechengdu!=null){chengdu=thechengdu.split(",")[0];col1=thechengdu.split(",")[1];col2=thechengdu.split(",")[2]
booshelp="<br>&nbsp;<br>Boos头目 "+evobj.sboos
}
var tempjn=xmlgw.getAttribute("jn"),tempwp=xmlgw.getAttribute("wp")
if(tempjn==null)tempjn="无";else {tempjn=tempjn.split(",").length+"种"}
if(tempwp==null)tempwp="无";else {tempwp=tempwp.split(",").length+"种"}
var zttext="<br>&nbsp;";if(evobj.szt=="无")zttext+="<br>状态 无";else{
for(var i=0;i<evobj.szt.length;i++){
if(evobj.szt[i]=="")continue;var temparr=evobj.szt[i].split("=")
zttext+="<br>状态 "+temparr[0]+"(威力="+temparr[1]+",持续="+temparr[2]+"回合)"
}
if(zttext=="<br>&nbsp;")zttext="<br>&nbsp;<br>状态 无"
}
var moguangyin=false;if(getzt(evobj,"魔光隐",true)!=null)moguangyin=true;
var jiaqiangtext="";if(evobj.sjiaqiang!=null){
if(parseInt(evobj.sjiaqiang)==1)jiaqiangtext=" +1强悍的"
if(parseInt(evobj.sjiaqiang)==2)jiaqiangtext=" +2愤怒的"
if(parseInt(evobj.sjiaqiang)==3)jiaqiangtext=" +3发疯的"
if(parseInt(evobj.sjiaqiang)==4)jiaqiangtext=" +4变态的"
jiaqiangtext="<font style='color:red'>"+jiaqiangtext+"</font>"
}
var newdiaoluo=evobj.newdiaoluo==null?"":" <font style='color:blue;font-weight:bold;'>极限暴走</font>";
var thegwhtm="<font style='color:"+col1+";font-weight:bold;font-family:黑体'>"+xmlgw.tagName+"("+evobj.slv+"级)</font>"+newdiaoluo+jiaqiangtext+"<br>&nbsp;<br><font style='color:"+col2+";font-size:11px;font-family:黑体'>生命 "+evobj.shp1+"/"+evobj.shp2+"="+round(evobj.shp1/(evobj.shp2/100))+"%<br>魔法 "+evobj.smp1+"/"+evobj.smp2+"<br>攻击 "+evobj.sact1+"-"+evobj.sact2+"<br>魔力 "+evobj.smct1+"-"+evobj.smct2+"<br>防御 "+evobj.sdef+" 魔防 "+evobj.smef+"<br>&nbsp;<br>速度 "+evobj.ssu+" 暴击 "+evobj.sbj+"%<br>精确 "+evobj.sjq+"% 闪避 "+evobj.ssb+"% 毅力 "+evobj.syili+"%<br>&nbsp;<br>经验 "+evobj.sexp+" 价值 "+evobj.scold+"<br>魔法 "+tempjn+" 持物 "+tempwp+booshelp
if(moguangyin==true)thegwhtm=thegwhtm.replace(/( |\/|\-|\=)\d+/g,"$1??")
tmk1.innerHTML=thegwhtm+zttext+"</font>";
}else if(neirong1.indexOf("jnobj1 or jnobj2%#&@!-$^=")==0){  //技能细节
var jnobj1=xml.getjn(neirong1.split("=")[1].replace("真·",""))
if(neirong1.split("=")[1]=="真·地狱之舞")jnobj1=xml.getjn(neirong1.split("=")[1])
var temp1=parseInt(neirong1.split("=")[2]);jnobj2=jnobj1.childNodes[temp1]
var tmjq=jnobj2.getAttribute('jq')==null?"":parseInt(jnobj2.getAttribute('jq'));
if(tmjq!=""){tmjq=neirong1.split("=")[1].indexOf("真·")==0?"<font style='color:orange;'>"+round(tmjq*1.5)+"</font>":tmjq;}
if(jnobj2.getAttribute("jq")!=null)tmjq=" 精确附加="+tmjq+"%";  //防止0判断为""
var tmmiao=jnobj2.getAttribute('miao')==null?"":" 持续="+jnobj2.getAttribute('miao')+"(秒/回合)";
var tmnu=jnobj2.getAttribute('nu')==null?"":" 需求怒火="+jnobj2.getAttribute('nu');
var feimgsrc="";switch(jnobj2.getAttribute('fe')){
case "单体":feimgsrc="fanwei1.gif";break;case "小十字":feimgsrc="fanwei2.gif";break;case "放射":feimgsrc="fanwei3.gif";break;
case "竖向":feimgsrc="fanwei4.gif";break;case "横向":feimgsrc="fanwei5.gif";break;case "九宫阵":feimgsrc="fanwei6.gif";break;
case "中十字":feimgsrc="fanwei7.gif";break;case "大十字":feimgsrc="fanwei8.gif";break;case "辐射":feimgsrc="fanwei9.gif";break;
case "横队":feimgsrc="fanwei10.gif";break;case "竖队":feimgsrc="fanwei11.gif";break;case "全体":feimgsrc="fanwei12.gif";break;
default:feimgsrc="fanwei15.gif";
}
var tmchangjing="释放范围="+jnobj2.getAttribute('fe')+"<img src='img/ico/"+feimgsrc+"' style='position:static;'>";
if(jnobj1.getAttribute("changjing")!=null)tmchangjing+=" <font color='yellow'>此技支持战场和冒险中,随时使用</font>";

var temstr="";if(jnobj1.getAttribute("yici")!=null)temstr="<font style='color:red'>(必杀技)</font>"
var mpxiaofei=neirong1.split("=")[1].indexOf("真·")==0?"<font style='color:orange;'>"+(parseInt(jnobj2.getAttribute('mp'))*2)+"</font>":jnobj2.getAttribute('mp');
var theweili=neirong1.split("=")[1].indexOf("真·")==0?"<font style='color:orange;'>"+(parseInt(jnobj2.getAttribute('wl'))*2):parseInt(jnobj2.getAttribute('wl'));
jnobj2.getAttribute('wl').indexOf("%")!=-1?theweili+="%</font>":theweili+="</font>";
showtmk('MP消费='+mpxiaofei+' 针对阵营='+jnobj1.getAttribute('use')+' 发动中心='+jnobj1.getAttribute('sd')+'<br>威力='+theweili+tmmiao+tmjq+tmnu+'<br>'+tmchangjing+'<br>注:'+jnobj1.getAttribute('help').replace(/\\n/g,"<br>"),jnobj1.childNodes.length+'-'+(temp1+1)+'重 '+neirong1.split("=")[1]+temstr,jn.getcol(jnobj1.getAttribute("lei")),"#eeeeee");
}else{  //其他常规数据
if(tit1==null){tmk1.innerHTML=neirong1;}else{
var color11=color1==null?"white":color1;
var color22=color2==null?"white":color2;
tmk1.innerHTML="<font style='color:"+color11+";font-weight:bold;'>"+tit1+"</font><br>&nbsp;<br><font style='color:"+color22+";'>"+neirong1+"</font>"
}}
event.srcElement.onmouseout=function(){tmk1.style.visibility='hidden'}
}
function shengji(whowj){  //升级
if(whowj.lv>=whowj.lv2){if(whowj.exp1>whowj.exp2)whowj.exp1=whowj.exp2;return;}
yinxiao("升级");zddh.aixin();
sj1[0].innerText=whowj.lv;sj1[1].innerText=whowj.exp2;sj1[2].innerText=whowj.hp2;  //以往
sj1[3].innerText=whowj.mp2;sj1[4].innerText=whowj.nu2;sj1[5].innerText=whowj.sudu;

var oldexp2=whowj.exp2
whowj.lv++;
var exp2up=whowj.lv*whowj.lv*10-oldexp2,hp2up=9,mpup=2,nuup=1
var suduup=parseInt(xml.getpz("怪设","速度")),mingwangup=10,yuanlingup=whowj.lv2*5,dianup=3
var actup=parseInt(xml.getpz("怪设","攻击"))+1,mctup=parseInt(xml.getpz("怪设","魔攻"))+1,jingqueup=1

whowj.nu2+=nuup;  //更新
whowj.exp1-=whowj.exp2;whowj.exp2=whowj.lv*whowj.lv*10;

if(whowj==wj[0]){
lvupdiv.style.backgroundImage="url('img/background/gw.gif')";sj4[0].innerText="名望";sj4[1].innerText="元灵";sj4[2].innerText="可用点";
lvuptab[0].innerText="主角 "+whowj.name+" 变强了！"
sj1[6].innerText=rpg.mingwang;sj1[7].innerText=rpg.yuanling;sj1[8].innerText=rpg.usedian;
rpg.mingwang+=mingwangup;rpg.yuanling+=yuanlingup;rpg.usedian+=dianup
sj2[6].innerText=mingwangup;sj2[7].innerText=yuanlingup;sj2[8].innerText=dianup;
sj3[6].innerText=rpg.mingwang;sj3[7].innerText=rpg.yuanling;sj3[8].innerText=rpg.usedian;
whowj.sudu+=1;sj2[5].innerText=1;
}else{
lvupdiv.style.backgroundImage="url('img/background/ganqing.jpg')";sj4[0].innerText="攻击";sj4[1].innerText="魔力";sj4[2].innerText="精确";
lvuptab[0].innerText="武将 "+whowj.name+" 变强了！"
hp2up=12;mpup=5;
whowj.sudu+=suduup;sj2[5].innerText=suduup;
sj1[6].innerText=whowj.act1+"-"+whowj.act2;sj1[7].innerText=whowj.mct1+"-"+whowj.mct2;sj1[8].innerText=whowj.jingque+"%"
whowj.act1+=Math.floor(actup/1.5);whowj.act2+=actup;whowj.mct1+=Math.floor(mctup/1.5);whowj.mct2+=mctup;whowj.jingque+=jingqueup
sj2[6].innerText=actup;sj2[7].innerText=mctup;sj2[8].innerText=jingqueup;
sj3[6].innerText=whowj.act1+"-"+whowj.act2;sj3[7].innerText=whowj.mct1+"-"+whowj.mct2;sj3[8].innerText=whowj.jingque+"%";
}
whowj.hp2+=hp2up;whowj.hp1=whowj.hp2;whowj.mp2+=mpup;whowj.mp1=whowj.mp2;

if(whowj.exp1>=whowj.exp2)return shengji(whowj)

sj2[0].innerText=1;sj2[1].innerText=exp2up;;sj2[2].innerText=hp2up;sj2[3].innerText=mpup  //增长
sj2[4].innerText=nuup;

sj3[0].innerText=whowj.lv;sj3[1].innerText=whowj.exp2;sj3[2].innerText=whowj.hp2;sj3[3].innerText=whowj.mp2  //目前
sj3[4].innerText=whowj.nu2;sj3[5].innerText=whowj.sudu;

lvuptab[0].style.display="none";lvuptab[1].style.display="none";
lvupdiv.style.left=bodywid/2-3;lvupdiv.style.top=bodyhei/2-53;lvupdiv.style.width=6;lvupdiv.style.height=6
lvupdiv.style.display="";gx_rpg();tbzt.zhuangtai();saveuser()
if(lvupdiv.go!=null){clearInterval(lvupdiv.go);lvupdiv.go=null}
lvupdiv.go=setInterval(function(){if(lvupdiv.offsetWidth<220){lvupdiv.style.left=lvupdiv.offsetLeft-3;lvupdiv.style.width=lvupdiv.offsetWidth+6;lvupdiv.style.top=lvupdiv.offsetTop-3;lvupdiv.style.height=lvupdiv.offsetHeight+6;}else{clearInterval(lvupdiv.go);lvupdiv.go=null;lvuptab[0].style.display="";lvuptab[1].style.display="";}},15)
}
function shengjiend(){  //关闭升级框
if(lvupdiv.go!=null)return;yinxiao("降落")
lvupdiv.go=setInterval(function(){if(lvupdiv.offsetWidth>6){lvuptab[0].style.display="none";lvuptab[1].style.display="none";lvupdiv.style.left=lvupdiv.offsetLeft+3;lvupdiv.style.width=lvupdiv.offsetWidth-6;lvupdiv.style.top=lvupdiv.offsetTop+3;lvupdiv.style.height=lvupdiv.offsetHeight-6;}else{clearInterval(lvupdiv.go);lvupdiv.go=null;lvupdiv.style.display="none";}},15)
}
function gx_rpg(){  //全员或某成员能力值更新
for(var i=0;i<wj.length;i++){
if(wj[i].name=="")continue;
if(wj[i].exp1>=wj[i].exp2)shengji(wj[i]);
if(wj[i].hp1>wj[i].hp2)wj[i].hp1=wj[i].hp2
if(wj[i].mp1>wj[i].mp2)wj[i].mp1=wj[i].mp2
if(wj[i].nu1>wj[i].nu2)wj[i].nu1=wj[i].nu2
if(wj[i].mp1<0)wj[i].mp1=0
if(wj[i].exp1<0)wj[i].exp1=0
if(wj[i].nu1<0)wj[i].nu1=0;
if(wj[i].glod<0)wj[i].glod=0;

if(wj[i].hp1<=0){wj[i].hp1=0;var tempzdme=zd.findzdme(wj[i].name);
if(zd.zdzhong&&tempzdme!=null&&tempzdme.siwang!=true){
tempzdme.style.filter="gray";tempzdme.siwang=true;tempzdme.xingdong=true
var temp1=siwang.diaoluo();temp1!=false?zd.beibaowu[zd.beibaowu.length]=temp1:"";
temp1=siwang.diaoluo();temp1!=false?zd.beibaowu[zd.beibaowu.length]=temp1:"";
temp1=siwang.diaoluo();temp1!=false?zd.beibaowu[zd.beibaowu.length]=temp1:"";
if(zd.beibaowu.length==0){beibao.innerText="无"}else{beibao.innerHTML=zd.beibaowu.join("<br>")}
zddh.huangdong(window);
}}

}  //end for
sz[0].innerText=selwj.lv+"/"+selwj.lv2;sz[1].innerText=selwj.name;yuantouxiang.src=selwj.src;
sz[2].style.width=selwj.hp1/(selwj.hp2/100)+"%";sz[3].innerText=selwj.hp1+"/"+selwj.hp2;
sz[4].style.width=selwj.mp1/(selwj.mp2/100)+"%";sz[5].innerText=selwj.mp1+"/"+selwj.mp2;
sz[6].style.width=selwj.nu1/(selwj.nu2/100)+"%";sz[7].innerText=selwj.nu1+"/"+selwj.nu2+"+"+nujiacheng()+"%";
sz[8].innerText=rpg.glod;wp_jinbi[0].innerText=rpg.glod+"元";wp_jinbi[1].innerText=rpg.hj.toFixed(1)+"两";
sz[9].style.width=selwj.exp1/(selwj.exp2/100)+"%";sz[10].innerText=new String(selwj.exp1/(selwj.exp2/100)).substr(0,5)+"%"
if(rpg.qingshang>50)rpg.qingshang=50;
}
function yinxiao(text1){
if(!musicloop.checked){switch(text1){
case "安全区":return bgsound1.src="bgsound/qita_anquanqu"+Math.ceil(5*random())+".mp3";break;
case "场景音乐":return bgsound1.src="bgsound/"+xml.yinyue;break;
case "boos战":zd.smyinyue=true;return bgsound1.src="bgsound/qita_boos"+Math.ceil(3*random())+".mp3";break;
case "神魔boos战":zd.smyinyue=true;return bgsound1.src="bgsound/qita_superboos"+Math.ceil(2*random())+".mp3";break;
case "神说boos战":zd.smyinyue=true;return bgsound1.src="bgsound/shenshuo.mp3";break;
case "单挑战":zd.smyinyue=true;return bgsound1.src="bgsound/qita_dantiao.mp3";break;
case "总决战":zd.smyinyue=true;return bgsound1.src="bgsound/qita_zongjuezhan.mp3";break;
case "神葩战":zd.smyinyue=true;return bgsound1.src="bgsound/qita_shenpazhan.mp3";break;
case "资料配乐":return bgsound1.src="bgsound/qita_ziliaopeiyue.mp3";break;
case "神说配乐":return bgsound1.src="bgsound/qita_shenshuopeiyue.mp3";break;
case "制作群":return bgsound1.src="bgsound/qita_zhizuoqun"+Math.ceil(2*random())+".mp3";break;
case "决战1":return bgsound1.src="bgsound/qita_juezhan1.mp3";break;
case "决战2":return bgsound1.src="bgsound/qita_juezhan2.mp3";break;
}}var bgmsg="",bgzd="";
if(text1=="冲杀1"){bgsound2.loop=1;return bgsound2.src="sound/chongsha1.wav";}
if(text1=="冲杀2"){bgsound2.loop=2;return bgsound2.src="sound/chongsha2.wav";}
if(text1=="神之祝福"){bgsound2.loop=1;return bgsound2.src="sound/stszzf.wav";}
if(text1=="公会"){bgsound1.volume=-10000;if(bgsound3.src.indexOf("qita_gonghui.mp3")==-1)bgsound3.src="bgsound/qita_gonghui.mp3";return bgsound3.volume=sz_yinliang1.value;}
switch(text1){
case "起飞":bgmsg="shikong";break;case "降落":bgmsg="ciyuan";break;case "水声":bgmsg="shui1";break;case "谈话":bgmsg="msg";break;
case "升级":bgmsg="lvup";break;case "使用":bgmsg="use";break;case "吃":bgmsg="chi";break;case "陷阱":bgmsg="xianjing1";break;
case "物品移动":bgmsg="wp_move";break;case "装备切换":bgmsg="zb_huan";break;case "声优_十字斩":bgmsg="zz_szz";break;
case "风1":bgmsg="feng1";break;case "声优_挂了":bgmsg="zz_gl";break;
case "男惨叫":bgmsg="gwsheng_nan2_"+Math.ceil(random()*2);break;case "女惨叫":bgmsg="gwsheng_nv2_"+Math.ceil(random()*2);break;
case "怪惨叫":bgmsg="gwsheng_guai2_"+Math.ceil(random()*2);;break;case "机惨叫":bgmsg="gwsheng_jiqi2_"+Math.ceil(random()*2);break;
case "神惨叫":bgmsg="gwsheng_shen2_"+Math.ceil(random()*2);break;
case "翻页":bgmsg="fanye";break;case "重生":bgmsg="chongsheng";break;
case "挖掘":bgmsg="wajue";break;case "锤音":bgmsg="markend";break;case "女惊叫":bgmsg="nvjingjiao1";break;
case "掉落":bgmsg="diaoluo";break;case "龙吼":bgmsg="longhou";break;case "俺样最强":bgmsg="anyangzuiqiang1";break;
case "俺样最强2":bgmsg="anyangzuiqiang2";break;case "俺样最强3":bgmsg="anyangzuiqiang3";break;

case "男攻声":bgzd="gwsheng_nan"+Math.ceil(random()*3);break;case "女攻声":bgzd="gwsheng_nv"+Math.ceil(random()*3);break;
case "机攻声":bgzd="gwsheng_jiqi"+Math.ceil(random()*3);break;case "怪攻声":bgzd="gwsheng_guai"+Math.ceil(random()*3);break;
case "神攻声":bgzd="gwsheng_shen"+Math.ceil(random()*3);break;
case "烟花":bgzd="yanhua";break;case "夜晚":bgzd="yewan";break;case "吟唱1":bgzd="yinchang1";break;case "机枪":bgzd="jiqiang";break;
case "恢复1":bgzd="huifu1";break;case "恢复2":bgzd="huifu2";break;case "邪恶1":bgzd="xiee1";break;case "恐怖低吼":bgzd="gwjn_dihou";break;
case "怪物封印":bgzd="gwjn_fengyin";break;case "各种状态":bgzd="jn_zhuangtai";break;
case "走路":bgzd="run";break;case "地震":bgzd="dizhen1";break;case "中毒1":bgzd="zhongdu1";break;case "中毒2":bgzd="zhongdu2";break;
case "魔女低吼":bgzd="monv_dihou";break;case "箭阵":bgzd="jianzhen";break;case "打雷":bgzd="dalei";break;
case "开始俘获":bgzd="fuhuo1";break;case "俘获成功":bgzd="fuhuo2";break;case "俘获失败":bgzd="fuhuo3";break;
case "惊恐麻木":bgzd="jingkongmamu";break;case "沙加":bgzd="shajia";break;case "神罚":bgzd="shenfa";break;case "流星拳":bgzd="liuxingquan";break;
case "女笑声1":bgzd="nvxiaosheng1";break;case "女笑声2":bgzd="nvxiaosheng2";break;case "男笑声1":bgzd="nanxiaosheng1";break;
}
if(text1.indexOf("发射")==0)bgzd="fashe"+text1.substr(2)
if(text1.indexOf("击中")==0)bgzd="jizhong"+text1.substr(2)
if(text1.indexOf("绝技")==0)bgzd="jueji"+text1.substr(2)
bgmsg!=""?wav_msg.src="sound/"+bgmsg+".wav":wav_zd.src="sound/"+bgzd+".wav";
}