◆少前百科是非盈利性、非官方的少女前线维基百科。
◆如果您发现某些内容错误/空缺,请勇于修正/添加!参与进来其实很容易!点这里 加入少前百科
◆有任何意见、建议、纠错,欢迎在 GFwiki:反馈与建议 提出和讨论。编辑事务讨论QQ群:597764980,微博@GFwiki少前百科
◆To foreigners,You can use twitter to contact us.
Icon Nyto Silver.png

更改

跳转至: 导航搜索

Widget:EnemyInfo/js

添加8,816字节2021年1月23日 (六) 17:53
测试
var Enemy_standard_attribute;
var Spot;
var Theater_area;
var Mission;
var Building;
var Team_ai;
var Mission_targettrain_enemy;
var Mission_txt;
var Building_txt;
var Team_ai_txt;
var Mission_targettrain_enemy_txt;
 
var Special_spot_config_txt;
var xmlhttp_Spot = new XMLHttpRequest();
xmlhttp_Spot.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) { Spot = JSON.parse(this.responseText.slice(`{"spot_info":`.length, this.responseText.length - 1)); loadstate ++; }
};
xmlhttp_Spot.open("GET", "http://www.gfwiki.org/images/0/06/StcSpot.txt", true);
var xmlhttp_in_team = new XMLHttpRequest();
xmlhttp_in_team.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) { Enemy_in_team = JSON.parse(this.responseText.slice(`{"enemy_in_team_info":`.length, this.responseText.length - 1)); loadstate ++; }
};
xmlhttp_in_team.open("GET", "http://www.gfwiki.org/images/4/48/StcEnemy_in_team.txt", true);
var xmlhttp_standard_attribute = new XMLHttpRequest();
xmlhttp_standard_attribute.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) { Enemy_standard_attribute = JSON.parse(this.responseText.slice(`{"enemy_standard_attribute_info":`.length, this.responseText.length - 1)); loadstate ++; }
};
xmlhttp_standard_attribute.open("GET", "http://www.gfwiki.org/images/1/13/StcEnemy_standard_attribute.txt", true);
var xmlhttp_team = new XMLHttpRequest();
xmlhttp_team.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) { Enemy_team = JSON.parse(this.responseText.slice(`{"enemy_team_info":`.length, this.responseText.length - 1)); loadstate ++; }
};
xmlhttp_team.open("GET", "http://www.gfwiki.org/images/c/c8/StcEnemy_team.txt", true);
xmlhttp_team.send();
var xmlhttp_Theater_area = new XMLHttpRequest();
xmlhttp_Theater_area.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
Theater_area = JSON.parse(this.responseText.slice(`{"theater_area_info":`.length, this.responseText.length - 1));
loadstate ++; }
};
xmlhttp_Theater_area.open("GET", "http://www.gfwiki.org/images/8/81/StcTheater_area.txt", true);
xmlhttp_Theater_area.send();
var xmlhttp_Building = new XMLHttpRequest();
xmlhttp_Building.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) { Building = JSON.parse(this.responseText.slice(`{"building_info":`.length, this.responseText.length - 1)); loadstate ++; }
};
xmlhttp_Building.open("GET", "http://www.gfwiki.org/images/6/69/StcBuilding.txt", true);
var xmlhttp_Mission = new XMLHttpRequest();
xmlhttp_Mission.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) { Mission = JSON.parse(this.responseText.slice(`{"mission_info":`.length, this.responseText.length - 1)); loadstate ++; }
};
xmlhttp_Mission.open("GET", "http://www.gfwiki.org/images/4/40/StcMission.txt", true);
var xmlhttp_charater_type = new XMLHttpRequest();
xmlhttp_charater_type.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) { Enemy_charater_type = JSON.parse(this.responseText.slice(`{"enemy_character_type_info":`.length, this.responseText.length - 1)); loadstate ++; }
};
xmlhttp_charater_type.open("GET", "http://www.gfwiki.org/images/6/66/StcEnemy_character_type.txt", true);
var xmlhttp_Ally_team = new XMLHttpRequest();
xmlhttp_Ally_team.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) { Ally_team = JSON.parse(this.responseText.slice(`{"ally_team_info":`.length, this.responseText.length - 1)); loadstate ++; }
};
xmlhttp_Ally_team.open("GET", "http://www.gfwiki.org/images/e/e4/StcAlly_team.txt", true);
var xmlhttp_Team_ai = new XMLHttpRequest();
xmlhttp_Team_ai.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
Team_ai = JSON.parse(this.responseText.slice(`{"team_ai_info":`.length, this.responseText.length - 1));
loadstate ++; }
};
xmlhttp_Team_ai.open("GET", "http://www.gfwiki.org/images/b/b7/StcTeam_ai.txt", true);
xmlhttp_Team_ai.send();
 
