var siwang={  //投降与死亡的各种选项处理
tanchu:function(){
siwang_kuang.style.left=bodywid/2-(siwang_kuang.offsetWidth/2);
siwang_kuang.style.top=bodyhei/2-(siwang_kuang.offsetHeight/2);
siwang_kuang.style.visibility=siwang_kuang.style.visibility=='hidden'?'visible':'hidden';
},
huicheng:function(){
wj[0].hp1=round(wj[0].hp2/15);wj[0].exp1-=Math.ceil(wj[0].exp2*0.05);rpg.glod-=round(rpg.glod*0.05)
zd.jieshu();xml.loaddt("chengshi",xml.guishu)
gdtext(zd.cdx,zd.cdy,"靠~!又挂了!不惧失败,俺样最强！");yinxiao("声优_挂了");
siwang_kuang.style.visibility="hidden";selwj=wj[0];gx_rpg()
},
yaoji:function(mubiao,v1,v2){  //药剂或技能复活
mubiao.hp1+=Math.ceil(mubiao.hp2*v1);mubiao.exp1-=Math.ceil(mubiao.exp2*v2);
for(var i=0;i<zdme.length;i++){if(zdme[i].sname==mubiao.name)break;}
zdme[i].style.filter=null;zdme[i].siwang=false;
},
chengfa:function(){  //技术惩罚
var tempcf0=wj[0].lv>150?50:round(wj[0].lv/3),tempcf2=round(rpg.glod*0.05),tempcf3=round(rpg.yuanling*0.05);
for(var i=0;i<wj.length;i++){if(wj[i].name=="")continue;
if(wj[i].hp1<1)wj[i].hp1=1;wj[i].exp1-=Math.ceil(wj[i].exp2*0.1);}
rpg.glod-=tempcf2;rpg.yuanling-=tempcf3;rpg.mingwang-=tempcf0;
zd.jieshu();gdtext(bodywid/2,bodyhei/2,"55555,我刚刚被欺负了~-~");
siwang_kuang.style.visibility="hidden";gx_rpg();
alert("被技术惩罚你损失了:名望-"+tempcf0+" 金币-"+tempcf2+" 元灵-"+tempcf3+" 全员经验-10%");
},
diaoluo:function(){  //判断掉落
if(random()>0.15)return false;var diaowu="",ceshii=0;  // 被爆物
for(var i=0;i<rpg.wp.length;i++){if(rpg.wp[i]==null)continue;var getwp1=xml.getwp(rpg.wp[i].split("=")[0],rpg.wp[i].split("=")[1])
if(getwp1.getAttribute("保护")!=null&&getwp1.getAttribute("保护").indexOf("不会被爆")!=-1)continue;
ceshii=1;break;
}if(ceshii=0)return false;  //无物可爆
while(diaowu==""){for(var i=0;i<rpg.wp.length;i++){if(rpg.wp[i]==null)continue;var thewp=rpg.wp[i].split("=");
var getwp1=xml.getwp(thewp[0],thewp[1])
if(getwp1.getAttribute("保护")!=null&&getwp1.getAttribute("保护").indexOf("不会被爆")!=-1)continue;
if(random()>0.1)continue;var theshu=parseInt(thewp[2]);var diaoshu=Math.ceil(random()*2.5);if(diaoshu>theshu)diaoshu=theshu
diaowu=thewp[1]+" × "+diaoshu;
wpzb.rengbao(mex,mey,thewp[0],thewp[1],diaoshu);wp_add(thewp[0],thewp[1],-diaoshu);i=rpg.wp.length;
}}return diaowu;
}
}
var zd={
zdzhong:false,  //公用,寻访是否战斗中
cdx:0,cdy:0,  //为战斗菜单隐藏显示定位
wofang:[],difang:[],  //成员位置记录
suoding:false,movezt:0,  //地方行动锁定操作,及记录目前进行何种操作
tds:[],  //存储受到攻击或祝福的成员.
huihe:1,  //回合总数
youbiao:0,  //游标
newobj:null,  //当前执行命令的战士
ydmubiaotd:null,zdyidong:0,  //记录想要移动的单元,单元位置
jnobj1:null,jnobj2:null,  //记录技能的对象
usewp1:null,usewp2:null,  //记录物品的对象
jnwpfanwei:"",  //记录技能或物品的,搜寻范围类型
zhongxin:null,  //纪录中心释放技能的目标,取其X及Y,用于动画开发
zdtancebu:0,  //战斗探测步数上限10
booszhan:false,  //区分此战是否为BOOS战重置音乐
toushi:false,  //表明是否始终透视战场
smyinyue:false,  //判断是否神魔外场景级遭遇战战斗音效,结束好清除
beibaowu:[],  //记录我方死亡被爆物品
xingdongcishu1:0,xingdongcishu2:0,  //记录战斗进行了第几个指令
yicijn:"",  //记录每次战斗使用1次或2次的技能
jishi:"",  //记录战斗进行了多少分钟

findzdme:function(wjname){  //外围程序查找比对战斗中的武将
for(var i=0;i<zdme.length;i++){if(zdme[i].sname==wjname)return zdme[i]}
return null
},
playtiao:function(){  //分隔条动画
if(zdtiao.go!=null)zddh.cle(zdtiao.go);
zdtiao.tempx=0;zdtiao.tempy=0;zdtiao.youbiao==true?zdtiao.youbiao=false:zdtiao.youbiao=true;zdtiao.dex=20
zdtiao.go=setInterval(function(){
if(--zdtiao.dex>0){if(zdtiao.youbiao==false){zdtiao.tempx-=40}else{zdtiao.tempy-=12}}else{zddh.cle(zdtiao.go);
if(zd.huihe%50==0){gdtext(0,0,"第 "+zd.huihe+" 回合",zd.huihe);if(zd.huihe==50)yinxiao("决战1");if(zd.huihe==100)yinxiao("决战2");}
};
zdtiao.style.backgroundPosition=zdtiao.tempx+" "+zdtiao.tempy
},30)
},
tance:function(isshuaguai){  //战斗探测
if(xml.gws[0]==null||xml.gwmax==0)return;  //安全地图,或在安全区,97
if(sd_duihua||sd_onload||sd_loading||sjdt.ischuansong)return false;
if(isshuaguai==null&&(anquanqu||++zdbushu<rpg.zdbushu+zdbushu2))return false;
if(zdbushu>rpg.zdbushu+zdbushu2)zdbushu=rpg.zdbushu+zdbushu2
if(isshuaguai!=null||Math.random()*100>97){ckin=false;fm1.releaseCapture();yd.cle();zd.begin();}
},
tempshenshuo:false, //防止神说音乐被神魔音乐遮盖
guaihtm:function(gwname){  //获得怪战场HTML输出
var gobj=shouce.guainl(gwname),jiaqiangtext="";if(gobj.sboos=="神魔级"&&zd.tempshenshuo==false){yinxiao("神魔boos战")}else if(gobj.sboos=="神说级"){yinxiao("神说boos战");zd.tempshenshuo=true}
if(random()<0.07){var num1=Math.ceil(random()*4),jiaqiang=1+(num1/10);
gobj.shp*=jiaqiang;gobj.smp*=jiaqiang;gobj.sact1*=jiaqiang;gobj.sact2*=jiaqiang;gobj.smct1*=jiaqiang;gobj.smct2*=jiaqiang;
gobj.sdef*=jiaqiang;gobj.smef*=jiaqiang;gobj.ssu*=jiaqiang;gobj.sjq*=jiaqiang;gobj.ssb*=jiaqiang;gobj.sbj*=jiaqiang;
gobj.sexp*=jiaqiang;gobj.syili*=jiaqiang;gobj.scold*=jiaqiang;jiaqiangtext=' sjiaqiang="'+num1+'"';
}
var newdiaoluo=gobj.newdiaoluo!=null?'newdiaoluo="掉落" ':'';
return '<img align="top" valign="top" src="img/gw/'+gobj.src+'" id="zdgw" style="position:static;height:105%;" sname="'+gwname+'" slv="'+gobj.slv+'" shp1="'+round(gobj.shp)+'" shp2="'+round(gobj.shp)+'" smp1="'+round(gobj.smp)+'" smp2="'+round(gobj.smp)+'" sact1="'+round(gobj.sact1)+'" sact2="'+round(gobj.sact2)+'" smct1="'+round(gobj.smct1)+'" smct2="'+round(gobj.smct2)+'" sdef="'+round(gobj.sdef)+'" smef="'+round(gobj.smef)+'" ssu="'+round(gobj.ssu)+'" syili="'+round(gobj.syili)+'" sjq="'+round(gobj.sjq)+'" ssb="'+round(gobj.ssb)+'" sbj="'+round(gobj.sbj)+'" '+newdiaoluo+'sexp="'+round(gobj.sexp)+'" scold="'+round(gobj.scold)+'" sjn="'+gobj.sjn+'" swp="'+gobj.swp+'" sboos="'+gobj.sboos+'"'+jiaqiangtext+' szt="'+gobj.szt+'" onmousemove="showtmk(\'guaiwu or boos%#&@!-$^='+gwname+'=\'+this.shp1+zd.huihe)" xingdong=false style="margin-top:0">'
},

toushi_change:function(){
if(zd.toushi==false){
if(yd.zt=="走路"||yd.zt=="飞行"){zd_kuang.style.backgroundImage=fm1.style.backgroundImage}
else if(yd.zt=="潜泳"){zd_kuang.style.backgroundImage="url('img/background/shui1.gif')"}
else if(yd.zt=="陷阱"){zd_kuang.style.backgroundImage="url('img/"+xunlu.bgimg+"')";}
}else{zd_kuang.style.backgroundImage="url('img/background/ying.gif')"};zd_kuang.tempbg=new String(zd_kuang.style.backgroundImage);
},
begin:function(dhboos,whatzhandou){

zd.suoding=true;zd.jishi=new Date()
bq1.style.left=me.offsetLeft;bq1.style.top=me.offsetTop-30;
bq1.src="img/biaoqing/"+dh.bqsrc("愤怒")+".gif";
zd.zdzhong=true;zd.toushi_change();zdbushu=0;zd.beibaowu=[];beibao.innerText="无"
wp_kuang.style.display="none";jn_kuang.style.display="none";zt_kuang.style.display="none";bq1.style.display="";

if(dhboos!=null){  //是特定Boos战
dhboos=dhboos.split(",");zd.booszhan=true;if(whatzhandou==null)yinxiao("boos战")
for(var i=0;i<dhboos.length;i++){
if(dhboos[i]=="null"||dhboos[i]=="")continue;
zd.difang[zd.youbiao]=dhboos[i].split("=")[0]-1;
zd1td[zd.difang[zd.youbiao]].innerHTML=zd.guaihtm(dhboos[i].split("=")[1]);
zd.youbiao++;
}
}else{zd.booszhan=false;
for(var tmi=0;tmi<xml.gws.length;tmi++){  //是常规随即战,敌方装载
if(xml.gws[tmi]==null)break;
}
for(var i=0;i<xml.gwmax;i++){  //装载所有怪
if(i>0&&150*random()>100/xml.gwmax*(xml.gwmax-i))continue;  //出现怪物最大值难度=逐步递增

var gwnum=-1  //单个为何种怪
while(gwnum==-1){
var r=Math.floor(random()*tmi);  //错误,待下次测试
var gwnum2=xml.gws[r].split("=")[0].replace("%","")
if(100*random()<gwnum2){gwnum=r;break}
}
zd.difang[zd.youbiao]=round((zd1td.length-1)*random())  //每个怪的单元位置,不能重复
for(var r=0;r<zd.difang.length;r++){
if(r!=zd.youbiao&&zd.difang[r]==zd.difang[zd.youbiao]){zd.difang[zd.youbiao]=round((zd1td.length-1)*random());r=-1;}
}
zd1td[zd.difang[zd.youbiao]].innerHTML=zd.guaihtm(xml.gws[gwnum].split("=")[1]);
zd.youbiao++}
}
if(zdgw.length>1){  //怪状态数组化处理
for(var zti=0;zti<zdgw.length;zti++){if(zdgw[zti].szt!="无")zdgw[zti].szt=zdgw[zti].szt.split(",")}
}else{if(zdgw.szt!="无")zdgw.szt=zdgw.szt.split(",")}

zd.youbiao=0    //我方阵容装载,计算是哪种战斗模式
var isdantiao=wj.length
if(whatzhandou==null){hzqo.src="img/ico/hezhan.gif";hzqo.value="合战";
hzqo.onmousemove=function(){showtmk('普通合战群殴模式,该战斗方式下无法俘获神魔/神说/神葩级的敌人','常规战斗','red')}
}else if(whatzhandou=='单挑'){isdantiao=1;hzqo.src="img/ico/dantiao.gif";hzqo.value="单挑";
hzqo.onmousemove=function(){showtmk(wj[0].name+'的单挑战,该战斗方式下可俘获任何劲敌作为武将(不屈除外)','单挑模式','red');}
}else if(whatzhandou=='总决战'){hzqo.src="img/ico/zongjuezhan.gif";hzqo.value="总决战";
hzqo.onmousemove=function(){showtmk('强大势力敌方头目、精锐尽数登场两军总决战，惊天动地神魔对决的一战！<br>该战斗方式可俘获神魔/神说/神葩级劲敌作为武将','行会总决战模式','red');}
}

for(var i=0;i<isdantiao;i++){if(wj[i].name=="")continue;
var tempwofang=Math.floor(zd2td.length*random());
for(var r=0;r<zd.wofang.length;r++){
if(tempwofang==zd.wofang[r]){tempwofang=Math.floor(zd2td.length*random());r=-1;}
}
zd.wofang[zd.youbiao]=tempwofang

var temp1="";if(i==0){yd.zt=="飞行"?temp1="img/xingzou/rpg1_fei1_up1.gif":temp1="img/xingzou/rpg1_up1.gif"}else{temp1=wj[i].src}
zd2td[zd.wofang[zd.youbiao]].innerHTML='<img src="'+temp1+'" id="zdme" style="position:static;height:105%;" ssu="'+wj[i].sudu+'" syili="'+wj[i].yili+'" xingdong=false align="top" valign="top" fangshoudef=0 fangshoumef=0 siwang=false sname="'+wj[i].name+'" num='+i+' onmousemove="showtmk(\'生命 \'+wj[this.num].hp1+\'\/\'+wj[this.num].hp2+\'<br>魔法 \'+wj[this.num].mp1+\'\/\'+wj[this.num].mp2+\'<br>怒火 \'+wj[this.num].nu1+\'\/\'+wj[this.num].nu2+\'<br>速度 \'+wj[this.num].sudu+\'<br>经验 \'+new String(wj[this.num].exp1/(wj[this.num].exp2/100)).substr(0,4)+\'%\',this.sname+\'(\'+wj[this.num].lv+\'级)\',\'red\')">'
++zd.youbiao
}

zd_kuang.style.filter="revealtrans(duration=0.7,transition="+round(random()*23)+")";
zd_kuang.filters[0].apply();zd_kuang.style.display="";zd_kuang.filters[0].play();zd_kuang.style.display="";

zd.dixing(zd1td);zd.dixing(zd2td)  //装载地形
setTimeout(function(){zd.playtiao();},300)
setTimeout(function(){zd.suoding=false;zd.zdjinxing();},700)
if(whatzhandou=='单挑')yinxiao("单挑战");
if(whatzhandou=='总决战')yinxiao("总决战");
for(var i=0;i<zd.difang.length;i++){if(zd.difang[i]==null)continue;
if(zd1td[zd.difang[i]].getElementsByTagName("IMG")[0].sboos=="神葩级"){yinxiao("神葩战");break;}}
},
dixing1:function(haohuai){  //请求地形效果
var suiji=Math.floor(12*random());
if(haohuai=="坏")suiji=6+Math.floor(5*random());
if(haohuai=="好")suiji=Math.floor(5*random());
switch(suiji){
case 0:return "<span class=dixing style='background-Image:url(\"img/zd/dixing/su.gif\");' onmousemove=showtmk('优势地形:速,战斗中赋予2倍速度')>&nbsp;</span>||速";break;
case 1:return "<span class=dixing style='background-Image:url(\"img/zd/dixing/li.gif\");' onmousemove=showtmk('优势地形:力,暴击率提至100%')>&nbsp;</span>||力";break;
case 2:return "<span class=dixing style='background-Image:url(\"img/zd/dixing/gu.gif\");' onmousemove=showtmk('优势地形:固,战斗中伤害免减20%')>&nbsp;</span>||固";break;
case 3:return "<span class=dixing style='background-Image:url(\"img/zd/dixing/fa.gif\");' onmousemove=showtmk('优势地形:法,释放技能魔法MP消费减半')>&nbsp;</span>||法";break;
case 4:return "<span class=dixing style='background-Image:url(\"img/zd/dixing/xue.gif\");' onmousemove=showtmk('优势地形:毅,毅力翻倍,更多机会2次行动')>&nbsp;</span>||毅";break;
case 5:return "<span class=dixing style='background-Image:url(\"img/zd/dixing/yun.gif\");' onmousemove=showtmk('优势地形:保,防止暗杀/秒杀的避难所')>&nbsp;</span>||保";break;
case 6:return "<span class=dixing style='background-Image:url(\"img/zd/dixing/zhi.gif\");' onmousemove=showtmk('劣势地形:止,被触手缠绕无法自主移动')>&nbsp;</span>||止";break;
case 7:return "<span class=dixing style='background-Image:url(\"img/zd/dixing/ruo.gif\");' onmousemove=showtmk('劣势地形:弱,进攻伤害值降低20%')>&nbsp;</span>||弱";break;
case 8:return "<span class=dixing style='background-Image:url(\"img/zd/dixing/feng.gif\");' onmousemove=showtmk('劣势地形:封,无法释放任何技能')>&nbsp;</span>||封";break;
case 9:return "<span class=dixing style='background-Image:url(\"img/zd/dixing/duan.gif\");' onmousemove=showtmk('劣势地形:断,无法使用任何物品')>&nbsp;</span>||断";break;
case 10:return "<span class=dixing style='background-Image:url(\"img/zd/dixing/po.gif\");' onmousemove=showtmk('劣势地形:破,受到的伤害加深20%')>&nbsp;</span>||破";break;
case 11:return "<span class=dixing style='background-Image:url(\"img/zd/dixing/dun.gif\");' onmousemove=showtmk('劣势地形:钝,速度减半且闪避为0无法躲避')>&nbsp;</span>||钝";break;
}
},
dixing:function(objtd){  //装载地形位置
for(var i=0;i<8;i++){
var suiji=Math.floor(objtd.length*random());
if(objtd[suiji].dixing!=''){i--;continue;}
var dxtext=zd.dixing1().split("||");objtd[suiji].insertAdjacentHTML("beforeEnd",dxtext[0]);
objtd[suiji].dixing=dxtext[1];
}
},
movetuoyuan:function(whattd){  //椭圆选择标移位
zdtuoyuan.style.left=whattd.offsetLeft+whattd.getElementsByTagName("IMG")[0].offsetLeft
zdtuoyuan.style.top=whattd.offsetParent.offsetTop+whattd.offsetTop
zdtuoyuan.style.width=whattd.getElementsByTagName("IMG")[0].offsetWidth
zdtuoyuan.style.height=whattd.offsetHeight
},
showtime:null,
showzdgn:function(){  //菜单动画Show!
if(!zd.zdzhong)return;
if(zd.showtime!=null){clearInterval(zd.showtime);zd.showtime=null}
var x=zd.cdx-17,y=zd.cdy+10;
zdgn.style.left=x-20;zdgn.style.top=y;
zdgn.height=1;zdgn.style.visibility="visible";zdgn2.style.visibility="visible";
zd.showtime=setInterval("if(zdgn.height<30)zdgn.height=parseInt(zdgn.height)+3;else{clearInterval(zd.showtime);zd.showtime=null}",20)
zdgn2.style.left=zdgn.offsetLeft+30;zdgn2.style.top=zdgn.offsetTop-zdgn2.offsetHeight;
},
closezdgn:function(){  //菜单动画close!
zdgn.style.visibility="hidden";zdgn2.style.visibility="hidden";
},

jinxingclearout:true,  //战斗进行开始时把td.onmouseout=bgcolor=""去掉
xingdongcishu:0,  //记录战斗进行了第几个指令
zdjinxing:function(){  //战斗进行=自动算法
if(zd.jinxingclearout==true){zd.jinxingclearout=false;for(var i=0;i<zd1td.length;i++){zd1td[i].onmouseout=null;zd2td[i].onmouseout=null}}
zd.suoding=true;wp_kuang.style.display="none";zt_kuang.style.display="none";
if(siwang_kuang.style.visibility!="hidden"){swgn[0].disabled=true;swgn[1].disabled=true;}

var tempsiwang=zdme.length;for(var i=1;i<zdme.length;i++)if(zdme[i].siwang==true)--tempsiwang
if(tempsiwang==1){zdhelp("濒死");swgn[0].disabled=false;swgn[1].disabled=false;return siwang.tanchu();}

if(zd.difang.length==0){  //敌军消灭完毕,重置,准备下次PK
return zd.jieshu()
}

var zuigaosu=0,tempdi=true  //tempdi判断是那方，为了我方循环内争速度

for(var i=0;i<zd.difang.length;i++){  //穷举敌方最高速度
var tempobj=zd1td[zd.difang[i]].getElementsByTagName("IMG")[0]
try{if(tempobj.xingdong==true)continue;}catch(e){alert("战斗系统发生异常错误="+dtname+",敌人序列:["+i+"]报错,请反馈原作！");return zd.jieshu()}  //这里有时会计算错误,几率很低,try为了屏蔽错误
var tempsu=tempobj.ssu
if(zd1td[zd.difang[i]].dixing=="速")tempsu=tempsu*2
if(zd1td[zd.difang[i]].dixing=="钝")tempsu=tempsu/2
if(tempsu>=zuigaosu){zuigaosu=parseInt(tempsu);zd.newobj=tempobj;tempdi=true}
}
for(var i=0;i<zd.wofang.length;i++){  //穷举我方最高速度
var tempobj=zd2td[zd.wofang[i]].getElementsByTagName("IMG")[0]
if(tempobj.xingdong==true||tempobj.siwang==true)continue;var tempsu=tempobj.ssu
if(zd2td[zd.wofang[i]].dixing=="速")tempsu=tempsu*2
if(zd2td[zd.wofang[i]].dixing=="钝")tempsu=tempsu/2
if(getzt(me,"死亡重负")!=null)tempsu=1;
if(tempsu>=zuigaosu){zuigaosu=parseInt(tempsu);zd.newobj=tempobj;tempdi=false}
}
if(tempdi==false&&zd.newobj.zhiling!="已指令"){
zd.newobj.zhiling="已指令";zd.movetuoyuan(zd.newobj.parentElement);selwj=wj[zd.newobj.num];
var zt1=getzt(me,"天赐甘霖");selwj.hp1+=zt1==null?selwj.lv:selwj.lv+zt1;
selwj.mp1+=zt1==null?Math.floor(selwj.lv/10):Math.floor((selwj.lv+zt1)/10);selwj.nu1+=1;
gx_rpg();if(siwang_kuang.style.visibility!="hidden"){swgn[0].disabled=false;swgn[1].disabled=false;}
if(zidongimg.style.visibility=="hidden"){
zd.suoding=false;zd.showzdgn();
return zd.movezt=0;}
}

if(zidongimg.style.visibility!="hidden"){  //自动战斗
zd.movezt=1;zd.youbiao=0;for(var i=0;i<zd1td.length;i++)zd.tds[i]=null
var thenum=zd.difang[Math.floor(zd.difang.length*random())];  //查找攻击目标
zd.tds[zd.youbiao]=zd1td[thenum].getElementsByTagName("IMG")[0];zd.youbiao++
}

zd.newobj.xingdong=true;var tempyili=zd.newobj.parentElement.dixing=="毅"?zd.newobj.syili*2:zd.newobj.syili;
if(zd.movezt!=4&&100*random()<tempyili&&zd.newobj.yilixingdong!="已毅力行动"){zd.newobj.xingdong=false;zd.newobj.yilixingdong="已毅力行动"}
zd.newobj=zd.newobj.parentElement;

if(zuigaosu==0){  //所有战士行动完毕,下一回合.
zd.huihe++;zdfenge[3].innerText="第[ "+zd.huihe+" ]回合,"+Math.floor((new Date()-zd.jishi)/1000/60)+"分钟";zdfenge[3].dex=0;
zdfenge[3].go=setInterval(function(){if(++zdfenge[3].dex<20){zdfenge[3].style.backgroundColor=getcolor();}else{clearInterval(zdfenge[3].go);}
},40)
zd.jinxingclearout=true;
for(var i=0;i<zdme.length;i++){zdme[i].fangshoudef=0;zdme[i].fangshoumef=0;}
zd.playtiao()

for(var i=0;i<zd1td.length;i++){  //火墙处理 
if(zd1td[i].huoqiang==null)continue;zd1td[i].huoqiang.huihe-=1;
if(zd1td[i].getElementsByTagName("IMG").length==0)continue;yinxiao("击中6")
var zsobj=zd1td[i].getElementsByTagName("IMG")[0],temsh=round(zd.getmct())
if(temsh<0)temsh=0;zsobj.shp1-=temsh;
zddh.shtext(zsobj.parentElement.offsetLeft+(zsobj.parentElement.offsetWidth/2),zsobj.parentElement.offsetTop+(zsobj.parentElement.offsetHeight/2)+20,"火墙 - "+temsh,zsobj);
if(zsobj.shp1<1&&getzt(zsobj,"重生",true)==null){zd.movezt=0;zd.huihe--;zd1td[i].huoqiang.huihe++;return guaidh.siwang(zsobj,zd.findzdme(selwj.name),"常规攻击")}
}

for(var i=0;i<zd.difang.length;i++){
var zsobj=zd1td[zd.difang[i]].getElementsByTagName("IMG")[0]
var allzt=getzt(zsobj,"中毒","all")
if(allzt!=null){allzt=allzt.split("=");zsobj.shp1-=parseInt(allzt[1]);if(zsobj.shp1<1)zsobj.shp1=1;
zddh.shtext(zsobj.parentElement.offsetLeft+(zsobj.parentElement.offsetWidth/2),zsobj.parentElement.offsetTop+(zsobj.parentElement.offsetHeight/2),"中毒 - "+allzt[1],zsobj);
}
if(zsobj.szt!="无"){for(var r=0;r<zsobj.szt.length;r++){  //所有状态回合--
if(zsobj.szt[r]=="")continue;var jianzt=zsobj.szt[r].split("=");if(jianzt[2]<999)jianzt[2]-=1;
if(jianzt[2]<1)zsobj.szt[r]="";else zsobj.szt[r]=jianzt.join("=");
}}

zsobj.xingdong=false;zsobj.yilixingdong=null;
}  //end for zd.difang

for(var i=0;i<zd.wofang.length;i++){
var zsobj=zd2td[zd.wofang[i]].getElementsByTagName("IMG")[0]
zsobj.xingdong=false;zsobj.yilixingdong=null;
zsobj.zhiling=null;
}
return zd.zdjinxing();
}

zd.movetuoyuan(zd.newobj);


var newobj2=zd.newobj.getElementsByTagName("IMG")[0]
if(newobj2.id=="zdme"){  //我方进攻行动
newobj2.zhiling=null;
if(getzt(me,"惊恐麻木")!=null){
if(random()*100<getzt(me,"惊恐麻木")){gdtext(zdtuoyuan.offsetLeft,zdtuoyuan.offsetTop,selwj.name+"惊恐麻木了,行动失败")
return setTimeout("zd.zdjinxing()",800);}
}
if(zd.movezt==7){var yunqi=round(random()*100),yunqi2=80;zdhelp("逃跑");
for(var i=0;i<wj.length;i++){if(wj[i].name!="")yunqi2-=5}
gdtext(zd.cdx,zd.cdy,"幸运指数 "+yunqi+" - "+(yunqi2+rpg.luck))
zd.movezt=0;if(yunqi<=yunqi2+rpg.luck){
return setTimeout("gdtext(zd.cdx,zd.cdy,'恭喜你,撤退成功!');zd.jieshu()",800)
}else{
return setTimeout("gdtext(zd.cdx,zd.cdy,'很不走运,撤退失败!');zd.zdjinxing()",800)
}
}
if(zd.movezt==4){zdhelp("移动");return guaidh.yd1(newobj2,"我")}
if(zd.movezt==5){zdhelp("防御");return zd.zdjinxing()};
var kexing=false  //测试指令是否可行(如怪逃跑,无目标的情况下)
for(var i=0;i<zd.tds.length;i++){if(zd.tds[i]!=null){kexing=true;break}}
if(kexing==false){
gdtext(zdtuoyuan.offsetLeft,zdtuoyuan.offsetTop,selwj.name+"(失望):目标缺失,行动失败")
return setTimeout("zd.zdjinxing()",800);
}
if(zd.movezt==2){  //技能释放处理
var themp=zd.jnobj2.getAttribute("mp");if(jn.find("真·"+zd.jnobj1.getAttribute("n"))!=false){themp*=2;zdhelp("技能","真·"+zd.jnobj1.getAttribute("n"));}else{
for(var r=0;r<zd.jnobj1.childNodes.length;r++){if(zd.jnobj1.childNodes[r]==zd.jnobj2)break;}zdhelp("技能",(r+1)+"重"+zd.jnobj1.getAttribute("n"));}
zd.newobj.dixing!="法"?selwj.mp1-=themp:selwj.mp1-=round(themp*0.5);
if(zd.jnobj2.getAttribute("nu")!=null)selwj.nu1-=parseInt(zd.jnobj2.getAttribute("nu").replace(/max/gi,selwj.nu2));
gx_rpg();
if(zd.jnobj1.getAttribute("yici")==null&&zd.jnobj1.getAttribute("use")=="对敌"){zdgn2.jineng=zd.jnobj1.getAttribute("n");zdgn2.src="img/jn/"+zd.jnobj1.getAttribute("src");}
return zddh.rpgjn(zd.jnobj1.getAttribute("n"),newobj2)
}
if(zd.movezt==3){  //物品使用处理
var tempname=zd.usewp2.xml_name
if(zd.usewp2.shuliang==1){rpg.wp[zd.usewp2.weizhi]=null}else{
rpg.wp[zd.usewp2.weizhi]=zd.usewp2.xml_node+"="+tempname+"="+(zd.usewp2.shuliang-1);}
zdhelp("物品",tempname);wpzb.wupin();

if(zd.tds[0].id=="zdme"){
usewp(tempname,wj[zd.tds[0].num])
tbzt.zhuangtai();gdtext(zd.tds[0].parentElement.offsetLeft,zd.tds[0].parentElement.offsetTop+zd2.offsetTop+zd.tds[0].offsetHeight,"你对目标使用了1个 "+tempname)
}else{if(tempname.indexOf("俘获绳")!=-1)return zddh.rpgjn("俘获",newobj2);}
yinxiao("使用");return setTimeout("zd.zdjinxing()",1000);
}

for(var i=0;i<zd.tds.length;i++){
if(zd.tds[i]==null)continue;
zddh.gj(zd.tds[i],newobj2)
}
}else{  //敌方进攻,逐步增加AI(人工智能)中
var guaiobj=zd.newobj.getElementsByTagName("IMG")[0]
if(zdme.siwang==true)return zd.zdjinxing();
if(getzt(guaiobj,"晕了","all")!=null){
gdtext(zd.newobj.offsetLeft,zd.newobj.offsetTop+zd.newobj.offsetHeight,"敌人无法行动");
if(guaiobj.yilixingdong=="已毅力行动"){
for(var r=0;r<guaiobj.szt.length;r++){  //晕状态--
if(guaiobj.szt[r]=="")continue;var jianzt=guaiobj.szt[r].split("=");
if(jianzt[0]=="晕了")jianzt[2]-=1;if(jianzt[2]<1)guaiobj.szt[r]="";else guaiobj.szt[r]=jianzt.join("=");
}}

return setTimeout("zd.zdjinxing()",1000);
}
var thenum=zd.wofang[Math.floor(zd.wofang.length*random())];  //查找攻击目标
while(zd2td[thenum].getElementsByTagName("IMG")[0].siwang==true){
thenum=zd.wofang[Math.floor(zd.wofang.length*random())]
}
var jnarray=guaiobj.sjn.split(",");if(jnarray[0]!="null"&&zd.newobj.dixing!="封"&&getzt(guaiobj,"技封","all")==null){
for(var i=0;i<jnarray.length;i++){
var sjn1=jnarray[i].split("=")[0],sjn2=jnarray[i].split("=")[1]
var sjn3=parseInt(jnarray[i].split("=")[2].replace("%",""));
if(sjn1=="治疗"&&guaiobj.shp1==guaiobj.shp2){}  //continue;
if(random()*100<sjn3){
var guaijn1=xml.getjn(sjn1),guaijn2=guaijn1.selectNodes('lv')[sjn2-1];
if(parseInt(guaiobj.smp1)<parseInt(guaijn2.getAttribute('mp')))continue; //mp不足
guaiobj.smp1=guaiobj.smp1-guaijn2.getAttribute('mp');
var tobj=zd2td;if(guaijn1.getAttribute("use")=="对敌")tobj=zd1td;
var alllen=tobj.length
if(tobj==zd1td){for(var i=0;i<alllen;i++){if(tobj[i]==zd.newobj){thenum=i;break;}}}else{selwj=wj[zd2td[thenum].getElementsByTagName("IMG")[0].num];gx_rpg();}
fwshuchu(guaijn2.getAttribute("fe"),thenum,tobj,"purple","orange",alllen)

zdhelp("技能",sjn2+"重"+guaijn1.getAttribute("n"));return guaidh.alljn(guaijn1,guaiobj,guaijn2,sjn2,thenum);
}
}}
if(zd.newobj.dixing=="封"||(random()<0.08&&guaiobj.parentElement.dixing!="止")){zdhelp("移动");return guaidh.yd1(guaiobj,"敌")}
if(random()<0.05){zdhelp("发呆");gdtext(zd.newobj.offsetLeft,zd.newobj.offsetTop+zd.newobj.offsetHeight,"好像坐在树上想事情,HP恢复"+round(guaiobj.shp2/25));return setTimeout(function(){guaiobj.shp1=parseInt(guaiobj.shp1)+round(guaiobj.shp2/25);if(guaiobj.shp1>guaiobj.shp2)guaiobj.shp1=guaiobj.shp2;zd.zdjinxing()},1200)}
if(random()<0.03&&guaiobj.sboos=="null"){zdhelp("逃跑");return guaidh.taopao(guaiobj);}
selwj=wj[zd2td[thenum].getElementsByTagName("IMG")[0].num];gx_rpg();
zddh.gj(zd2td[thenum].getElementsByTagName("IMG")[0],guaiobj)
}
},
getact:function(){var theact=selwj.act1+$(round((selwj.act2-selwj.act1)*random()))
if(selwj!=wj[0])theact+=(theact/100*selwj.haogan)
if(jn.find("武学极限")!=false){var thewl1=parseInt(xml.getjn("武学极限").childNodes[jn.find("武学极限")[1]-1].getAttribute("wl"))
var chengyi1=jn.find("真·武学极限")!=false?thewl1/50:thewl1/100;theact+=theact*chengyi1;
}return theact
},
getmct:function(){var themct=selwj.mct1+$(round((selwj.mct2-selwj.mct1)*random()))
if(selwj!=wj[0])themct+=(themct/100*selwj.haogan)
if(jn.find("魔力极限")!=false){var thewl1=parseInt(xml.getjn("魔力极限").childNodes[jn.find("魔力极限")[1]-1].getAttribute("wl"))
var chengyi1=jn.find("真·魔力极限")!=false?thewl1/50:thewl1/100;themct+=themct*chengyi1;
}return themct
},
getweili:function(){var thewl=parseInt(zd.jnobj2.getAttribute("wl"));if(isNaN(thewl))return 0;
thewl=jn.find("真·"+zd.jnobj1.getAttribute("n"))!=false?thewl*2:thewl;
if(zd.jnobj2.getAttribute("wl").indexOf("%")!=-1)thewl+="%";return thewl;
},
getmiao:function(){return parseInt(zd.jnobj2.getAttribute("miao"))},
shuangxiangsh:function(mubiao){var thesh1=zd.getact()-mubiao.sdef,thesh2=zd.getmct()-mubiao.smef;
if(thesh1<0)thesh1=0;if(thesh2<0)thesh2=0;return thesh1+thesh2;
},  //双向伤害获取,防止一向防御过高
shanghai:function(obj,mubiao,whatjn){  //伤害值计算
var fujia=""  //伤害附加的提示消息
var jingongfang=obj.id=="zdme"?true:false;
var tempsh=0,jqfujia=0
if(jingongfang){  //我方进攻计算
if(whatjn!="常规攻击"&&whatjn!="常规魔法攻击"){jqfujia=zd.jnobj2.getAttribute("jq")==null?0:parseInt(zd.jnobj2.getAttribute("jq"));
if(jqfujia!=0&&jn.find("真·"+zd.jnobj1.getAttribute("n"))!=false)jqfujia=round(jqfujia*1.5);
if(zd.jnobj1.getAttribute("yici")!=null)zd.yicijn+=whatjn+",";
}

if(whatjn!="定点清除"&&mubiao.parentElement.dixing!="钝"&&random()*100>selwj.jingque+jqfujia-$(mubiao.ssb))return "未命中"
var baojifujia=0,oldsdef=mubiao.sdef,oldsmef=mubiao.smef;
var wushifang=getqianneng("无视防御");
if(random()*100<wushifang)mubiao.sdef=0;
if(random()*100<getqianneng("无视魔防"))mubiao.smef=0;
if(getzt(mubiao,"魔女诅咒",true)!=null){mubiao.sdef=0;mubiao.smef=0}
mubiao.sdef=parseInt(mubiao.sdef);mubiao.smef=parseInt(mubiao.smef);
switch(whatjn){
case "常规攻击":var theqn=getqianneng("魔攻");if(theqn==0){tempsh=zd.getact()-mubiao.sdef}else{
if(selwj==wj[0]){random()*100<theqn?tempsh=zd.getmct()-mubiao.smef:tempsh=zd.getact()-mubiao.sdef;}else{tempsh=zd.getact()-mubiao.sdef}}
break;
case "常规魔法攻击":tempsh=zd.getmct()-mubiao.smef;break;
case "光弧球":tempsh=zd.getmct()+zd.getweili()-mubiao.smef;break;
case "气贯长虹":tempsh=zd.getact()+zd.getweili()-mubiao.sdef;break;
case "奋力一击":tempsh=zd.getact()+zd.getweili()-mubiao.sdef;if(xml.getgw(mubiao.sname).getAttribute("sheng")=="男性")tempsh*=1.5;break;
case "暗黑时代合战":
if(mubiao.sname=="暗黑女剑士"||mubiao.sname=="暗黑男战士"||mubiao.sname=="凤天翔"||mubiao.sname=="艾丽西亚"){
tempsh=0;fujia+="<br><font style='color:yellow'>自己人无效</font>";return tempsh+fujia;
}else{tempsh=zd.shuangxiangsh(mubiao)+zd.getweili();mubiao.xingdong=true;}break;
case "坚冰柱":tempsh=zd.getmct()+zd.getweili()-mubiao.smef;break;
case "十字斩":tempsh=zd.getact()+zd.getweili()-mubiao.sdef;break;
case "圣火":tempsh=zd.getmct()+zd.getweili()-mubiao.smef;break;
case "地狱火":tempsh=zd.getmct()+zd.getweili()-mubiao.smef;break;
case "陨石降":tempsh=zd.getmct()+zd.getweili()-mubiao.smef;if(xml.getgw(mubiao.sname).getAttribute("sheng")=="男性"||xml.getgw(mubiao.sname).getAttribute("sheng")=="女性")tempsh*=1.5;break;
case "天罚狂雷":fujia+="<br><font style='color:yellow'>法防降低 "+round(oldsmef*0.1)+"</font>";tempsh=zd.getmct()+zd.getweili()-mubiao.smef;oldsmef=round(oldsmef*0.9);if(xml.getgw(mubiao.sname).getAttribute("sheng")=="神裔")tempsh*=1.5;break;
case "虎牙双破斩":fujia+="<br><font style='color:yellow'>速度降低 "+round(mubiao.ssu*0.06)+"</font>";tempsh=zd.getact()+zd.getweili()-mubiao.sdef;mubiao.ssu=round(mubiao.ssu*0.94);break;
case "乱舞炎龙霸":tempsh=zd.getact()+zd.getweili()-mubiao.sdef;selwj.nu1+=2;if(random()<0.03)mubiao.xingdong=true;break;
case "飞翔天征剑":fujia+="<br><font style='color:yellow'>防御降低 "+round(oldsdef/2)+"</font>";tempsh=(zd.getact()+zd.getweili()-mubiao.sdef)*2;oldsdef=round(oldsdef/2);
break;
case "天魔流星剑":tempsh=zd.getmct()+zd.getweili()-mubiao.smef;break;
break;
case "圣光斩":fujia+="<br><font style='color:yellow'>闪避降低 "+round(mubiao.ssb*0.3)+"</font>";tempsh=zd.shuangxiangsh(mubiao)+zd.getweili();mubiao.ssb=round(mubiao.ssb*0.7);break;
case "星光灭绝":fujia+="<br><font style='color:yellow'>精确降低 "+round(mubiao.sjq*0.2)+"</font>";tempsh=zd.shuangxiangsh(mubiao)+zd.getweili();mubiao.sjq=round(mubiao.sjq*0.8);
var dxtext=zd.dixing1("坏").split("||");if(mubiao.parentElement.dixing!=''){
for(var r=0;r<mubiao.parentElement.childNodes.length;r++){if(mubiao.parentElement.childNodes[r].tagName=="SPAN"){mubiao.parentElement.childNodes[r].outerHTML=dxtext[0];}}
mubiao.parentElement.dixing=dxtext[1]
}else{mubiao.parentElement.insertAdjacentHTML("beforeEnd",dxtext[0]);mubiao.parentElement.dixing=dxtext[1];}
break;
case "定点清除":tempsh=selwj.act2-mubiao.sdef;baojifujia=parseInt(zd.getweili());break;
case "双雷斩":tempsh=zd.shuangxiangsh(mubiao)+rpg.dian[2];tempsh+=tempsh/100*parseInt(zd.getweili());break;
case "电磁漩涡":tempsh=zd.getact()+zd.getweili()-mubiao.sdef;break;
case "蓄能击退":tempsh=zd.getact()+zd.getweili()-mubiao.sdef;break;
case "火墙":tempsh=zd.getmct()+zd.getweili()-mubiao.smef;break;
case "吸星大法":tempsh=round(zd.getweili()+(rpg.dian[1]*0.35));break;
case "月牙突":tempsh=zd.getact()+zd.getweili()-mubiao.sdef;break;
case "袭爪千雷破":tempsh=zd.getact()+zd.getweili()-mubiao.smef;if(xml.getgw(mubiao.sname).getAttribute("sheng")=="男性"||xml.getgw(mubiao.sname).getAttribute("sheng")=="女性")tempsh*=1.5;break;
case "极光次元斩":tempsh=zd.getact()+zd.getweili()-mubiao.sdef;break;
case "死亡射线":tempsh=zd.getact()+zd.getweili()-mubiao.sdef;if(xml.getgw(mubiao.sname).getAttribute("sheng")=="机器")tempsh*=2.5;break;
case "龙震":tempsh=zd.getmct()+zd.getweili()-mubiao.smef;break;
case "病毒瘟疫":tempsh=round(zd.getmct()+zd.getweili()-mubiao.smef);addzt(mubiao,"中毒",tempsh,zd.getmiao());fujia+="<br><font style='color:yellow'>身中剧毒</font>";break;
case "魔女诅咒":tempsh=0;addzt(mubiao,"无敌",0,0);addzt(mubiao,"魔女诅咒",0,zd.getmiao());fujia+="<br><font style='color:yellow'>身受诅咒</font>";break;
case "天使箭阵":tempsh=zd.getmct()+zd.getweili()-mubiao.smef;if(xml.getgw(mubiao.sname).getAttribute("sheng")==null)tempsh*=2.5;break;
case "雷光破":tempsh=zd.getweili()+(zd.getweili()/100*selwj.nu2);break;
case "帝国幻影突刺":tempsh=zd.shuangxiangsh(mubiao)+zd.getweili();break;
case "地狱魔の审判":tempsh=zd.shuangxiangsh(mubiao)+zd.getweili()+round(mubiao.shp2*0.06);
if(xml.getgw(mubiao.sname).getAttribute("sheng")=="神裔")tempsh*=1.5;
mubiao.xingdong=true;addzt(mubiao,"技封",0,zd.getmiao());fujia+="<br><font style='color:yellow'>技能被封印</font>";break;
case "灰天血爆绝杀":tempsh=selwj.hp2*10;selwj.hp1-=round(selwj.hp2/2);break;
case "神说俺样最强":tempsh=zd.getweili();wj[0].hp1=wj[0].hp2;wj[0].mp1=wj[0].mp2;wj[0].nu1=wj[0].nu2;addzt(mubiao,"无敌",0,0);addzt(mubiao,"不屈",0,0);addzt(me,"俺样最强",999,zd.getmiao());break;
}
if(tempsh<0)tempsh=1
if(getzt(me,"嗜血大法")!=null)selwj.hp1+=getzt(me,"嗜血大法")
if(getzt(me,"狂热信念")!=null)tempsh=round(random()*getzt(me,"狂热信念"));


var smiemo=0;
smiemo+=getqianneng("毁灭敌人魔法");
if(getzt(me,"灭魔大法")!=null){var thezhi=getzt(me,"灭魔大法");smiemo+=thezhi;
thezhi>=mubiao.smp1?selwj.mp1+=parseInt(mubiao.smp1):selwj.mp1+=thezhi;
}
if(whatjn=="吸星大法"){smiemo+=tempsh;
if(tempsh>=mubiao.smp1){selwj.mp1+=parseInt(mubiao.smp1);selwj.hp1+=parseInt(mubiao.smp1)}else{selwj.mp1+=tempsh;selwj.hp1+=tempsh;};
selwj.nu1+=round(rpg.dian[1]*0.1)
}
mubiao.smp1-=smiemo;if(smiemo>0){
if(mubiao.smp1<0){mubiao.smp1=0;}else{fujia+="<br>mp$$$jian="+smiemo}
}

var sjiyun=0,sjiyunmiao=3
if(getzt(me,"麻痹击晕")!=null)sjiyun+=getzt(me,"麻痹击晕")
sjiyun+=getqianneng("概率击晕")
if(whatjn=="月牙突"){sjiyun+=2;sjiyunmiao=zd.getmiao()}
if(whatjn=="灰天血爆绝杀"||whatjn=="星光灭绝"){sjiyun+=100;sjiyunmiao=zd.getmiao()}
if((random()*100<sjiyun&&getzt(mubiao,"防麻痹",true)==null)||whatjn=="星光灭绝"){addzt(mubiao,"晕了",0,sjiyunmiao);fujia+="<br><font style='color:yellow'>被打晕</font>"}

var shjs=100;
if(mubiao.parentElement.dixing=="固")shjs-=20;
if(mubiao.parentElement.dixing=="破")shjs+=20;
if(obj.parentElement.dixing=="弱")shjs-=20;
if(getzt(me,"伤害加深")!=null)shjs+=getzt(me,"伤害加深")
shjs+=getqianneng("伤害加深")
shjs+=nujiacheng()
if(random()*100<getqianneng("概率双倍伤害")){shjs*=2;fujia+="<br><font style='color:yellow'>造成双倍伤害</font>"}
tempsh=tempsh*(shjs/100);
if(whatjn=="极光次元斩")tempsh+=(mubiao.shp1/30)


selwj.hp1+=getqianneng("生命吸收");selwj.mp1+=getqianneng("魔法恢复");

var sansha=0;
sansha+=getqianneng("暗杀");
if(whatjn=="定点清除")sansha+=parseInt(zd.getweili());
if(whatjn=="帝国幻影突刺")sansha+=200;
if(mubiao.sboos=="帝王级")sansha=sansha/2;
if(mubiao.sboos=="传说级"||mubiao.sboos=="神魔级"||mubiao.sboos=="神说级"||mubiao.sboos=="神葩级")sansha=0;
if(random()*100<sansha&&mubiao.parentElement.dixing!="保"){tempsh=mubiao.shp2;fujia+="<br><font style='color:yellow'>暗杀成功</font>";gdtext(zdtuoyuan.offsetLeft,zdtuoyuan.offsetTop,"Sorry,再见了呦^-^")}

selwj.nu1+=1+getqianneng("怒火增长加快")
gx_rpg();mubiao.sdef=oldsdef;mubiao.smef=oldsmef;
if(getzt(mubiao,"无敌",true)!=null&&whatjn!="灰天血爆绝杀"&&whatjn!="圣光斩"){tempsh=1;addzt(mubiao,"无敌",0,parseInt(getzt(mubiao,"无敌",true).split("=")[2])-1);fujia="<br><font style='color:yellow'>无敌状态-1</font>";zddh.shanguang();}

if(whatjn=="俘获"){if(random()*100>zd.usewp1.getAttribute("v1")){  //俘获失败
yinxiao("俘获失败");return "运差,俘获失败";
}else{
return "俘获成功";
}}

if(getzt(mubiao,"伤害控制",true)!=null&&parseInt(tempsh)>9999&&whatjn!="圣光斩"&&whatjn!="灰天血爆绝杀"&&whatjn!="天魔流星剑"&&whatjn!="神说俺样最强")tempsh=9999;
if(getzt(me,"死亡重负")==null&&(obj.parentElement.dixing=="力"||random()*100<selwj.baoji+baojifujia)){return round(tempsh*(1+random()))+" 暴击"+fujia}else{return round(tempsh)+fujia}
}else{  //敌方进攻计算
var fangshoudef=parseInt(mubiao.fangshoudef),fangshoumef=parseInt(mubiao.fangshoumef)
if(whatjn!="常规攻击"&&whatjn!="常规魔法攻击"){
var guaijn=xml.getjn(whatjn.split("=")[0]).selectNodes('lv')[whatjn.split("=")[1]-1];
whatjn=whatjn.split("=")[0];jqfujia=parseInt(guaijn.getAttribute("jq"))
}
if(mubiao.parentElement.dixing!="钝"&&random()*100>$(obj.sjq)+jqfujia-wj[mubiao.num].shanbi)return "未命中"
var rpgdefs=wj[mubiao.num].def+fangshoudef,rpgmefs=wj[mubiao.num].mef+fangshoumef
if(mubiao.num!=0){rpgdefs+=(rpgdefs/100*wj[mubiao.num].haogan);rpgmefs+=(rpgmefs/100*wj[mubiao.num].haogan);}


fumian="暗黑血咒,暗黑魔咒,死亡重创,死亡重负,技能封印,物品封印,惊恐麻木";
if(fumian.indexOf(whatjn)!=-1){  //怪负面技能计算
if(random()*100<getqianneng("负面状态免疫")){tempsh=0;fujia="<br><font style='color:yellow'>免疫</font>";}else{
tempsh=0;addzt(me,whatjn,guaidh.getweili(guaijn),guaidh.getmiao(guaijn));fujia="<br><font style='color:yellow'>身中"+whatjn+"</font>";
}}
if(getzt(obj,"破防",true)!=null){rpgdefs=0;rpgmefs=0}
switch(whatjn){
case "常规攻击":tempsh=guaidh.getact(obj)-rpgdefs;break;
case "常规魔法攻击":tempsh=guaidh.getmct(obj)-rpgmefs;break;
case "龙卷风":tempsh=guaidh.getmct(obj)+guaidh.getweili(guaijn)-rpgmefs;break;
case "致命打击":tempsh=guaidh.getact(obj)+guaidh.getweili(guaijn)-rpgdefs;break;
case "巨石敲脑壳":tempsh=(guaidh.getact(obj)-rpgdefs)+(guaidh.getmct(obj)-rpgmefs);break;
case "魔界烈火":random()>0.5?tempsh=guaidh.getact(obj)+guaidh.getweili(guaijn):tempsh=guaidh.getmct(obj)+guaidh.getweili(guaijn);if(random()>0.5)mubiao.xingdong=true;break;
case "魑魅魍魉":tempsh=guaidh.getmct(obj)+guaidh.getweili(guaijn)-rpgmefs;if(wj[mubiao.num].xingbie=="魔物"&&mubiao.parentElement.dixing!="保"){fujia+="<br><font style='color:yellow'>魔物被秒</font>";return tempsh=wj[mubiao.num].hp2+fujia;};break;
case "法老的诅咒":tempsh=guaidh.getmct(obj)+guaidh.getweili(guaijn)-rpgmefs;addzt(me,"暗黑血咒",5,200);addzt(me,"暗黑魔咒",5,200);addzt(me,"死亡重创",20,200);addzt(me,"死亡重负",20,200);addzt(me,"惊恐麻木",20,200);break;
case "诺亚风暴":tempsh=guaidh.getact(obj)+guaidh.getweili(guaijn);if(wj[mubiao.num].xingbie=="机器"&&mubiao.parentElement.dixing!="保"){fujia+="<br><font style='color:yellow'>机器被秒</font>";return tempsh=wj[mubiao.num].hp2+fujia;};break;
case "炸弹之母":tempsh=guaidh.getact(obj)+guaidh.getweili(guaijn)-rpgdefs;mubiao.parentElement.dixing=="";if(mubiao.nextSibling!=null)mubiao.nextSibling.removeNode(true);break;
case "人间崩坏":tempsh=guaidh.getact(obj)+guaidh.getweili(guaijn)-rpgdefs;break;
case "玉殒香消":tempsh=0;if(wj[mubiao.num].xingbie=="女性"&&mubiao.parentElement.dixing!="保"){fujia+="<br><font style='color:yellow'>女性被秒</font>";return tempsh=wj[mubiao.num].hp2+fujia;}break;
case "黑色破坏光线":tempsh=wj[mubiao.num].hp2/2;break;
case "神罚":return tempsh=(wj[mubiao.num].hp1-1)+"<br><font style='color:yellow'>惨遭神罚</font>";break;
case "天马流星拳":tempsh=guaidh.getact(obj)+guaidh.getweili(guaijn)-rpgdefs;mubiao.xingdong=true;break;
case "九阴祭尘烬":tempsh=guaidh.getact(obj)-rpgdefs;wj[mubiao.num].mp1-=wj[mubiao.num].mp2/2;wj[mubiao.num].mp1=Math.floor(wj[mubiao.num].mp1);
wj[mubiao.num].nu1-=(wj[mubiao.num].nu2/2);wj[mubiao.num].nu1=Math.floor(wj[mubiao.num].nu1);
break;
case "帅哥精杀":tempsh=guaidh.getmct(obj)+guaidh.getweili(guaijn)-rpgmefs;if(wj[mubiao.num].xingbie=="男性"&&mubiao.parentElement.dixing!="保"){fujia+="<br><font style='color:yellow'>男性被秒</font>";return tempsh=wj[mubiao.num].hp2+fujia;}break;
case "一闪冥王斩":if(mubiao.num==0)return tempsh=(wj[mubiao.num].hp1-1).toString();
if(mubiao.parentElement.dixing!="保"){fujia+="<br><font style='color:yellow'>被秒</font>";return tempsh=wj[mubiao.num].hp2+fujia;}break;
case "真·地狱之舞":tempsh=wj[mubiao.num].hp2;break;
case "异次元之门":tempsh=guaidh.getact(obj)+guaidh.getweili(guaijn)-rpgdefs;break;
case "黑宇宙の末日序曲":tempsh=wj[mubiao.num].hp2;
for(var i=0;i<zd2td.length;i++){if(zd2td.bgColor=="")continue;var dxtext=zd.dixing1("坏").split("||");
if(zd2td[i].dixing!=''){
for(var r=0;r<zd2td[i].childNodes.length;r++){if(zd2td[i].childNodes[r].tagName=="SPAN"){zd2td[i].childNodes[r].outerHTML=dxtext[0];zd2td[i].dixing=dxtext[1];}}
}else{
zd2td[i].insertAdjacentHTML("beforeEnd",dxtext[0]);
zd2td[i].dixing=dxtext[1];
}}
break;
case "光宇宙の绝对领域":tempsh=wj[mubiao.num].hp2;
for(var i=0;i<zd1td.length;i++){if(zd1td.bgColor=="")continue;var dxtext=zd.dixing1("好").split("||");
if(zd1td[i].dixing!=''){
for(var r=0;r<zd1td[i].childNodes.length;r++){if(zd1td[i].childNodes[r].tagName=="SPAN"){zd1td[i].childNodes[r].outerHTML=dxtext[0];zd1td[i].dixing=dxtext[1];}}
}else{
zd1td[i].insertAdjacentHTML("beforeEnd",dxtext[0]);
zd1td[i].dixing=dxtext[1];
}}
break;
}
if(whatjn=="常规攻击"||whatjn=="常规魔法攻击"){
if(getzt(obj,"状态消灭",true)!=null&&random()<0.5&&getzt(me,"俺样最强")==null){guaidh.xiaomiezt(1);fujia+="<br><font style='color:yellow'>状态消灭</font>"}
if(getzt(obj,"秒杀",true)!=null&&random()<0.35&&mubiao.num>0&&mubiao.parentElement.dixing!="保"){fujia+="<br><font style='color:yellow'>被秒</font>";return tempsh=wj[mubiao.num].hp2+fujia;}
}
if(tempsh<0)tempsh=parseInt(obj.slv*random())
var shjs=100;if(getzt(me,"死亡重创")!=null)shjs+=getzt(me,"死亡重创")
if(mubiao.parentElement.dixing=="固")shjs-=20;
if(mubiao.parentElement.dixing=="破")shjs+=20;
if(obj.parentElement.dixing=="弱")shjs-=20;
if(getzt(me,"伤痛减轻")!=null)shjs-=getzt(me,"伤痛减轻")
var theqn=getqianneng("伤害减免");if(theqn!=0)shjs-=theqn;
tempsh=tempsh*(shjs/100)


if(getzt(obj,"吸魔",true)!=null){obj.smp1=parseInt(obj.smp1)+round(tempsh/10);wj[mubiao.num].mp1-=round(tempsh/10);fujia+="<br>mp$$$jian="+round(tempsh/10)}
if(obj.parentElement.dixing=="力"||random()*100<obj.sbj){return round(tempsh*(1+random()))+" 暴击"+fujia}else{return round(tempsh)+fujia}
}
},
taopao:function(){  //逃跑功能
zd.movezt=7;zd.zdjinxing()
},
jieshu:function(){  //战斗结束处理
zidongimg.style.visibility="hidden";zd.yicijn="";jh_kuang.style.visibility='hidden';jh_kuang2.style.visibility='hidden'
zd_kuang.style.filter="revealtrans(duration=0.4,transition="+round(random()*23)+")";
siwang_kuang.style.visibility="hidden";zd.tempshenshuo=false
for(var i=0;i<wj.length;i++){if(wj[i].hp1<1)wj[i].hp1=1}gx_rpg()
zd_kuang.filters[0].apply();zd_kuang.style.visibility="hidden";zd_kuang.filters[0].play();
setTimeout("zd_kuang.style.display='none';zd_kuang.style.visibility='visible'",500)   //原来是1200
bq1.style.display="none";
zd.movezt=0;zd.suoding=false;zd.huihe=1;zd.xingdongcishu1=0;zd.xingdongcishu2=0;
zd.youbiao=0;zd.newobj=null;
for(var i=0;i<zd1td.length;i++){zd1td[i].innerHTML="&nbsp;";zd1td[i].dixing="";}
for(var i=0;i<zd2td.length;i++){zd2td[i].innerHTML="&nbsp;";zd2td[i].dixing=""}
zd.difang=[];zd.wofang=[];
zdfenge[1].innerHTML="";zdfenge[2].innerHTML="";
zdfenge[3].innerText="第[ 1 ]回合";
zd.closezdgn();zd.zdzhong=false;zd.jinxingclearout=true
if(zd.smyinyue==true){yinxiao("场景音乐");zd.booszhan=false;zd.smyinyue=false;}
},
fangshou:function(){  //防守
yinxiao("使用");zd.movezt=5;zd.newobj.fangshoudef=round(selwj.def/4);
zd.newobj.fangshoumef=round(selwj.mef/4);
selwj.hp1+=round(selwj.hp2/15);selwj.mp1+=round(selwj.mp2/20);selwj.nu1+=Math.ceil(selwj.nu2/50)+getqianneng("怒火增长加快");gx_rpg();setTimeout(function(){zd.zdjinxing()},100)
},
wupin:function(){  //物品
wpzb.wupin();wp_kuang.style.display='';
}
}
function zd_kuang.onmousedown(){  //容器鼠标单机事件
if(zd.suoding)return zidongimg.style.visibility="hidden";
if(event.button==2){
for(var i=0;i<zd1td.length;i++){zd1td[i].bgColor="";zd2td[i].bgColor="";}
zd.movezt=0;zd.showzdgn()
}
if(event.button!=1)return;
var obj=event.srcElement

if(zd.movezt==1){zd.youbiao=0  //确认了攻击对象
for(var i=0;i<zd1td.length;i++){
zd.tds[i]=null  //主角的攻击范围
if(zd1td[i].bgColor!=""&&zd1td[i].getElementsByTagName("IMG").length!=0){
zd1td[i].bgColor="";zd.tds[zd.youbiao]=zd1td[i].getElementsByTagName("IMG")[0];zd.youbiao++}
}
if(zd.youbiao==0)return gdtext(event.x,event.y,"没有攻击目标")
zd.zdjinxing()
}else if(zd.movezt==4){  //确认了移动位置
var temp1=0
for(var i=0;i<zd2td.length;i++){
if(zd2td[i].bgColor!=""&&zd2td[i].getElementsByTagName("IMG").length==0){
zd2td[i].bgColor="";zd.ydmubiaotd=zd2td[i];zd.zdyidong=i;temp1++;break;}
}
if(temp1==0)return gdtext(event.x,event.y,"位置已被队友占据")
if(zd.newobj.parentElement.dixing=="止")return gdtext(event.x,event.y,"强制固定:当前所在邪恶地形限制主动移动")
zd.zdjinxing()
}else if(zd.movezt==2||zd.movezt==3){  //确认释放技能或物品
var zhendui="对我";for(var i=0;i<zd1td.length;i++){if(zd1td[i].bgColor!=""){zhendui="对敌";break;}}
var getuse=zd.movezt==2?zd.jnobj1.getAttribute("use"):zd.usewp1.getAttribute("zduse");
if(getuse!=zhendui)return gdtext(event.x,event.y,"错误的技能释放[阵营]")
zd.youbiao=0;
for(var i=0;i<zd1td.length;i++){zd.tds[i]=null
if(zd1td[i].bgColor!=""&&zd1td[i].getElementsByTagName("IMG").length!=0){
zd.tds[zd.youbiao]=zd1td[i].getElementsByTagName("IMG")[0];zd.youbiao++}
if(zd2td[i].bgColor!=""&&zd2td[i].getElementsByTagName("IMG").length!=0){
zd.tds[zd.youbiao]=zd2td[i].getElementsByTagName("IMG")[0];zd.youbiao++}
}
if(zd.youbiao==0)return gdtext(event.x,event.y,"范围内无目标")

if(obj.parentElement.tagName=="TD")obj=obj.parentElement
if(zd.movezt==2){
if(zd.jnobj1.getAttribute("sd")=="自身"){
if(obj.getElementsByTagName("IMG").length==0)return gdtext(event.x,event.y,"必须以自身为中心发动此技")
if(obj.getElementsByTagName("IMG")[0]!=zd.newobj)return gdtext(event.x,event.y,"必须以自身为中心发动此技")
}
if(zd.jnobj1.getAttribute("sd")=="单位"&&obj.getElementsByTagName("IMG").length==0)return gdtext(event.x,event.y,"发动此技中心处必须是一个战斗单位")
if(zd.jnobj1.getAttribute("n")=="销声匿迹"&&zd.booszhan)return gdtext(event.x,event.y,"BOSS开始嘲弄你:想用这招逃跑？不行！")
if(zd.jnobj1.getAttribute("yici")!=null&&zd.yicijn.indexOf(zd.jnobj1.getAttribute("n"))!=-1)return gdtext(event.x,event.y,"超必杀技【"+zd.jnobj1.getAttribute("n")+"】每战只能释放一回！")
if(zd.jnobj1.getAttribute("n")=="神说俺样最强"){
if(selwj!=wj[0])return gdtext(event.x,event.y,"此技只有主角你自己能发动！");
if(rpg.yuanling<9999)return gdtext(event.x,event.y,"元灵已不足,发动此技需消耗9999元灵！");rpg.yuanling-=9999;
}
}

if(zd.movezt==3&&(zd.newobj.parentElement.dixing=="断"||getzt(me,"物品封印")!=null))return gdtext(event.x,event.y,"当前地形或邪恶状态限制使用物品")
if(zd.movezt==3){var obj2=obj.getElementsByTagName("IMG")[0]
if(obj.getElementsByTagName("IMG").length>0){
if(zd.usewp2.xml_name.indexOf("还魂草")!=-1){if(obj2.siwang!=true)return gdtext(event.x,event.y,"此物只能对濒死队友使用!");}else{if(obj2.siwang==true)return gdtext(event.x,event.y,"此物无法对濒死队友使用!");}
}
if(zd.usewp2.xml_name.indexOf("俘获绳")!=-1){
if(getzt(obj2,"不屈",true)!=null)return gdtext(event.x,event.y,"目标宁死不屈,无法俘获");
if(getzt(obj2,"重生",true)!=null)return gdtext(event.x,event.y,"目标尚未重生,无法俘获");
if(obj2.slv>wj[0].lv2)return gdtext(event.x,event.y,"目标级别"+obj2.slv+"高于主角才能界限"+wj[0].lv2+",无法俘获");
if(round(obj2.shp1/(obj2.shp2/100))>10)return gdtext(event.x,event.y,"敌人生命"+round(obj2.shp1/(obj2.shp2/100))+"%大于>10%,暂无法俘获");
if(wjjs.kexing(obj2.sname)==false)return gdtext(event.x,event.y,"武将满员(情商),或存在一样的武将,无法俘获");
if(hzqo.value=="合战"&&(obj2.sboos=="神魔级"||obj2.sboos=="神说级"||obj2.sboos=="神葩级"))return gdtext(event.x,event.y,"单挑/总决战模式下,才能俘获神魔/神说/神葩级Boss!")
}}


zd.zhongxin=obj;zd.closezdgn();
for(var i=0;i<zd1td.length;i++){zd1td[i].bgColor="";zd2td[i].bgColor=""}
zd.zdjinxing()
}
}
function zd_kuang.onmousemove(){  //容器鼠标移动事件
zd.cdx=event.x;zd.cdy=event.y
if(zd.suoding)return; 
 //if(zd.movezt==0)zd_kuang.style.backgroundPosition=(-(zd.cdx/4))+' '+(-(zd.cdy/4))  //这里是movezt=0时的简易战场背景卷动
var obj=event.srcElement
if(zd_kuang.fanweitd==obj)return;zd_kuang.fanweitd=obj;
if(zd.movezt==1||zd.movezt==6){
if(obj.id=="zd1td"){obj.bgColor="blue";obj.onmouseout=function(){this.bgColor=""}}
else if(obj.parentElement.id=="zd1td"){obj.parentElement.bgColor="blue";
obj.parentElement.onmouseout=function(){this.bgColor=""}}
}else if(zd.movezt==4){  //战场移动
if(obj.id=="zd2td"){obj.bgColor="red";obj.onmouseout=function(){this.bgColor=""}}
else if(obj.parentElement.id=="zd2td"){obj.parentElement.bgColor="red";
obj.parentElement.onmouseout=function(){this.bgColor=""}}
}else if(zd.movezt==2||zd.movezt==3){  //技能与物品执行目标搜寻
var tobj=null,alllen=zd1td.length,thenum=0,col1="purple",col2="orange"
if(zd.movezt==3)col1="green";
if(obj.id=="zd1td"||obj.id=="zd2td")tobj=obj
if(obj.parentElement.id=="zd1td"||obj.parentElement.id=="zd2td")tobj=obj.parentElement
if(tobj==null)return;
for(var i=0;i<alllen;i++){
if(zd1td[i]==tobj){thenum=i;tobj=zd1td;break;}
if(zd2td[i]==tobj){thenum=i;tobj=zd2td;break;}
}for(var i=0;i<tobj.length;i++){zd1td[i].bgColor="";zd2td[i].bgColor="";}
fwshuchu(zd.jnwpfanwei,thenum,tobj,col1,col2,alllen)
if(zd.movezt==2){  //是技能
if(zd.jnobj1.getAttribute("sd")=="随意")tobj[thenum].bgColor=col1;else tobj[thenum].bgColor=col2;
}else{tobj[thenum].bgColor=col1}; //是物品
}
}
function fwshuchu(fwname,thenum,tobj,col1,col2,alllen){  //范围表现化
var t7=7;if(fwname=="小十字"){
(thenum+1)%t7==0?"":tobj[thenum+1].bgColor=col1;
if(thenum-1>-1){(thenum)%t7==0?"":tobj[thenum-1].bgColor=col1;}
if(thenum-t7>-1){tobj[thenum-t7].bgColor=col1;}
if(thenum+t7<alllen){tobj[thenum+t7].bgColor=col1;}
}else if(fwname=="九宫阵"){
try{(thenum+1)%t7==0?"":tobj[thenum+1].bgColor=col1; //右
if(thenum-1>-1){(thenum)%t7==0?"":tobj[thenum-1].bgColor=col1;} //左
if(thenum-t7>-1){tobj[thenum-t7].bgColor=col1;  //上
if((thenum-6)%t7!=0)tobj[thenum-6].bgColor=col1;  //右上
if((thenum-7)%t7!=0)tobj[thenum-8].bgColor=col1;}  //左上
if(thenum+t7<alllen){tobj[thenum+t7].bgColor=col1; //下
if((thenum+7)%t7!=0)tobj[thenum+6].bgColor=col1; //左下
if((thenum+8)%t7!=0)tobj[thenum+8].bgColor=col1;}  //右下
}catch(e){return "try捷径"}
}else if(fwname=="放射"){
try{if(thenum-t7>-1){if((thenum-6)%t7!=0)tobj[thenum-6].bgColor=col1;  //右上
if((thenum-7)%t7!=0)tobj[thenum-8].bgColor=col1;}  //左上
if(thenum+t7<alllen){
if((thenum+7)%t7!=0)tobj[thenum+6].bgColor=col1; //左下
if((thenum+8)%t7!=0)tobj[thenum+8].bgColor=col1;}  //右下
}catch(e){return "try捷径"}
}else if(fwname=="横队"){
try{var tempnum=Math.floor(thenum/t7)
for(var i=tempnum*t7;i<tempnum*t7+t7;i++)tobj[i].bgColor=col1
for(var i=tempnum*t7-t7;i<tempnum*t7;i++)tobj[i].bgColor=col1
}catch(e){return "try捷径"}
}else if(fwname=="辐射"){
try{if((thenum+1)%t7!=0){tobj[thenum+1].bgColor=col1;if((thenum+2)%t7!=0)tobj[thenum+2].bgColor=col1;}  //右2
if(thenum-1>-1&&(thenum)%t7!=0){tobj[thenum-1].bgColor=col1;if((thenum-1)%t7!=0)tobj[thenum-2].bgColor=col1;}
if(thenum-t7>-1){tobj[thenum-t7].bgColor=col1;
if((thenum-6)%t7!=0)tobj[thenum-6].bgColor=col1;
if((thenum-7)%t7!=0)tobj[thenum-8].bgColor=col1;}
if(thenum+t7<alllen){tobj[thenum+t7].bgColor=col1;
if((thenum+7)%t7!=0)tobj[thenum+6].bgColor=col1;
if((thenum+8)%t7!=0)tobj[thenum+8].bgColor=col1;}
if(thenum-(t7*2)>-1){tobj[thenum-(t7*2)].bgColor=col1;}  //上2
if(thenum+(t7*2)<alllen){tobj[thenum+(t7*2)].bgColor=col1;}  //下2
}catch(e){return "try捷径"}
}else if(fwname=="中十字"){
try{if((thenum+1)%t7!=0){tobj[thenum+1].bgColor=col1;if((thenum+2)%t7!=0)tobj[thenum+2].bgColor=col1;}  //右2
if(thenum-1>-1&&(thenum)%t7!=0){tobj[thenum-1].bgColor=col1;if((thenum-1)%t7!=0)tobj[thenum-2].bgColor=col1;}
if(thenum-t7>-1){tobj[thenum-t7].bgColor=col1;}
if(thenum+t7<alllen){tobj[thenum+t7].bgColor=col1;}
if(thenum-(t7*2)>-1){tobj[thenum-(t7*2)].bgColor=col1;}  //上2
if(thenum+(t7*2)<alllen){tobj[thenum+(t7*2)].bgColor=col1;}  //下2
}catch(e){return "try捷径"}
}else if(fwname=="横向"){
var tempnum=Math.floor(thenum/t7)
for(var i=tempnum*t7;i<tempnum*t7+t7;i++)tobj[i].bgColor=col1
}else if(fwname=="竖向"){
var templie=alllen/t7,tempnum=Math.floor(thenum%t7)
for(var i=tempnum;i<alllen;i+=t7)tobj[i].bgColor=col1
}else if(fwname=="竖队"){
try{var templie=alllen/t7,tempnum=Math.floor(thenum%t7)
for(var i=tempnum;i<alllen;i+=t7)tobj[i].bgColor=col1
if(tempnum!=6)for(var i=tempnum+1;i<alllen;i+=t7)tobj[i].bgColor=col1
for(var i=tempnum-1;i<alllen;i+=t7)tobj[i].bgColor=col1
}catch(e){return "try捷径"}
}else if(fwname=="大十字"){
var tempnum=Math.floor(thenum/t7)
for(var i=tempnum*t7;i<tempnum*t7+t7;i++)tobj[i].bgColor=col1
var templie=alllen/t7,tempnum=Math.floor(thenum%t7)
for(var i=tempnum;i<alllen;i+=t7)tobj[i].bgColor=col1
}else if(fwname=="单体"){
tobj[thenum].bgColor=col1;
}else if(fwname=="全体"){
for(var i=0;i<alllen;i++)tobj[i].bgColor=col1
}else if(fwname=="我方"){}else if(fwname=="成员召唤"){
var temp1=-1;while(temp1==-1){
var temp2=round(random()*(alllen-1))
if(tobj[temp2].getElementsByTagName("IMG").length!=0)continue;
temp1=0;tobj[temp2].bgColor=col1;
}
}}
function zdhelp(zhixing,usejnorwp){  //战斗提示信息
try{
var temobj=zd.newobj.getElementsByTagName("IMG")[0],hptext="";
var czobj=zdfenge[2],xdcs=0;if(temobj.id=="zdgw"){
zd.xingdongcishu2++;xdcs=zd.xingdongcishu2
}else{zd.xingdongcishu1++;xdcs=zd.xingdongcishu1;czobj=zdfenge[1]}

switch(zhixing){
case "攻击":hptext="开始殴打";break;case "魔攻":hptext="使用最基础的魔法攻击";break;case "逃跑":hptext="试图逃跑";break;
case "技能":hptext="发动了魔法技能="+usejnorwp;break;case "防御":hptext="执行防御待机";break;
case "移动":hptext="调整了战场位置";break;case "物品":hptext="使用物品="+usejnorwp;break;
case "发呆":hptext="呆呆的在想心中的她/他,HP恢复4%";break;case "阻塞":hptext="程序内存指针出现异常,强制进行";break;
case "濒死":hptext="真是不堪一击！(提示:味方全灭,请决定撤退或投降)";break;
default:hptext=zhixing;break;
}
lt.zd(temobj,zhixing,usejnorwp);
var jiaqiangtext="";if(temobj.sjiaqiang!=null){
if(parseInt(temobj.sjiaqiang)==1)jiaqiangtext="+1强悍的"
if(parseInt(temobj.sjiaqiang)==2)jiaqiangtext="+2愤怒的"
if(parseInt(temobj.sjiaqiang)==3)jiaqiangtext="+3发疯的"
if(parseInt(temobj.sjiaqiang)==4)jiaqiangtext="+4变态的"
jiaqiangtext="<font style='color:blue'>"+jiaqiangtext+"</font>"
}
czobj.innerHTML="<font>["+xdcs+"]"+temobj.sname+jiaqiangtext+":"+hptext+"</font>";
}catch(e){}
}