var jn={
oldjnlei:0,
find:function(findname){  //技能查找,返回存储位置+学习级别
for(var i=0;i<rpg.jn.length;i++){if(rpg.jn[i]==null)continue;
var rpgjn1=rpg.jn[i].split("=")[0],rpgjn2=rpg.jn[i].split("=")[1]
if(rpgjn1==findname||rpgjn1=="真·"+findname){var temp1=i+","+rpgjn2;return temp1.split(",")}
}
return false
},
addjn:function(addname,addlv){  //学新技能
var weizhi=-1,find1=jn.find(addname.replace("真·",""))
if(find1!=false)weizhi=find1[0]
if(weizhi==-1){for(var i=0;i<rpg.jn.length;i++){  //以往无此技能
if(rpg.jn[i]==null){weizhi=i;break;}
}if(weizhi==-1)weizhi=rpg.jn.length}
rpg.jn[weizhi]=addname+"="+addlv;
},
getcol:function(leiname){switch(leiname){   //getcolor
case "武学系":return "red";break;case "魔攻系":return "purple";break;
case "祝福系":return "blue";break;case "军师系":return "#996102";break;
case "神说系":return "green";break;case "魔物系":return "gray";break;
}},
show:function(jnleinum){  //主角技能框显示
var thevalue=jnlei[jnleinum].value;jn.oldjnlei=jnleinum
for(var i=0;i<jnlei.length;i++){jnlei[i].style.border="2 solid white"}
jnlei[jnleinum].style.border="2 solid red"
var tempyoubiao=0
for(var i=0;i<jnlie.length;i++){jnlie[i].innerHTML="无";jnlie[i].style.color=jn.getcol(thevalue);jnlie[i].obj1=null;jnlie[i].obj2=null;jnlie[i].jnname="";}
for(var i=0;i<rpg.jn.length;i++){if(rpg.jn[i]==null)continue;var temprpg=rpg.jn[i].split("=")
/*
if(temprpg[0].indexOf("真·")==0){for(var j=0;j<tempyoubiao;j++){
if(temprpg[0].indexOf(jnlie[j].jnname)==2){jnlie[j].innerHTML=jnlie[j].innerHTML.replace(jnlie[j].jnname,temprpg[0]);jnlie[j].jnname=temprpg[0];}
}continue;}  //end 真
*/
var tempjn=xml.getjn(temprpg[0].replace("真·",""))
if(tempjn.getAttribute("lei")!=thevalue)continue;
jnlie[tempyoubiao].innerHTML="<img src='img/jn/"+tempjn.getAttribute("src")+"' style='height:100%;left:2;'>"+temprpg[0]
jnlie[tempyoubiao].obj1=tempjn;jnlie[tempyoubiao].obj2=temprpg[1]-1;jnlie[tempyoubiao].jnname=temprpg[0]
tempyoubiao++
}

if(jn_kuang.style.display=="none"&&zd.zdzhong==false&&tbfun.lr==false)tbfun.begin()
try{if(jn_kuang.style.display=="none"){jn_kuang.style.left=event.x-40;jn_kuang.style.top=event.y-50}}catch(e){}
jn_kuang.style.display="";
},
jieduwpjn:function(theshu){  //解毒物品、技能功能
var num=0;for(var i=8;i<ztimg.length;i++){if(me.szt[i]!=""){num=i;break;}}
if(num==0){temp1="未被诅咒/或不利状态,使用无效"}else{temp1="不利状态解除,身体恢复健康!";
for(var i=8;i<ztimg.length;i++){if(me.szt[i]!=""&&--theshu>-1){me.szt[i]="";clearInterval(ztimg[i].go);ztimg[i].style.display="none";}}
}return temp1;
},
use:function(jnobj1,jnobj2){  //技能使用
if(jnobj1.getAttribute("sd")=="天赋")return gdtext(event.x,event.y,"该技已强化了你的能力,无需使用");
var usemp=parseInt(jnobj2.getAttribute("mp")),usenu=parseInt(jnobj2.getAttribute("nu"));
if(jnobj2.getAttribute("nu")!=null&&jnobj2.getAttribute("nu").toLowerCase()=="max"){usenu=selwj.nu2;if(usenu<50)usenu=50}
if(jn.find("真·"+jnobj1.getAttribute("n"))!=false){usemp*=2}

if(!isNaN(usenu)&&selwj.nu1<usenu)return gdtext(event.x,event.y,"你的怒火不够旺盛,无法发动此技")
if(zd.zdzhong){
if(zd.newobj.parentElement.dixing=="封"||getzt(me,"技能封印")!=null)return gdtext(event.x,event.y,"封印:技能被封,暂时无法使用")
if(zd.newobj.parentElement.dixing=="法"){
if(round(usemp*0.5)>selwj.mp1)return gdtext(event.x,event.y,"你的MP不足,无法使用此技能")
}else{if(usemp>selwj.mp1)return gdtext(event.x,event.y,"你的MP不足,无法使用此技能")
}
jn_kuang.style.display="none";
zd.movezt=2;zd.jnwpfanwei=jnobj2.getAttribute("fe");zd.jnobj1=jnobj1;zd.jnobj2=jnobj2;zd.closezdgn();
}else{  //非战斗中
if(usemp>selwj.mp1)return gdtext(event.x,event.y,"你的MP不足,无法使用此技能")
if(usenu!=null&&selwj.nu1<usenu)return gdtext(event.x,event.y,"你的怒火不够旺盛,无法发动此技");
jn.usexiaoguo(jnobj1,jnobj2,selwj)
}
},
usexiaoguo:function(jnobj1,jnobj2,mubiao,nousempnu){  //战场+场景全能使用技能效果
var useweili=parseInt(jnobj2.getAttribute("wl")),usenu=jnobj2.getAttribute("nu"),jnname=jnobj1.getAttribute("n"),miao=jnobj2.getAttribute("miao")
var usemp=parseInt(jnobj2.getAttribute("mp")),thejq=jnobj2.getAttribute("jq")
if(jn.find("真·"+jnname)!=false){usemp*=2;useweili*=2;thejq=round(thejq*1.5)}
var returntxt="";if(!zd.zdzhong&&jnobj1.getAttribute("changjing")!=null)yinxiao(jnobj1.getAttribute("sound1"));
switch(jnname){
case "治愈术":
if(zd.zdzhong){if(mubiao.siwang==true){returntxt="0(濒死无效)";break;}}
returntxt=parseInt(useweili+(rpg.dian[2]*2));
if(mubiao==selwj){selwj.hp1+=returntxt}else{wj[mubiao.num].hp1+=returntxt;}break;
case "解毒术":var temp1=jn.jieduwpjn(useweili);
if(temp1.indexOf("使用无效")!=-1)return lt.help(temp1)
lt.help(temp1);break;
case "集气法":mubiao.hp1+=round(mubiao.hp2/100*useweili);mubiao.mp1+=round(mubiao.mp2/100*useweili);jn.jieduwpjn(1);returntxt="目标生命/魔法/状态恢复"+useweili;break;
case "天赐甘霖":addzt(me,jnname,useweili,miao);break;
case "伤痛减轻":addzt(me,jnname,useweili+"%",miao);break;
case "进攻战术":addzt(me,"伤害加深",useweili+"%",miao);addzt(me,"麻痹击晕",thejq+"%",miao);break;
case "血魔附体":addzt(me,"嗜血大法",useweili,miao);addzt(me,"灭魔大法",thejq,miao);break;
case "怒焰狂燃":addzt(me,"伤害加深",useweili+"%",miao);break;
case "圣堂神の祝福":for(var i=0;i<wj.length;i++){if(wj[i].name!="")wj[i].hp1=wj[i].hp2;wj[i].mp1=wj[i].mp2}
if(zd.zdzhong){mubiao.style.filter=null;mubiao.siwang=false;}
jn.jieduwpjn(10)
break;
case "希望之光":if(!zd.zdzhong)return lt.help("该技仅限战斗中使用");if(mubiao.siwang!=true)return "未濒死使用无效";
wj[mubiao.num].hp1+=round(wj[mubiao.num].hp2/100*useweili);wj[mubiao.num].nu1+=useweili;mubiao.style.filter=null;mubiao.siwang=false;
return "重获新生 HP+"+round(wj[mubiao.num].hp2/100*useweili)+" 怒火+"+useweili;
break;
default:if(!zd.zdzhong){lt.help("该技仅限战斗中使用");return;}break;
}
if(!zd.zdzhong&&nousempnu==null){selwj.mp1-=usemp;if(usenu!=null)selwj.nu1-=usenu;gx_rpg();}return returntxt;
}}