var xmlhttp_Mission_targettrain_enemy = new XMLHttpRequest();
xmlhttp_Mission_targettrain_enemy.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
Mission_targettrain_enemy = JSON.parse(this.responseText.slice(`{"mission_targettrain_enemy_info":`.length, this.responseText.length - 1));
loadstate ++; }
};
xmlhttp_Mission_targettrain_enemy.open("GET", "http://www.gfwiki.org/images/c/c6/StcMission_targettrain_enemy.txt", true);
xmlhttp_Mission_targettrain_enemy.send();
var xmlhttp_Building_txt = new XMLHttpRequest();
xmlhttp_Building_txt.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) { Building_txt = this.responseText; loadstate ++; }
};
xmlhttp_Building_txt.open("GET", "http://www.gfwiki.org/images/8/8f/Building.txt", true);
var xmlhttp_Mission_txt = new XMLHttpRequest();
xmlhttp_Mission_txt.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) { Mission_txt = this.responseText; loadstate ++; }
};
xmlhttp_Mission_txt.open("GET", "http://www.gfwiki.org/images/c/c7/Mission.txt", true);
var xmlhttp_Enemy_charater_type_txt = new XMLHttpRequest();
xmlhttp_Enemy_charater_type_txt.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) { Enemy_charater_type_txt = this.responseText; loadstate ++; }
};
xmlhttp_Enemy_charater_type_txt.open("GET", "http://www.gfwiki.org/images/4/49/Enemy_character_type.txt", true);
var xmlhttp_Ally_team_txt = new XMLHttpRequest();
xmlhttp_Ally_team_txt.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) { Ally_team_txt = this.responseText; loadstate ++; }
};
xmlhttp_Ally_team_txt.open("GET", "http://www.gfwiki.org/images/0/00/Ally_team.txt", true);
var xmlhttp_Team_ai_txt = new XMLHttpRequest();
xmlhttp_Team_ai_txt.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) { Team_ai_txt = this.responseText; loadstate ++; }
};
xmlhttp_Team_ai_txt.open("GET", "http://www.gfwiki.org/images/f/f5/Team_ai.txt", true);
xmlhttp_Team_ai_txt.send();
 
var xmlhttp_Mission_targettrain_enemy_txt = new XMLHttpRequest();
xmlhttp_Mission_targettrain_enemy_txt.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) { Mission_targettrain_enemy_txt = this.responseText; loadstate ++; }
};
xmlhttp_Mission_targettrain_enemy_txt.open("GET", "http://www.gfwiki.org/images/5/59/Mission_targettrain_enemy.txt", true);
xmlhttp_Mission_targettrain_enemy_txt.send();
var xmlhttp_Special_spot_config_txt = new XMLHttpRequest();
xmlhttp_Special_spot_config_txt.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) { Special_spot_config_txt = this.responseText; loadstate ++; }
};
xmlhttp_Special_spot_config_txt.open("GET", "http://www.gfwiki.org/images/e/ec/Special_spot_config.txt", true);
Team_ai[i].name = namestr;
}
 
