var wjjs={  //武将脚本库
dhopen:function(){var tempname="",temp1="";  //开启掉换框
for(var i=1;i<wj.length;i++){
wj[i].name!=""?tempname=wj[i].xingbie+":"+wj[i].name:tempname=":不可用";
temp1+="<option num="+i+">"+i+"#"+tempname;
}
dh.lihui("wanhua.gif");sd_sd=true;diaohuan1.outerHTML='<select id="diaohuan1" onchange="wjjs.dhselchange()" onmousemove="showtmk(\'此处建议选你最喜爱的低能力尤物武将\')">'+temp1+'</select>';
diaohuan2.outerHTML='<select id="diaohuan2" onchange="wjjs.dhselchange()" onmousemove="showtmk(\'此处建议选爆强的实力派武将\')">'+temp1+'</select>';
diaohuan1.selected=0;diaohuan2.selected=1;wjjs.dhselchange();
diaohuan_kuang.style.display="";
},
dhselchange:function(){  //调换下拉框改变
diaohuantext1.innerText=diaohuan1.options[diaohuan1.selectedIndex].text;
diaohuantext2.innerText=diaohuan2.options[diaohuan2.selectedIndex].text;
diaohuanimg[0].src=wj[diaohuan1.selectedIndex+1].name==""?"img/ico/wenhao.gif":wj[diaohuan1.selectedIndex+1].src;
diaohuanimg[1].src=wj[diaohuan2.selectedIndex+1].name==""?"img/ico/wenhao.gif":wj[diaohuan2.selectedIndex+1].src;
},
dhbegin:function(){  //开始掉换
if(wj[diaohuan1.selectedIndex+1].name=="")return gdtext(event.x,event.y,"武将1不可用");
if(wj[diaohuan2.selectedIndex+1].name=="")return gdtext(event.x,event.y,"武将2不可用");
if(wj[diaohuan1.selectedIndex+1].xingbie!=wj[diaohuan2.selectedIndex+1].xingbie)return gdtext(event.x,event.y,"两位武将性别不同！");
if(wj[diaohuan1.selectedIndex+1].haogan<rpg.qingshang)return gdtext(event.x,event.y,"武将1的好感度未达到情商极限！");
if(wj[diaohuan2.selectedIndex+1].haogan>15)return gdtext(event.x,event.y,"武将2的好感度超过了15点！");
var tempchengdu=wj[diaohuan1.selectedIndex+1].chengdu,tempchengdu2=wj[diaohuan2.selectedIndex+1].chengdu;
if(tempchengdu=="神葩级"||tempchengdu2=="神葩级")return gdtext(event.x,event.y,"神葩终极人物,无法参与本服务！")
if(rpg.hj<3)return gdtext(event.x,event.y,"你没有3两黄金支付费用！");
if(rpg.glod<20000)return gdtext(event.x,event.y,"你没有20000元补偿武将2的能力借用费！");
if(rpg.yuanling<15000)return gdtext(event.x,event.y,"你没有15000元灵恢复武将2的身体损失！");
if(!confirm("完全符合条件了,请最后确认您决定要这么做！？"))return;
diaohuanbutton.disabled=true;diaohuan1.style.visibility="hidden";diaohuan2.style.visibility="hidden"
return loading("正在进行按摩",1,diaohuanbutton,"掉换",30,1);
},
dhend:function(){  //掉换完成
var obj1=wj[diaohuan1.selectedIndex+1],obj2=wj[diaohuan2.selectedIndex+1],objold=[];
var theshuxing="lv,lv2,hp1,hp2,mp1,mp2,nu1,nu2,act1,act2,mct1,mct2,def,mef,jingque,shanbi,sudu,baoji,yili,exp1,exp2,chengdu".split(",")
for(var i=0;i<theshuxing.length;i++){
eval("objold[i]=obj1."+theshuxing[i]+";obj1."+theshuxing[i]+"=obj2."+theshuxing[i]+";obj2."+theshuxing[i]+"=objold[i]");
}
diaohuanbutton.disabled=false;diaohuan1.style.visibility="visible";diaohuan2.style.visibility="visible";rpg.hj-=3;rpg.glod-=20000;rpg.yuanling-=15000;
lt.help(wj[diaohuan1.selectedIndex+1].name+" 与 "+wj[diaohuan2.selectedIndex+1].name+" 的能力值掉换成功!");
if(zt_kuang.style.display!="none")tbzt.zhuangtai();
},
peiyang:function(whats,value1){
if(zd.zdzhong)return alert("战斗中不能进行！");
if(diaohuan_kuang.style.display!="none")return alert("掉换操控中不能进行！");
if(whats!="虐待"&&whats!="sex"&&whats!="吵架"&&selwj.haogan>=rpg.qingshang)return lt.help("该武将好感度已达极限！必须提高主角情商才能继续！");
if(!confirm("确定要执行["+whats+"]命令吗？"))return;
dh.close();dh.npc=new Object;dh.npc.src=selwj.src;dh.npc.sname=selwj.yuanming;
msg.names=selwj.name;msg.face1=selwj.src.replace("img/","");
if(whats!="训练"&&whats!="给钱"){if(wpzb.findwp("wp",value1)<1)return gdtext(event.x,event.y,"缺少必须物品,无法执行");wp_add("wp",value1,-1);wpzb.wupin();}
switch(whats){
case "吃喝":msg.jq="peiyang1";selwj.lv2+=1;break;
case "送礼":msg.jq="peiyang2";selwj.sudu+=4;break;
case "训练":msg.jq="peiyang3";
if(rpg.yuanling<value1)return gdtext(event.x,event.y,"元灵不足，无法执行");
rpg.yuanling-=value1;selwj.nu2+=4;
break;
case "给钱":msg.jq="peiyang4";
if(rpg.glod<value1)return gdtext(event.x,event.y,"金钱不足，无法执行");
rpg.glod-=value1;selwj.mp2+=20;
break;
case "恶搞":msg.jq="peiyang6";selwj.hp2+=15;break;
case "偷窥":msg.jq="peiyang14";selwj.jingque+=2;break;
case "虐待":msg.jq="peiyang5";selwj.shanbi+=2;break;
case "游玩":msg.jq="peiyang7";selwj.def+=8;break;
case "吹牛":msg.jq="peiyang8";selwj.act1+=9;selwj.act2+=9;selwj.mct1+=9;selwj.mct2+=9;break;
case "哄哄":msg.jq="peiyang9";selwj.mef+=10;break;
case "勾引":msg.jq="peiyang10";selwj.yili+=1;break;
case "接吻":msg.jq="peiyang11";selwj.baoji+=1;break;
case "sex":msg.jq="peiyang12";selwj.lv2+=1;break;
case "吵架":msg.jq="peiyang13";selwj.nu2+=3;break;
}
if(whats=="虐待"||whats=="吵架"){selwj.haogan-=1;selwj.lv2-=1;}else if(whats=="sex"){}else{selwj.haogan+=1;selwj.lv2+=1;}
tbzt.zhuangtai();gx_rpg();dh.showmsg()
},
shuaxin:function(){wjimg[0].src=wj[0].xingbie=="男性"?"img/touxiang/3.gif":"img/touxiang/4.gif";  //武将刷新
wjimg[0].name2=wj[0].name;var tempshu=1;
for(var i=1;i<wjimg.length;i++){wjimg[i].num=i;
if(wj[i].name==""){wjimg[i].src="img/ico/touming.gif";wjimg[i].name2=""}
else{wjimg[i].src=wj[i].src;wjimg[i].name2=wj[i].name;tempshu++;}
}
tempshu>1?me2.style.display="":me2.style.display="none";
if(tempshu>2){me3.style.display="";var rnd1=Math.ceil(random()*(wj.length-1))
while(wj[rnd1].name==""){rnd1=Math.ceil(random()*(wj.length-1));}
me3.style.width=null;me3.style.height=null;
me3.src=wj[rnd1].src;setTimeout(function(){if(me3.offsetWidth>200)me3.style.width=200;if(me3.offsetHeight>200)me3.style.height=200},50)
return;}
me3.style.display="none";
},
kexing:function(findname){var kexing2="no"   //判断满员
for(var i=0;i<wj.length;i++){if(wj[i].name==""){kexing2=i;break;}}
if(kexing2=="no"){lt.help("无法实现:武将人满为患,必须解雇一个武将,留出空位!");return false}
for(var i=0;i<wj.length;i++){if(wj[i].yuanming=="")continue;
if(wj[i].yuanming==findname){lt.help("无法实现:身份重复,该武将已存在!");return false}
}
var temprenshu=0;for(var i=1;i<wj.length;i++){if(wj[i].name!="")temprenshu++;}
if(temprenshu>=Math.floor(rpg.qingshang/5)){lt.help("主角情商过低,第["+(temprenshu+1)+"]名武将无法加入");return false}
return true
},
add:function(wjname,thelv){if(wjjs.kexing(wjname)==false)return false;
var gobj=shouce.guainl(wjname,"不极限加成");
 //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<wj.length;i++){if(wj[i].name!="")continue;
wj[i].name=wjname;wj[i].yuanming=wjname;
wj[i].xingbie="魔物";if(gobj.sheng!=null)wj[i].xingbie=gobj.sheng
wj[i].src="img/gw/"+gobj.src;
var guaishe1=parseFloat(xml.getpz("怪设","生命"));gobj.slv=thelv==null?parseInt(gobj.slv):parseInt(thelv);
wj[i].hp2=gobj.slv*guaishe1;wj[i].mp2=gobj.slv*2;wj[i].nu2=parseInt(gobj.slv);
switch(gobj.sboos){
case "经典级":wj[i].hp2*=1.4;wj[i].mp2*=1.5;wj[i].nu2+=10;break;
case "帝王级":wj[i].hp2*=1.8;wj[i].mp2*=2;wj[i].nu2+=20;break;
case "传说级":wj[i].hp2*=2.2;wj[i].mp2*=2.5;wj[i].nu2+=30;break;
case "神魔级":wj[i].hp2*=2.6;wj[i].mp2*=3;wj[i].nu2+=40;break;
case "神说级":wj[i].hp2*=2.9;wj[i].mp2*=3.5;wj[i].nu2+=50;break;
case "神葩级":wj[i].hp2*=3.2;wj[i].mp2*=4;wj[i].nu2+=60;break;
}
wj[i].hp2=round(wj[i].hp2);wj[i].hp1=wj[i].hp2;wj[i].lv=gobj.slv;
wj[i].mp2=round(wj[i].mp2);wj[i].mp1=wj[i].mp2;wj[i].nu1=0;
wj[i].act1=gobj.sact1;wj[i].act2=gobj.sact2;wj[i].mct1=gobj.smct1;wj[i].mct2=gobj.smct2;wj[i].def=gobj.sdef;
wj[i].mef=gobj.smef;wj[i].jingque=gobj.sjq;wj[i].shanbi=gobj.ssb;wj[i].sudu=gobj.ssu;
wj[i].baoji=gobj.sbj;wj[i].exp1=0;wj[i].exp2=gobj.slv*gobj.slv*10;wj[i].yili=round(gobj.syili);
wj[i].haogan=5+round(random()*5);wj[i].chengdu=gobj.sboos==null?"普通":gobj.sboos;wj[i].lv2=gobj.slv+wj[i].haogan;
break;
}
yinxiao("俘获成功");wjjs.shuaxin();me3.src=wj[i].src;shouce.getkill(wjname,1);
if(wjname=="莉莉丝")showshige("神说:第一章 嬉戏")
if(wjname=="月魔莉莉斯")setTimeout('showshige("神说:第六章 抗争")',2000);
},
del:function(){
if(zd.zdzhong)return gdtext(event.x,event.y,"战斗进行时无法解雇！");if(selwj==wj[0])return gdtext(event.x,event.y,"纳尼,解雇自己?禁止自残自杀^-^");
if(diaohuan_kuang.style.display!="none")return gdtext(event.x,event.y,"掉换操作中无法解雇！");
if(selwj.yuanming=="露露"&&shouce.findrw("逆推灰天")==0){return gdtext(event.x,event.y,"只有完成[逆推灰天]任务后,方可解雇露露！");}
var temp1=(selwj.lv*20)+(wj[0].lv*20);if(!confirm("你确定要跟 "+selwj.name+" 劳燕分飞了吗?你将付出 "+temp1+" 元\n\n如果钱不够,将扣除你20点名望\n\n请你最终确认你是否要这么做,事后不要后悔呦！"))return;
if(rpg.glod<temp1)rpg.mingwang-=20;else rpg.glod-=temp1;
var oldwjname=selwj.name;selwj.name="";selwj.yuanming="";wjjs.shuaxin();selwj=wj[0];gx_rpg();zt_kuang.style.display="none";
lt.help(wj[0].name+" 最终选择跟 "+oldwjname+" 分开了！");
}
}