for(i in Mission_targettrain_enemy){
var namepos = Mission_targettrain_enemy_txt.indexOf(Mission_targettrain_enemy[i].name);
var namestr = Mission_targettrain_enemy_txt.slice(namepos + Mission_targettrain_enemy[i].name.length + 1, Mission_targettrain_enemy_txt.indexOf("\n", namepos) - 1);
Mission_targettrain_enemy[i].name = namestr;
var despos = Mission_targettrain_enemy_txt.indexOf(Mission_targettrain_enemy[i].des);
var desstr = Mission_targettrain_enemy_txt.slice(despos + Mission_targettrain_enemy[i].des.length + 1, Mission_targettrain_enemy_txt.indexOf("\n", despos) - 1);
Mission_targettrain_enemy[i].des = desstr.replace("//c", ",");
}
}
loadjudge();
function loadjudge(){
$("#loadtips").html("文件加载进度:" + loadstate + " / 1518"); if(loadstate < 1518) setTimeout(function(){loadjudge();}, 100);
else {
trans();
/*-- 下载 sdownload 重置 sredraw 隐藏 smaphide 图例 sexample
敌人 smapenemy 建筑 smapbuild 类型 smaptype 颜色 smapcolor 标号 smapspotn 逻辑 smapenemyai 建筑表格 sbuildtable 传送表格 sporttable 点位标记 sspotsign 同组堆叠 senemypile --*/
var setmessage = {sdownload:0, sredraw:0, smaphide:0, sexample:0, smapenemy:1, smapbuild:1, smaptype:1, smapcolor:1, smapspotn:1, smapenemyai:1, sbuildtable:1, sporttable:1, sspotsign:0, senemypile:0};
<option value="3006">[主线] 魔方行动+</option>
<option value="3010">[主线] 深层映射</option>
<option value="3016">[主线] 塌缩点</option>
<option value="3024">[主线] 有序紊流</option>
<option value="3031">[主线] 异构体</option>
<option value="5042">[支线] 茧中蝶影</option>
<option value="6004">[战区] 第一版</option>
<option value="6005">[战区] 第二版</option>
<option value="6006">[战区] 第三版</option>
 
</select></div>
<div class="eselect"><select id="missionselect" name="missionselect">
$("#missionselect").children().remove();
var thevalue = Number(this.value);
 
/*-- 标靶 --*/
if(Number(thevalue) == 2008){
var logarray = [{name:"定制标靶", filter:"0"}];
for (i in Mission_targettrain_enemy) {
var sign = 1;
for(j in logarray) if(Mission_targettrain_enemy[i].log_fitter_id == logarray[j].filter) sign = 0;
if(sign) logarray.push({name:Mission_targettrain_enemy[i].name, filter:Mission_targettrain_enemy[i].log_fitter_id});
}
for(i in logarray){
var op = document.createElement("OPTION");
op.value = logarray[i].filter;
op.innerHTML = logarray[i].name;
$("#missionselect").append(op);
}
traindisplay();
return;
}
 
else if(Number(thevalue) > 6000 && Number(thevalue) < 7000){
var area = [0, "灰烬山丘", "雷鸣平原", "地狱玄关", "死亡山谷"];
var place = [0, "普通", "普通", "要塞", "普通", "普通", "要塞", "普通", "要塞"];
for(var i = 1; i < 5; i++){
for(var j = 1; j < 9; j++){
var op = document.createElement("OPTION");
op.value = (Number(thevalue) - 6000)*100 + i*10 + j;
op.innerHTML = area[i] + " " + j + " " + place[j];
$("#missionselect").append(op);
}
}
theaterdisplay();
return;
}
/*-- 主线关卡 --*/
else if(Number(thevalue) >= 1000 && Number(thevalue) < 2000){
for (i in Mission) {
if ((Mission[i].campaign == thevalue - 1000) && (Mission[i].if_emergency != 2)) {
/*-- 支线活动 --*/
else if(Number(thevalue) > 5000 && Number(thevalue) < 6000){
for (i in Mission) {
/*-- 去除剧情关卡 --*/
/*-- 地图的显示 --*/
$("#missionselect").change(function(){
if($("#campaignselect").val() == 2008){ traindisplay(); return;}
else if($("#campaignselect").val() >= 6000 && $("#campaignselect").val() < 7000){ theaterdisplay(); return;}
 
mspot = [];
for(i in Spot) if(Spot[i].mission_id == $("#missionselect").val()) mspot.push(Spot[i]);
thisline += nextpack + `<\/td><td width="100px">`;
thisline += nextid + `<\/td><td width="100px">TO<\/td><td width="100px">`;
thisline += "地图 " + mspot[i].map_num + `<\/td><td width="100px">`;
thisline += mspot[i].package + `<\/td><td width="100px">`;
thisline += mspot[i].id + `<\/td><td width="500px"><\/td><\/tr>`;
var existsign = 0;
for(j in telespot) if(nextid == telespot[j].a && Number(mspot[i].id) == telespot[j].b){ existsign = 1; break;}
if(Enemy_charater_type[j]["id"] != enemy_leader) continue;
leader_name = Enemy_charater_type[j]["name"];
}
/*-- enemy组成:enemyout --*/
var enemyout = "";
for(j in Enemy_in_team){
if(Enemy_in_team[j]["enemy_team_id"] != enemy_team_id) continue;
var enemy_character_type_id = Number(Enemy_in_team[j]["enemy_character_type_id"]);
var name;
 
for(var k = 0; k < Enemy_charater_type.length; k++){
if(Enemy_charater_type[k]["id"] != enemy_character_type_id) continue;
name = Enemy_charater_type[k]["name"];
}
 
if(enemyout.indexOf(name) == -1) enemyout += name + "×" + Enemy_in_team[j]["number"] + " ";
else{
var namepos = enemyout.indexOf(name);
var oldnum = enemyout.slice(namepos + name.length + 1, enemyout.indexOf(" ", namepos));
var newnum = Number(oldnum) + Number(Enemy_in_team[j]["number"]);
enemyout = enemyout.replace(name + "×" + oldnum + " ", name + "×" + newnum + " ");
}
}
 
/*-- enemy效能计算 --*/
if(efect == 0){
for(j in Enemy_in_team){
if(Enemy_in_team[j]["enemy_team_id"] != enemy_team_id) continue;
var enemy_character_type_id = Number(Enemy_in_team[j].enemy_character_type_id);
var level = Number(Enemy_in_team[j].level);
var charatype;
for(var k = 0; k < Enemy_charater_type.length; k++){
if(Enemy_charater_type[k]["id"] != enemy_character_type_id) continue;
charatype = Enemy_charater_type[k]; break;
}
var attr_number = Number(Enemy_in_team[j].number);
var attr_pow = enemyattribute(charatype , "pow" , level);
var attr_def_break = enemyattribute(charatype , "def_break" , level);
var attr_rate = enemyattribute(charatype , "rate" , level);
var attr_hit = enemyattribute(charatype , "hit" , level);
var attr_maxlife = enemyattribute(charatype , "maxlife" , level);
var attr_dodge = enemyattribute(charatype , "dodge" , level);
var attr_armor = enemyattribute(charatype , "armor" , level);
var attr_def = enemyattribute(charatype , "def" , level);
var attr_def_percent = Number(Enemy_in_team[j].def_percent);
/*-- 攻击:ceiling:22*扩编数*((pow + def_break*0.85) * rate/50 * hit/(hit+35) +2) --*/
var efect_att = ceiling(22*attr_number*((attr_pow + attr_def_break*0.85) * attr_rate/50 * attr_hit/(attr_hit+35) +2));
/*-- 防御:ceiling:0.25*(maxlife * (35+dodge)/35 * 300/(300-armor) + 100) * (def_max*2-def+1200*2)/(def_max-def+1200) /2 --*/
var efect_def = ceiling(0.25*(bround(attr_number * attr_maxlife) * (35+attr_dodge)/35 * 300/(300-attr_armor) + 100) * (attr_def*2 - attr_def*attr_def_percent/100 + 1200*2)/(attr_def - attr_def*attr_def_percent/100 + 1200) /2);
efect += ceiling(Number(charatype.effect_ratio) * (efect_att + efect_def));
}
}
/*-- 利用数组存储效能数据以优化计算 --*/
spotinfo.push({sename:leader_name, sally:((ally_name) ? ally_name : 0), sefect:((efect== 0) ? efectcal(enemy_team_id) : efect), seai:enemy_ai, sbuild:0});
eteamspot.push(enemy_team_id);
thisline += ((ally_name) ? ally_name : "敌人") + `<\/td><td width="80px">`;
thisline += aioutput + `<\/td><td width="100px">`;
thisline += ((efect == 0) ? efectcal(enemy_team_id) : efect) + `<\/td><td width="490px">`; thisline += enemyout enemyoutcal(enemy_team_id) + `<\/td><td class="cella" width="120px" style="display:table-cell;">`;
thisline += Number(dspot[i]["id"]) + `<\/td><td class="cellb" width="120px" style="display:none;">`;
thisline += "team_num" + `<\/td><td width="34px">`;
coparameter = (x_radio > y_radio) ? x_radio : y_radio;
/*-- 路径点的绘制 --*/ var singlespot = []; con.lineWidth = String(30 / coparameter); con.strokeStyle = "#cecece"; for(i in dspot){ /*-- 路径点的连接 --*/ var routestr = dspot[i].map_route; while(routestr){ var i2n = Number(routestr.slice(0, (routestr.indexOf(",") == -1) ? (routestr.length) : routestr.indexOf(","))); var i2 = -1; for(k in dspot){ if(dspot[k].id == i2n){ i2 = k; break;}} if(dspot[i].route.indexOf(i2n) == -1){ singlespot.push({a1:i, a2:i2}); break;} if(i2 == -1) break;
/*-- 两个路径点的原始坐标 --*/ var x1 = Number(dspot[i].coordinator_x); var x2 = Number(dspot[i2].coordinator_x); var y1 = Number(dspot[i].coordinator_y); var y2 = Number(dspot[i2].coordinator_y);
/*-- 双向路径的绘制 --*/ con.lineWidth = String(coorchange(3, 30)); con.beginPath(); con.moveTo(coorchange(1, x1, x_min), coorchange(2, y1, y_min)); con.lineTo(coorchange(1, x2, x_min), coorchange(2, y2, y_min)); con.stroke();
routestr = (routestr.indexOf(",", j) == -1) ? "" : routestr.slice(routestr.indexOf(",", j) + 1, routestr.length); } } for(i in singlespot){ var x1 = Number(dspot[singlespot[i].a1].coordinator_x); var x2 = Number(dspot[singlespot[i].a2].coordinator_x); var y1 = Number(dspot[singlespot[i].a1].coordinator_y); var y2 = Number(dspot[singlespot[i].a2].coordinator_y);
for(i in singlespot){ var x1 = Number(dspot[singlespot[i].a1].coordinator_x); var x2 = Number(dspot[singlespot[i].a2].coordinator_x); var y1 = Number(dspot[singlespot[i].a1].coordinator_y); var y2 = Number(dspot[singlespot[i].a2].coordinator_y);  con.lineWidth = String(coorchange(3, 32)); con.strokeStyle = "#111111"; con.beginPath(); con.moveTo(coorchange(1, x1, x_min), coorchange(2, y1, y_min)); con.lineTo(coorchange(1, (x1 + x2)/2, x_min), coorchange(2, (y1 + y2)/2, y_min)); con.stroke(); con.lineWidth = String(coorchange(3, 10)); con.strokeStyle = "#cecece"; con.beginPath(); con.moveTo(coorchange(1, x1, x_min), coorchange(2, y1, y_min)); con.lineTo(coorchange(1, (x1 + x2)/2, x_min), coorchange(2, (y1 + y2)/2, y_min)); con.stroke(); }
}
function enemyselectcreattraindisplay(){ /*-- 清空地图 --*/ $("#missiondrawing")[0].getContext("2d").clearRect(0, 0, mapwidth, mapheight); if(setmessage.smaphide == 0) $("#smaphide").click(); if(setmessage.sbuildtable == 1) $("#smaphide").click(); if(setmessage.sporttable == 1) $("#smaphide").click(); if(setmessage.sspotsign == 1) $("#smaphide").click(); if(setmessage.senemypile == 1) $("#smaphide").click();  var output = `<div table id="Missiontable" class="enemydata" style="displaytext-align:center; border:inline1px #f4c430cc solid; background-blockcolor:#111111; paddingmargin:6.5px4px 0px 14px 0px;" cellspacing="1"> <thead style="display:block; background-color:#E0E0E0f4c430; color:black; position"><tr> <th style="width:relative100px; top">编号</th> <th style="width:1px160px;">名称</th> <th style="width:450px;">敌人编号组成</divth> <div classth style="eselectwidth:490px;">描述<select /th> </tr></thead><tbody id="enemyselectMissionbody" namestyle="enemyselectheight:300px; overflow-y:scroll; display:block;">`; for(i in Mission_targettrain_enemy){ if(Mission_targettrain_enemy[i].log_fitter_id != $("#missionselect").val()) continue; var enemy_team_id = Mission_targettrain_enemy[i].enemy_team_id;
for( var i thisline = `<tr class="missionline" style= 0"border-bottom:2px #f4c43033 solid; display:block; i < Enemy_team.lengthcursor:pointer; i++) output += "><option valuetd width=\"100px" >`; thisline + Enemy_team[i].id = enemy_team_id + `<\/td><td width="\160px">" `; thisline + Enemy_team= Mission_targettrain_enemy[i].id name + "`<\/optiontd><td width="450px">`; output thisline += enemyoutcal(enemy_team_id) + `<\/select></divtd> <input typetd width="text480px" id>`; thisline +=Mission_targettrain_enemy[i].des + "enemytext" name="enemytext" style="border:none; padding:10px; background-color:#e0e0e0;"<\/td><\/tr>`";
/*-- 绘制画布 --*/ var drawingoutput output += `<canvas id="enemydrawing" width="4800px" height="300px" style="border:1px #ffffff99 solid;">Your browser does not support the HTML5 canvas tag.</canvas>`thisline; $("#enemyposition").html(drawingoutput);}
$("#enemychosemissionshow").html(output); $("#enemyselect.missionline").changemouseover(function(){ enemydisplay(Number$(this).valuechildren("td").css("background-color", "#f4c43033");
});
$(".missionline").mouseout(function(){ $(this).children("td").css("background-color", ""); }); $(".missionline").click(function(){ $(this).parent().children("tr").css({"background-color":"", "color":""}); $(this).css({"background-color":"#f4c430cc", "color":"black"}); enemydisplay($(this).children("td").eq(0).html()); });} function theaterdisplay(){ /*-- 清空地图 --*/ $("#missiondrawing")[0].getContext("2d").clearRect(0, 0, mapwidth, mapheight); if(setmessage.smaphide == 0) $("#smaphide").click(); if(setmessage.sbuildtable == 1) $("#smaphide").click(); if(setmessage.sporttable == 1) $("#smaphide").click(); if(setmessage.sspotsign == 1) $("#smaphide").click(); if(setmessage.senemypile == 1) $("#smaphide").click();  var output = `<table id="Missiontable" class="enemydata" style="text-align:center; border:1px #f4c430cc solid; background-color:#111111; margin:4px 0px 14px 0px;" cellspacing="1"> <thead style="display:block; background-color:#f4c430; color:black;"><tr> <th style="width:100px;">编号</th> <th style="width:160px;">队长</th> <th style="width:100px;">效能</th> <th style="width:490px;">组成</th> <th style="width:100px;">波数</th> <th style="width:270px;">其它</th> </tr></thead><tbody id="Missionbody" style="height:300px; overflow-y:scroll; display:block;">`; /*-- 路径点的敌人站位 --*/ for(i in Theater_area){ if(Theater_area[i].id != $("#missionselect").val()) continue; var enemystr = Theater_area[i].enemy_group + ",";  while(enemystr){ var enemy_team_id = enemystr.slice(0, enemystr.indexOf("-")); var enemy_num = enemystr.slice(enemystr.indexOf("-") + 1, enemystr.indexOf(","));  var enemy_leader; var leader_name; for(j in Enemy_team) if(Enemy_team[j]["id"] == enemy_team_id){ enemy_leader = Enemy_team[j]["enemy_leader"]; break;} for(j in Enemy_charater_type) if(Enemy_charater_type[j]["id"] == enemy_leader){ leader_name = Enemy_charater_type[j]["name"]; break;} var thisline = `<tr class="missionline" style="border-bottom:2px #f4c43033 solid; display:block; cursor:pointer;"><td width="100px">`; thisline += enemy_team_id + `<\/td><td width="160px">`; thisline += leader_name + `<\/td><td width="100px">`; thisline += efectcal(enemy_team_id) + `<\/td><td width="490px">`; thisline += enemyoutcal(enemy_team_id) + `<\/td><td width="100px">`; thisline += enemy_num + `<\/td><td width="250px">`; thisline += "<\/td><\/tr>"; output += thisline;  enemystr = enemystr.slice(enemystr.indexOf(",") + 1, enemystr.length); } break; }  $("#missionshow").html(output); $(".missionline").mouseover(function(){ $(this).children("td").css("background-color", "#f4c43033"); }); $(".missionline").mouseout(function(){ $(this).children("td").css("background-color", ""); }); $(".missionline").click(function(){ $(this).parent().children("tr").css({"background-color":"", "color":""}); $(this).css({"background-color":"#f4c430cc", "color":"black"}); enemydisplay($(this).children("td").eq(0).html()); });} function efectcal(enemy_team_id){ var efect = 0; for(j in Enemy_in_team){ if(Enemy_in_team[j]["enemy_team_id"] != enemy_team_id) continue; var enemy_character_type_id = Number(Enemy_in_team[j].enemy_character_type_id); var level = Number(Enemy_in_team[j].level);  var charatype; for(var k = 0; k < Enemy_charater_type.length; k++){ if(Enemy_charater_type[k]["id"] != enemy_character_type_id) continue; charatype = Enemy_charater_type[k]; break;}  var attr_number = Number(Enemy_in_team[j].number); var attr_pow = enemyattribute(charatype , "pow" , level); var attr_def_break = enemyattribute(charatype , "def_break" , level); var attr_rate = enemyattribute(charatype , "rate" , level); var attr_hit = enemyattribute(charatype , "hit" , level); var attr_maxlife = enemyattribute(charatype , "maxlife" , level); var attr_dodge = enemyattribute(charatype , "dodge" , level); var attr_armor = enemyattribute(charatype , "armor" , level); var attr_def = enemyattribute(charatype , "def" , level); var attr_def_percent = Number(Enemy_in_team[j].def_percent); /*-- 攻击:ceiling:22*扩编数*((pow + def_break*0.85) * rate/50 * hit/(hit+35) +2) --*/ var efect_att = ceiling(22*attr_number*((attr_pow + attr_def_break*0.85) * attr_rate/50 * attr_hit/(attr_hit+35) +2)); /*-- 防御:ceiling:0.25*(maxlife * (35+dodge)/35 * 300/(300-armor) + 100) * (def_max*2-def+1200*2)/(def_max-def+1200) /2 --*/ var efect_def = ceiling(0.25*(bround(attr_number * attr_maxlife) * (35+attr_dodge)/35 * 300/(300-attr_armor) + 100) * (attr_def*2 - attr_def*attr_def_percent/100 + 1200*2)/(attr_def - attr_def*attr_def_percent/100 + 1200) /2); efect += ceiling(Number(charatype.effect_ratio) * (efect_att + efect_def)); } return efect;} function enemyoutcal(enemy_team_id){ var enemyout = ""; for(j in Enemy_in_team){ if(Enemy_in_team[j]["enemy_team_id"] != enemy_team_id) continue; var enemy_character_type_id = Number(Enemy_in_team[j]["enemy_character_type_id"]); var name;  for(var k = 0; k < Enemy_charater_type.length; k++){ if(Enemy_charater_type[k]["id"] != enemy_character_type_id) continue; name = Enemy_charater_type[k]["name"]; }  if(enemyout.indexOf(name) == -1) enemyout += name + "×" + Enemy_in_team[j]["number"] + " "; else{ var namepos = enemyout.indexOf(name); var oldnum = enemyout.slice(namepos + name.length + 1, enemyout.indexOf(" ", namepos)); var newnum = Number(oldnum) + Number(Enemy_in_team[j]["number"]); enemyout = enemyout.replace(name + "×" + oldnum + " ", name + "×" + newnum + " "); } } return enemyout;} function enemyselectcreat(){ var output = `<div style="display:inline-block; padding:6.5px; background:#E0E0E0; color:black; position:relative; top:1px;">敌人编号</div> <div class="eselect"><select id="enemyselect" name="enemyselect">`;  for(var i = 0; i < Enemy_team.length; i++) output += "<option value=\"" + Enemy_team[i].id + "\">" + Enemy_team[i].id + "</option>"; output += `</select></div> <input type="text" id="enemytext" name="enemytext" style="border:none; padding:10px; background-color:#e0e0e0;"/>`;  /*-- 绘制画布 --*/ var drawingoutput = `<canvas id="enemydrawing" width="4800px" height="300px" style="border:1px #ffffff99 solid;">Your browser does not support the HTML5 canvas tag.</canvas>`; $("#enemyposition").html(drawingoutput);  $("#enemychose").html(output); $("#enemyselect").change(function(){ enemydisplay(Number(this.value)); }); $("#enemytext").change(function(){ for(var i = 0; i < Enemy_team.length; i++){ if(Enemy_team[i].id == Number(this.value)){ enemydisplay(Number(this.value)); return; } } alert("该敌人不存在"); });} function enemydisplay(enemy_team_id){ /*-- enemyselect选择被选择的option --*/ $("#enemyselect").val(enemy_team_id);  /*-- canvas作图区域清空/画背景以及参考线 --*/ var con = $("#enemydrawing")[0].getContext("2d"); con.clearRect(0, 0, 4800, 300); con.lineWidth="1"; con.strokeStyle="#444444"; con.fillStyle = "#111111"; con.font="10px bolder Arial"; con.beginPath(); con.fillRect(0, 0, 4800, 300); con.stroke();  /*-- 参考线横向/纵向线条 --*/ for(var i = 0; i <= 300 / 25; i++){ dcoordinator(3, "#444444", 0, i);} for(var i = 0; i <= 3600/100; i++){
dcoordinator(2, "#444444", i*4, 0);
dcoordinator(6, "#444444", i*4, -1, i*4-3);}
var campaignname = $("#campaignselect").find("option:selected").text().slice(5, $("#campaignselect").find("option:selected").text().length);
var missionname = $("#missionselect").find("option:selected").text().slice(0, $("#missionselect").find("option:selected").text().length - 1).replace(/\[/g, "").replace(/\]/g, "");
console.log($("#missionselect").find("option:selected").text());
var othername = ($("#layerselect").css("display") != "none") ? (" " + $("#layerselect").find("option:selected").text().replace(" ", "") + " " + $("#packselect").find("option:selected").text().replace(" ", "")) : "";
$(this).children("a").attr("download",campaignname + " " + missionname + othername + ".png");
con.fill();
con.stroke();
/*-- 地图图例的文字 --*/
con.lineWidth = 4;
24,691
个编辑

导航菜单