From e52e2b6e3ee72dc6ff261419dd87b2749e991ed4 Mon Sep 17 00:00:00 2001 From: ben1222 Date: Sat, 4 Aug 2018 14:11:23 +0800 Subject: [PATCH 1/2] Use LLTeam in llnewautounit to calculate strength and auto arm gem --- static/lldata.js | 3 +- templates/llnewautounit.html | 919 ++++++++--------------------------- 2 files changed, 207 insertions(+), 715 deletions(-) diff --git a/static/lldata.js b/static/lldata.js index bd762ed..58b4811 100644 --- a/static/lldata.js +++ b/static/lldata.js @@ -17,8 +17,9 @@ * LLComponentCollection * +- LLSkillContainer * +- LLCardSelector + * LLGemStockComponent * - * v0.6.0 + * v0.7.0 * By ben1222 */ diff --git a/templates/llnewautounit.html b/templates/llnewautounit.html index ab83db3..4f130df 100644 --- a/templates/llnewautounit.html +++ b/templates/llnewautounit.html @@ -70,25 +70,6 @@ document.getElementById('loadingbox').style.display = 'none'; }, defaultHandleFailedRequest); - attr = new Array();//↓成员属性值*0 - HN = new Array();//每张卡的槽数//↓z0 - grade = new Array();//↓每个成员的年级* - Match_c = new Array(0,0,0,0,0,0,0,0,0);//是否满足副c - skillP = new Array();//z - skind = new Array();//z0 - var Precal=false; - comb=[]; - arms=new Array();//√ - P_up=new Array();//每个成员的对应宝石贡献属性增值 - P_sum = 0; - Sum_Max_Mem=0; - MPM=new Array(); - Team_Method=[]; - Current_MP=0; - IsPrecalced=false; - gradecount=new Array(); - skillcount=new Array(); - SNum = new Array();//↓每种宝石的数量*z0 songweight=new Array(); songweightsort=new Array() @@ -106,14 +87,6 @@ return result } - naipan = 480 - function changenaipan(){ - if (!document.getElementById('naipan').checked) - naipan = 480 - else - naipan = 270 - } - pos = -1 function savesubmemberNO(i){ sublength=submember.length @@ -129,7 +102,7 @@ } else{ document.getElementById('pos'+String(pos)).value = '换位'+String(pos+1) - swaplist = ['cardid','mezame','main','smile','pure','cool','skilllevel','gemnum','gemsinglepercent','gemallpercent','gemskill','gemacc','maxcost'] + swaplist = ['cardid','mezame','main','smile','pure','cool','skilllevel','gemnum','gemsinglepercent','gemallpercent','gemskill','gemacc','gemmember','gemnonet','maxcost'] if(i>8 && pos>8){ var swapsubmemberlist = ['cardid','mezame','main','smile','pure','cool','skilllevel','maxcost'] savesubmemberNO(i-9) @@ -201,11 +174,13 @@ function calslot(n){ result = 0 - result += parseInt(parseInt(document.getElementById("gemnum"+String(n)).value)/200) - result += parseInt(parseFloat(document.getElementById("gemsinglepercent"+String(n)).value)/0.05) - result += parseInt(parseFloat(document.getElementById("gemallpercent"+String(n)).value)/0.0059) + result += LLSisGem.parseSADDSlot(document.getElementById("gemnum"+String(n)).value); + result += LLSisGem.parseSMULSlot(parseFloat(document.getElementById("gemsinglepercent"+String(n)).value)*100); + result += LLSisGem.parseAMULSlot(parseFloat(document.getElementById("gemallpercent"+String(n)).value)*100); result += parseInt(parseInt(document.getElementById("gemskill"+String(n)).value)*4) result += parseInt(parseInt(document.getElementById("gemacc"+String(n)).value)*4) + result += parseInt(parseInt(document.getElementById("gemmember"+String(n)).value)*4) + result += parseInt(parseInt(document.getElementById("gemnonet"+String(n)).value)*4) document.getElementById("slot"+String(n)).innerHTML = result } @@ -239,7 +214,7 @@ function makeSaveData() { var member = [{}, {}, {},{},{},{},{},{},{},{}]; - var saveatt = ['smile', 'pure', 'cool', 'skilllevel', 'cardid', 'mezame', 'gemnum', 'gemsinglepercent', 'gemallpercent', 'gemskill', 'gemacc','maxcost']; + var saveatt = ['smile', 'pure', 'cool', 'skilllevel', 'cardid', 'mezame', 'gemnum', 'gemsinglepercent', 'gemallpercent', 'gemskill', 'gemacc','gemmember','gemnonet','maxcost']; for (var i=0; i<9; i++){ for (var j in saveatt){ member[i][saveatt[j]] = document.getElementById(saveatt[j]+String(i)).value @@ -265,7 +240,7 @@ function loadSaveData(data, loadTeam, loadGemStock, loadSubMember) { var saveData = new LLSaveData(data); if (loadTeam) { - var attlist = ['smile', 'pure', 'cool', 'skilllevel', 'cardid', 'mezame', 'gemnum', 'gemsinglepercent', 'gemallpercent', 'gemskill', 'gemacc', 'maxcost']; + var attlist = ['smile', 'pure', 'cool', 'skilllevel', 'cardid', 'mezame', 'gemnum', 'gemsinglepercent', 'gemallpercent', 'gemskill', 'gemacc', 'gemmember','gemnonet','maxcost']; for (var i = 0; i < 9; i++) { var member = saveData.teamMember[i]; for (var j in attlist) { @@ -472,238 +447,13 @@ function autoarm(){ if(document.getElementById('autoarm0').checked){ document.getElementById("sisreserves").style.display = ''; - if(IsPrecalced==false){ - calc_arms(); - IsPrecalced=true; - } } else{ document.getElementById("sisreserves").style.display = 'none'; - // stararm() -// document.getElementById("test00").value =document.getElementById("kissnum").value } } //////// - function Sis_get_Data(){ - //获取主唱 - var Psong=document.getElementById("map").value; - for(var i=0;i<9;i++){ - attr[i]=parseInt(document.getElementById(Psong+String(i)).value); - HN[i]=parseInt(document.getElementById("maxcost"+String(i)).value); - if(HN[i]>8){ - HN[i]=8; - document.getElementById("maxcost"+String(i)).value="8"; - } - if(HN[i]<=0){ - HN[i]=1; - document.getElementById("maxcost"+String(i)).value="1"; - } - } - SNum[0]=9; - for(var i=1;i<16;i++){ - SNum[i]=parseInt(document.getElementById("sis"+i.toString()).value); - if(SNum[i]>9) SNum[i]=9; - if(SNum[i]<0) SNum[i]=0; - } - for(var i=0;i<9;i++){ -// skillP[i]=parseInt(document.getElementById("skillstrength"+String(i)).value); - if(skind[i]<3) skillP[i]=skillP[i]*3/5; - } - } - //////////////////////******************* - cost = new Array( 1,2,2,3,3,4,4 ); - -function arm_sis(mp,mc,Mem) { - var s = mp.split(''); - var p = Team_Method[Mem][mp].strength; - for (var x in comb[mc]) {//确定要扣哪一个宝石 - var xx=0; - if (comb[mc][x] < 2) xx = comb[mc][x]; - if (comb[mc][x] == 2) xx = grade[Mem] + 1; - if (comb[mc][x] == 3) xx = grade[Mem] + 4; - if (comb[mc][x] == 4 || comb[mc][x] == 5) xx = comb[mc][x] + 4; - if (comb[mc][x] == 6) xx = skind[Mem] + 10; - if((comb[mc][x] == 6) && skind[Mem]==6) return false; - if (s[xx] == '-') { - p += P_up[Mem][comb[mc][x]]; - } - if (s[xx] > '0'&&s[xx]<'9') { - s[xx] -= 1; - p += P_up[Mem][comb[mc][x]]; - } - else if (s[xx] == '0') return false; - } - for (ii = 0; ii < 16; ii++) { - if ((s[ii] != '-') && ((s[ii] - '0') >= (8 - Mem))) { - s[ii] = '-'; - } - } - if((s[grade[Mem]+1]-'0')>=(gradecount[grade[Mem]-1]-1)) s[grade[Mem]+1]='-'; - if((s[grade[Mem]+4]-'0')>=(gradecount[grade[Mem]-1]-1)) s[grade[Mem]+4]='-'; - if(skind[Mem]<6){ - if((s[skind[Mem]+10]-'0')>=(skillcount[skind[Mem]]-1)) s[skind[Mem]+10]='-'; - } - s=s.join(''); - if(typeof Team_Method[Mem+1][s]=== 'undefined'){ - Team_Method[Mem+1][s]={strength:p,premethod:mp,currmethod:mc}; - } - else{ - if(Team_Method[Mem+1][s].strength Current_MP) Current_MP = p; - return true; -} -function calc_arms(){ - arms[0]=0; - for (i = 1; i < 9; i++) { - arms[i]=new Array(); - arms[i][0]=0; - for (j = 1; j < 128; j++) { - var m = 0; - var sc = 0; - var x = j; - var sv=new Array(); - while (x >= 1) { - sc += (x % 2)*cost[m]; - if (x % 2 == 1) sv.push(m); - x = parseInt(x/2); - m++; - } - if(sc= 9) o_sis[i] = '-'; - else o_sis[i] = SNum[i]; - } - for(i=0;i<3;i++){ - if(SNum[i+2]>=gradecount[i]) o_sis[i+2] = '-'; - if(SNum[i+5]>=gradecount[i]) o_sis[i+5] = '-'; - } - for(i=0;i<6;i++){ - if(SNum[i+10]>skillcount[i]) o_sis[i+10] = '-'; - } - o_sis=o_sis.join(''); - Team_Method[0]=[]; - Team_Method[0][o_sis]={strength:0,premethod:"",currmethod:0}; - - for (i = 1; i < 10; i++) { - Team_Method[i]=[]; - for(mp in Team_Method[i - 1]){ - if ((Current_MP - Team_Method[i - 1][mp].strength) > Sum_Max_Mem) continue;// - var smp = mp.split(''); - for (ii = 0; ii<16; ii++) { - if ((smp[ii] != '-') && ((smp[ii] - '0') >= (9 - i))) - smp[ii] = '-'; - } - if((smp[grade[i-1]+1]-'0')>=(gradecount[grade[i-1]-1]-1)) smp[grade[i-1]+1]='-'; - if((smp[grade[i-1]+4]-'0')>=(gradecount[grade[i-1]-1]-1)) smp[grade[i-1]+4]='-'; - if(skind[i-1]<6){ - if((smp[skind[i-1]+10]-'0')>=(skillcount[skind[i-1]]-1)) smp[skind[i-1]+10]='-'; - } - smp=smp.join(''); - if(typeof Team_Method[i][smp]=== 'undefined'){ - Team_Method[i][smp]={strength:Team_Method[i-1][mp].strength,premethod:mp,currmethod:0}; - } - else if(Team_Method[i][smp].strength 0; i--) { - gnx=0; - gspx=0; - gapx=0; - gsx=0; - for(x in comb[Team_Method[i][p_s].currmethod]){ - if(comb[Team_Method[i][p_s].currmethod][x]==0) gnx+=200; - if(comb[Team_Method[i][p_s].currmethod][x]==1) gnx+=450; - if(comb[Team_Method[i][p_s].currmethod][x]==2) gspx+=10; - if(comb[Team_Method[i][p_s].currmethod][x]==3) gspx+=16; - if(comb[Team_Method[i][p_s].currmethod][x]==4) gapx+=18; - if(comb[Team_Method[i][p_s].currmethod][x]==5) gapx+=24; - if(comb[Team_Method[i][p_s].currmethod][x]==6) gsx=1; - } - document.getElementById("gemnum"+String(i-1)).value=String(gnx); - document.getElementById("gemsinglepercent"+String(i-1)).value=String(gspx/100); - document.getElementById("gemallpercent"+String(i-1)).value=String(gapx/1000); - document.getElementById("gemskill"+String(i-1)).value=String(gsx); - p_s = Team_Method[i][p_s].premethod; - } - } - /// function fillunit(){ if(submember.length<8){ for(var i=0;i 0.2){ - member[i][mainatt] += Math.ceil(0.1*origin)+Math.ceil(0.16*origin) - attst[i] += Math.ceil(0.1*origin)+Math.ceil(0.16*origin) - } - else { - member[i][mainatt] += Math.ceil(member[i]["gemsinglepercent"]*origin) - attst[i] += Math.ceil(member[i]["gemsinglepercent"]*origin) - } - + var llteam = new LLTeam(llmembers); + var friendcskill = { + "Csecondskillattribute": parseInt(mapcenter.secondpercentage2), + "Csecondskilllimit": parseInt(mapcenter.secondlimit2), + "Cskillattribute": mapcenter.base2, + "Cskillpercentage": parseInt(mapcenter.percentage2), + "attribute": mapcenter.bonus2 + }; + var song = llsong.songs[document.getElementById('songchoice').value]; + var songunit = 0; + if (song.muse) { + songunit = 4; + } else if (song.aqours) { + songunit = 5; } - //i带全体宝石,给j加 - teamgem = new Array() - for (var i = 0; i < 9; i++) { - teamgem[i] = [0,0,0,0,0,0,0,0,0] - for (var j = 0;j < 9;j ++){ - if (member[i]["gemallpercent"] > 0.04){ - member[j][mainatt] += Math.ceil(0.018*rawmember[j][mainatt])+Math.ceil(0.024*rawmember[j][mainatt]) - totalall += Math.ceil(0.018*rawmember[j][mainatt])+Math.ceil(0.024*rawmember[j][mainatt]) - teamgem[i][j] = Math.ceil(0.018*rawmember[j][mainatt])+Math.ceil(0.024*rawmember[j][mainatt]) - attst[j] += Math.ceil(0.018*rawmember[j][mainatt])+Math.ceil(0.024*rawmember[j][mainatt]) - } - else{ - member[j][mainatt] += Math.ceil(member[i]["gemallpercent"]*rawmember[j][mainatt]) - totalall += Math.ceil(member[i]["gemallpercent"]*rawmember[j][mainatt]) - teamgem[i][j] = Math.ceil(member[i]["gemallpercent"]*rawmember[j][mainatt]) - attst[j] += Math.ceil(member[i]["gemallpercent"]*rawmember[j][mainatt]) + if (document.getElementById('autoarm0').checked){ + // autoarm + var saveData = makeSaveData(); + llteam.autoArmGem(mainatt, songunit, mapcenter.time, mapcenter.combo, mapcenter.perfect, mapcenter.starperfect, mapcenter.tapup, mapcenter.skillup, friendcskill, weights, saveData.gemStock); + for (var i = 0; i < 9; i++) { + var curGems = llteam.members[i].gems; + var sumSADD = 0; + var sumSMUL = 0; + var sumAMUL = 0; + var sumSKILL = 0; + var sumMEMBER = 0; + var sumNONET = 0; + for (var j = 0; j < curGems.length; j++) { + var curGem = curGems[j]; + if (curGem.attr_add && curGem.isEffectRangeSelf()) { + sumSADD += curGem.effect_value; + } else if (curGem.attr_mul) { + if (curGem.per_member) { + sumMEMBER++; + } else if (curGem.per_unit) { + sumNONET++; + } else if (curGem.isEffectRangeSelf()) { + sumSMUL += curGem.effect_value; + } else { + sumAMUL += Math.round(curGem.effect_value*10); + } + } else if (curGem.isSkillGem()) { + sumSKILL++; + } } + document.getElementById("gemnum"+String(i)).value=String(sumSADD); + document.getElementById("gemsinglepercent"+String(i)).value=String(sumSMUL/100); + document.getElementById("gemallpercent"+String(i)).value=String(sumAMUL/1000); + document.getElementById("gemskill"+String(i)).value=String(sumSKILL); + document.getElementById("gemmember"+String(i)).value=String(sumMEMBER); + document.getElementById("gemnonet"+String(i)).value=String(sumNONET); + calslot(i); } } + llteam.calculateAttributeStrength(mainatt, songunit, friendcskill, weights); + llteam.calculateSkillStrength(mapcenter.time, mapcenter.combo, mapcenter.perfect, mapcenter.starperfect, mapcenter.tapup, mapcenter.skillup); - rawattst = attst.concat() - rawteamgem= new Array() - - result['baseatt'][mainatt] = 0 - for (var i = 0; i < 9; i++) { - rawteamgem[i] = teamgem[i].concat() - result['baseatt'][mainatt] += member[i][mainatt]; - } - //主c技能 - for (var i = 0; i < 9; i++) { - if(Precal){ - for(var g=1;g<=3;g++){ - for(var j in unitgradechr[g]){ - if(unitgradechr[g][j]==cards[member[i]["cardid"]]["jpname"]){ - grade[i]=g; - } - } - } - } - result['bonusatt'][mapcenter['bonus']] += Math.ceil(mapcenter['percentage']*member[i][mapcenter['base']]/100); - if (mapcenter['base'] == mainatt){ - attst[i] += Math.ceil(rawattst[i]*mapcenter['percentage']/100) - ////////// - if(Precal&&(mapcenter['bonus']==mainatt)) - Match_c[i]+=(mapcenter['percentage']/100); - ////////// - for (var j = 0; j < 9; j++) - teamgem[j][i] += Math.ceil(rawteamgem[j][i]*mapcenter['percentage']/100) - } - else - attst[i] += Math.ceil(member[i][mapcenter['base']]*mapcenter['percentage']/100) - } - //副c技能 - for (var i = 0; i < 9; i++) { - if (comp_cardselector.isInUnitGroup(mapcenter['secondlimit'], cards[member[i]["cardid"]]["jpname"])){ - //////////////////// - if(Precal&&(mapcenter['bonus']==mainatt)) Match_c[i]+=(mapcenter['secondpercentage']/100); - ////////////////////// - result['bonusatt'][mapcenter['secondbase']] += Math.ceil(member[i][mapcenter['secondbase']]*mapcenter['secondpercentage']/100) - attst[i] += Math.ceil(rawattst[i]*mapcenter['secondpercentage']/100) - for (var j = 0; j < 9; j++) - teamgem[j][i] += Math.ceil(rawteamgem[j][i]*mapcenter['secondpercentage']/100) - } - - } - //好友主c技能 - for (var i = 0; i < 9; i++) { - result['bonusatt'][mapcenter['bonus2']] += Math.ceil(mapcenter['percentage2']*member[i][mapcenter['base2']]/100); - if (mapcenter['base2'] == mainatt){ - ////////// - if(Precal &&(mapcenter['bonus2']==mainatt)){ - - Match_c[i]+=(mapcenter['percentage2']/100); - } - ////////// - attst[i] += Math.ceil(rawattst[i]*mapcenter['percentage2']/100) - for (var j = 0; j < 9; j++) - teamgem[j][i] += Math.ceil(rawteamgem[j][i]*mapcenter['percentage2']/100) - } - else - attst[i] += Math.ceil(member[i][mapcenter['base2']]*mapcenter['percentage2']/100) - } - //好友副c技能 - for (var i = 0; i < 9; i++) { - if (comp_cardselector.isInUnitGroup(mapcenter['secondlimit2'], cards[member[i]["cardid"]]["jpname"])){ - //////////////////// - if(Precal &&(mapcenter['bonus2']==mainatt)) - Match_c[i]+=(mapcenter['secondpercentage2']/100); - ////////////////////// - result['bonusatt'][mapcenter['secondbase2']] += Math.ceil(member[i][mapcenter['secondbase2']]*mapcenter['secondpercentage2']/100) - attst[i] += Math.ceil(rawattst[i]*mapcenter['secondpercentage2']/100) - for (var j = 0; j < 9; j++) - teamgem[j][i] += Math.ceil(rawteamgem[j][i]*mapcenter['secondpercentage2']/100) - } - } - - document.getElementById('resultsmile').innerHTML = (result.baseatt.smile+result.bonusatt.smile).toString()+" (+"+result.bonusatt.smile.toString()+")" - document.getElementById('resultpure').innerHTML = (result.baseatt.pure+result.bonusatt.pure).toString()+" (+"+result.bonusatt.pure.toString()+")" - document.getElementById('resultcool').innerHTML = (result.baseatt.cool+result.bonusatt.cool).toString()+" (+"+result.bonusatt.cool.toString()+")" + document.getElementById('resultsmile').innerHTML = llteam.finalAttr.smile + ' (+' + llteam.bonusAttr.smile + ')'; + document.getElementById('resultpure').innerHTML = llteam.finalAttr.pure + ' (+' + llteam.bonusAttr.pure + ')'; + document.getElementById('resultcool').innerHTML = llteam.finalAttr.cool + ' (+' + llteam.bonusAttr.cool + ')'; - - var showatt = result['bonusatt'][mapcenter['map']]+result['baseatt'][mapcenter['map']]; - var combomulti = cbmulti(mapcenter['combo']); - var accmulti = 0.88+0.12*(mapcenter['perfect']/mapcenter['combo']); - var trueatt = showatt - - totalattst = 0 - totalweight = 0 - for (var i = 0; i < 9; i++) { - totalweight += member[i]['weight'] - for (var j = 0; j < 9; j++){ - attst[i] += teamgem[i][j] - attst[j] -= teamgem[i][j] - } - } - rawattst = attst.concat() - totalrawst = 0 - for (var i = 0; i < 9; i++) { - totalrawst += rawattst[i] - groupbonus = samegroup(llsong.getSelectedSong(),comp_cardselector.cards[member[i]["cardid"]].jpname) - colorbonus = (mapcenter['map'] == member[i]['main']) - if (!groupbonus && !colorbonus) - attst[i] -= Math.round(showatt*member[i]['weight']/totalweight*0.21/1.21) - else if (!groupbonus || !colorbonus) - attst[i] -= Math.round(showatt*member[i]['weight']/totalweight*0.1/1.1) - document.getElementById('attstrength'+String(i)).innerHTML = attst[i].toString() - totalattst += attst[i] - } - - result['accuracy'] = 0; - var averageaccuracy = [0,0,0,0,0,0,0,0,0] for (var i = 0; i < 9; i++) { - var skill = member[i]['skill']; - if (skill == 5) { - skillc = member[i]['score']*member[i]['possibility']/100/member[i]['require'] - skillc = skillc/(skillc+1.0) - waste = (1-skillc)*skillc*member[i]['require']/2+skillc*member[i]['score']/2 - skillc = (skillc*mapcenter['time']-waste)/mapcenter['time'] - skillc = parseInt(1000*skillc)/10 - averageaccuracy[i] = skillc - } else if (skill == 6 || skill == 12) { - skillc = mapcenter['combo']*member[i]['score']*member[i]['possibility']/100/member[i]['require']/mapcenter['time'] - waste = skillc*member[i]['score']/2 - skillc = mapcenter['combo']*member[i]['score']*member[i]['possibility']/100/member[i]['require']/mapcenter['time']*(mapcenter['combo']-member[i]['require']/2)/mapcenter['combo'] - skillc = (skillc*mapcenter['time']-waste)/mapcenter['time'] - skillc = parseInt(1000*skillc)/10 - averageaccuracy[i] = skillc - } - } - totalaccuracy = 0 - for (var i = 0; i < 9; i++) { - totalaccuracy += (1-totalaccuracy)*(averageaccuracy[i]/100) - } - /* - for (var i = 0; i < 9; i++) { - if (member[i]['gemacc'] == "1"){ - member[i][mainatt]*= (1+0.25*totalaccuracy) - member[i][mainatt] = parseInt(member[i][mainatt]) - showatt += parseInt(member[i][mainatt]*0.25*totalaccuracy) - } + document.getElementById('attstrength'+String(i)).innerHTML = llteam.attrStrength[i]; + document.getElementById('cardstrengthdebuff'+String(i)).innerHTML = -llteam.attrDebuff[i]; } - */ - result['minscore'] = 0; - for (var i = 0; i < 9; i++) { - //result['minscore'] += Math.floor(showatt/80*member[i]['weight']*combomulti*accmulti*(mapcenter['map'] === member[i]['main'] ? 1.1 : 1)*(samegroup(llsong.getSelectedSong(),comp_cardselector.cards[member[i]["cardid"]].jpname) ? 1.1 : 1)); - } - result['minscore'] = 1.21*totalattst/80*totalweight*combomulti*accmulti*(1+mapcenter['tapup']/100) - - result['maxscore'] = result['minscore']; - result['averagescore'] = result['minscore']; - result['averageheal'] = 0; - result['maxheal'] = 0; - - var skillchance = [0, 0, 0, 0, 0, 0, 0, 0, 0]; - var averageskillscore = [0, 0, 0, 0, 0, 0, 0, 0, 0]; - var averageheal = [0,0,0,0,0,0,0,0,0] - - for (var i = 0; i < 9; i++) { - var skill = member[i]['skill']; - member[i]['possibility'] *= (1+mapcenter['skillup']/100) - if (skill == 1 || skill == 11) { - skillchance[i] = Math.floor(mapcenter['combo']/member[i]['require']); - result['maxscore'] += skillchance[i]*member[i]['score']; - averageskillscore[i] = skillchance[i]*member[i]['possibility']*member[i]['score']/100; - result['averagescore'] += skillchance[i]*member[i]['possibility']*member[i]['score']/100; - } else if (skill == 2) { - skillchance[i] = Math.floor(mapcenter['perfect']/member[i]['require']); - result['maxscore'] += skillchance[i]*member[i]['score']; - averageskillscore[i] = skillchance[i]*member[i]['possibility']*member[i]['score']/100; - result['averagescore'] += skillchance[i]*member[i]['possibility']*member[i]['score']/100; - } else if (skill == 4) { - skillchance[i] = Math.floor(mapcenter['time']/member[i]['require']); - result['maxscore'] += skillchance[i]*member[i]['score']; - averageskillscore[i] = skillchance[i]*member[i]['possibility']*member[i]['score']/100; - result['averagescore'] += skillchance[i]*member[i]['possibility']*member[i]['score']/100; - } else if (skill == 7 || skill == 13) { - skillchance[i] = Math.floor(mapcenter['combo']/member[i]['require']); - result['maxheal'] += skillchance[i]*member[i]['score']; - averageheal[i] = skillchance[i]*member[i]['possibility']*member[i]['score']/100 - result['averageheal'] += skillchance[i]*member[i]['possibility']*member[i]['score']/100; - if (member[i]['gemskill'] == '1'){ - member[i]["skill"] = 1 - member[i]["score"] *= naipan - result['maxscore'] += skillchance[i]*member[i]['score']; - averageskillscore[i] = skillchance[i]*member[i]['possibility']*member[i]['score']/100; - result['averagescore'] += skillchance[i]*member[i]['possibility']*member[i]['score']/100; - } - } else if (skill == 8) { - skillchance[i] = Math.floor(mapcenter['time']/member[i]['require']); - result['maxheal'] += skillchance[i]*member[i]['score']; - averageheal[i] = skillchance[i]*member[i]['possibility']*member[i]['score']/100 - result['averageheal'] += skillchance[i]*member[i]['possibility']*member[i]['score']/100; - if (member[i]['gemskill'] == '1'){ - member[i]["skill"] = 4 - member[i]["score"] *= naipan - result['maxscore'] += skillchance[i]*member[i]['score']; - averageskillscore[i] = skillchance[i]*member[i]['possibility']*member[i]['score']/100; - result['averagescore'] += skillchance[i]*member[i]['possibility']*member[i]['score']/100; - } - } else if (skill == 9) { - skillchance[i] = Math.floor(mapcenter['perfect']/member[i]['require']); - result['maxheal'] += skillchance[i]*member[i]['score']; - averageheal[i] = skillchance[i]*member[i]['possibility']*member[i]['score']/100 - result['averageheal'] += skillchance[i]*member[i]['possibility']*member[i]['score']/100; - if (member[i]['gemskill'] == '1'){ - member[i]["skill"] = 2 - member[i]["score"] *= naipan - result['maxscore'] += skillchance[i]*member[i]['score']; - averageskillscore[i] = skillchance[i]*member[i]['possibility']*member[i]['score']/100; - result['averagescore'] += skillchance[i]*member[i]['possibility']*member[i]['score']/100; - } - } else if (skill == 10) { - skillchance[i] = Math.floor(mapcenter['starperfect']/member[i]['require']); - result['maxscore'] += skillchance[i]*member[i]['score']; - averageskillscore[i] = skillchance[i]*member[i]['possibility']*member[i]['score']/100; - result['averagescore'] += skillchance[i]*member[i]['possibility']*member[i]['score']/100; - } - } - - var finish = false; - var infinite = false; - var averagescoringtimes = [0, 0, 0, 0, 0, 0, 0, 0, 0]; - var maxscoringtimes = [0, 0, 0, 0, 0, 0, 0, 0, 0]; - while (!finish) { - finish = true; - if (result['averagescore'] > 10000000) { - result['averagescore'] = '1000w+'; - infinite = true; - break; - } - for (var i = 0; i < 9; i++) { - if (member[i]['skill'] == 3 && averagescoringtimes[i] < Math.floor(result['averagescore']/member[i]['require'])) { - remaintimes = Math.floor(result['averagescore']/member[i]['require'])-averagescoringtimes[i]; - averagescoringtimes[i] += remaintimes; - averageskillscore[i] += remaintimes*member[i]['possibility']*member[i]['score']/100; - result['averagescore'] += remaintimes*member[i]['possibility']*member[i]['score']/100; - finish = false; - } - } - } - if (!infinite) { - result['averagescore'] = Math.round(result['averagescore']); - } - finish = false; - infinite = false; - while (!finish) { - finish = true; - if (result['maxscore'] > 10000000) { - result['maxscore'] = '1000w+'; - infinite = true; - break - } - for (var i = 0; i < 9; i++) { - if (member[i]['skill'] == 3 && maxscoringtimes[i] < Math.floor(result['maxscore']/member[i]['require'])) { - remaintimes = Math.floor(result['maxscore']/member[i]['require'])-maxscoringtimes[i]; - maxscoringtimes[i] += remaintimes; - result['maxscore'] += remaintimes*member[i]['score']; - finish = false; - } - } - } - - if (document.getElementById('distribution').checked && (!Precal)){ + if (document.getElementById('distribution').checked && calc_distribution){ var t0 = window.performance.now(); - - var percentiles = [0.01, 0.02, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.95, 0.98, 0.99]; - var dist = [[result['minscore'], 1]]; - for (var i = 0; i < 9; i++) { - var skill = member[i]['skill']; - if (skill == 1 || skill == 2 || skill == 4 || skill == 10 || skill == 11) { - for (var j = 0; j < skillchance[i]; j++) { - dist = addskill(dist, member[i]['score'], member[i]['possibility'] / 100, 0); - } - } - } - - var nextscore = [Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity]; - for (var i = 0; i < 9; i++) { - if (member[i]['skill'] == 3) { - nextscore[i] = member[i]['require']; - } - } - for (;;) { - var next = 0; - for (var i = 1; i < 9; i++) { - if (nextscore[i] < nextscore[next]) { - next = i; - } - } - if ((nextscore[next] > dist[dist.length - 1][0]) || (nextscore[next] > 3000000)) { - break; - } - dist = addskill(dist, member[next]['score'], member[next]['possibility'] / 100, nextscore[next]); - nextscore[next] += member[next]['require']; - } - - var scores = []; - var k = 0; - var p = 0; - for (var i = 0; i < dist.length && k < percentiles.length; i++) { - p += dist[i][1]; - for (; k < percentiles.length && p >= percentiles[k]; k++) { - scores[k] = dist[i][0]; - } + + var percentiles = [1, 2, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 95, 98, 99]; + var err = llteam.calculateScoreDistribution(); + if (err) { + showErrorResult(err); + } else { + llteam.calculatePercentileNaive(); + hideErrorResult(); } - var t1 = window.performance.now(); + console.debug('Elapesd time (ms): ' + (t1 - t0).toFixed(3)); - console.debug('Possibilities: ' + dist.length.toString()); - var p = 0; - for (var i = 0; i < dist.length; i++) { - p += dist[i][1]; - } - console.debug('Total probability (naïve summation): 1 ' + (p >= 1 ? '+ ' : '- ') + Math.abs(p - 1).toString()); - var s0 = 0, s1 = 0; - for (var i = 0; i < dist.length; i++) { - var s = s0 + dist[i][1]; - var bb = s - s0; - var e = (dist[i][1] - bb) + (s0 - (s - bb)) + s1; - s0 = s + e; - s1 = e - (s0 - s); - } - var ep = (s0 - 1) + s1; - console.debug('Total probability: 1 ' + (ep >= 0 ? '+ ' : '- ') + Math.abs(ep).toString()); - var meanscore = 0; - for (var i = 0; i < dist.length; i++) { - meanscore += dist[i][0] * dist[i][1]; - } - document.getElementById('averagescore').innerHTML = meanscore.toFixed(0).toString() - console.debug('Mean score: ' + meanscore.toString()); - - console.debug(result); - for (i in scores){ - document.getElementById('simresult'+(100-percentiles[i]*100).toString()).innerHTML = scores[i].toFixed(0).toString() + document.getElementById('averagescore').innerHTML = llteam.naiveExpection; + for (var i in percentiles){ + document.getElementById('simresult'+(100-percentiles[i]).toString()).innerHTML = llteam.naivePercentile[percentiles[i]]; } + document.getElementById('maxscoreprobability').innerHTML = '(' + (llteam.probabilityForMaxScore * 100) + ')%'; + document.getElementById('minscoreprobability').innerHTML = '(' + (llteam.probabilityForMinScore * 100) + ')%'; + document.getElementById('simresult0').innerHTML = llteam.maxScore; + document.getElementById('simresult100').innerHTML = llteam.minScore; + document.getElementById('distributionresult').style.display = ''; + } else { + gettotalstrength = llteam.averageScore; + document.getElementById('averagescore').innerHTML = llteam.averageScore; + document.getElementById('distributionresult').style.display = 'none'; + hideErrorResult(); } - else{ - gettotalstrength=result['averagescore'] - document.getElementById('averagescore').innerHTML = result['averagescore'].toString() - } - document.getElementById('resultstrength').innerHTML = (result.averagescore/result.minscore*totalattst).toFixed(0).toString() - document.getElementById('averageheal').innerHTML = result.averageheal - console.debug(scores); - - ttweight = 0 - ttstrength = 0 - for (i=0;i<9;i++) - ttweight += member[i]['weight'] - skillst = [0,0,0,0,0,0,0,0,0] - for (i=0;i<9;i++){ - leader = 0 - - skillst[i] = parseInt(Math.round(averageskillscore[i]/result.minscore*totalattst/(1+mapcenter['skillup']/100)*(1+mapcenter['tapup']/100)).toFixed(0)) - } - for (i=0;i<9;i++){ - document.getElementById('cardstrength'+String(i)).innerHTML = (rawattst[i]+skillst[i]).toString() - document.getElementById('strength'+String(i)).innerHTML = (attst[i]+skillst[i]).toString() - document.getElementById('skillstrength'+String(i)).innerHTML = skillst[i].toString() - ///// - if(Precal) skillP[i]=skillst[i]; - ///// - document.getElementById('heal'+String(i)).innerHTML = averageheal[i].toString() - ttstrength += (attst[i]+skillst[i]) - } - - document.getElementById('resultstrength').innerHTML = ttstrength.toFixed(0).toString()+' (属性 '+totalattst.toString()+' + 技能 '+(ttstrength-totalattst).toString()+')' - minstrength = 100000000 - minwhich = -1 - mincardstrength = 100000000 - mincard = -1 - for (i=0;i<9;i++){ - document.getElementById('strength'+String(i)).style.color = '' - document.getElementById('cardstrength'+String(i)).style.color = '' - if (parseInt(document.getElementById('strength'+String(i)).innerHTML) < minstrength){ - minwhich = i - minstrength = parseInt(document.getElementById('strength'+String(i)).innerHTML) + document.getElementById('averageheal').innerHTML = LLUnit.healNumberToString(llteam.averageHeal); + + var minStrength = 0, minStrengthIndex = -1; + var minCardStrength = 0, minCardStrengthIndex = -1; + for (var i=0;i<9;i++){ + var curCardStrength = llteam.attrStrength[i]+llteam.avgSkills[i].strength; + var curStrength = curCardStrength - llteam.attrDebuff[i]; + document.getElementById('cardstrength'+String(i)).innerHTML = curCardStrength.toString(); + document.getElementById('cardstrength'+String(i)).style.color = ''; + document.getElementById('strength'+String(i)).innerHTML = curStrength.toString(); + document.getElementById('strength'+String(i)).style.color = ''; + document.getElementById('skillstrength'+String(i)).innerHTML = llteam.avgSkills[i].strength; + document.getElementById('heal'+String(i)).innerHTML = LLUnit.healNumberToString(llteam.avgSkills[i].averageHeal); + + if (minCardStrengthIndex < 0 || curCardStrength < minCardStrength) { + minCardStrength = curCardStrength; + minCardStrengthIndex = i; } - if (parseInt(document.getElementById('cardstrength'+String(i)).innerHTML) < mincardstrength){ - mincard = i - mincardstrength = parseInt(document.getElementById('cardstrength'+String(i)).innerHTML) + if (minStrengthIndex < 0 || curStrength < minStrength) { + minStrength = curStrength; + minStrengthIndex = i; } - trueacc = 100*(averageaccuracy[i]/100)*(1-totalaccuracy)/(1-averageaccuracy[i]/100) - calslot(i); - //document.getElementById('accuracy'+String(i)).innerHTML = trueacc.toFixed(1).toString()+'%
('+averageaccuracy[i].toString()+'%)' } + document.getElementById('resultstrength').innerHTML = llteam.totalStrength + ' (属性 ' + llteam.totalAttrStrength + ' + 技能 ' + llteam.totalSkillStrength + ')'; //document.getElementById('averageaccuracy').innerHTML = (totalaccuracy*100).toFixed(1).toString()+'%' + + document.getElementById('strength'+String(minStrengthIndex)).style.color = 'red'; + document.getElementById('cardstrength'+String(minCardStrengthIndex)).style.color = 'red'; + + llteam.calculateMic(); + var micDisplayValue = llteam.micNumber; + var micDisplayString = micDisplayValue % 1 === 0.0 ? micDisplayValue.toLocaleString() : Math.floor(micDisplayValue).toLocaleString() + ' 或 ' + (Math.floor(micDisplayValue) + 1) + + document.getElementById('resultmic').innerHTML = micDisplayString + ' (' + (llteam.micPoint / 100).toLocaleString() + (micDisplayValue % 1 === 0.0 ? '' : ', 该数值对应的援力暂时未知, 欢迎反馈') + ')'; + document.getElementById('result').style.display = "" - document.getElementById('strength'+String(minwhich)).style.color = 'red' - document.getElementById('cardstrength'+String(mincard)).style.color = 'red' + document.getElementById("result").scrollIntoView() + } function callback(){ @@ -1747,6 +1199,10 @@

队伍属性

+ + + + {% endfor %} @@ -1758,6 +1214,9 @@

队伍属性

+ + + {% endfor %} @@ -1768,6 +1227,7 @@

队伍属性

+ {% endfor %} @@ -1790,6 +1250,24 @@

队伍属性

{% endfor %} + + 个人宝石 + {% for i in range(0,9) %} + + {% endfor %} + + + 九重奏宝石 + {% for i in range(0,9) %} + + {% endfor %} + 使用槽数 {% for i in range(0,9) %} @@ -1820,6 +1298,12 @@

队伍属性

{% endfor %} + + 异色异团惩罚 + {% for i in range(0,9) %} + + {% endfor %} + 实际强度 {% for i in range(0,9) %} @@ -1993,6 +1477,8 @@

队伍属性

{% include 'components/loadingbox.html' %} +
+ + + -
+ +
-


- + + -
-
-
- -
-
-
+
主唱技能 :%
计算分布 自动配饰 -


+
@@ -1554,6 +1415,7 @@

注意

  • 判定期间属性1.25倍的宝石计算有误,暂时按无效计算。
  • 在队伍中有爆分SR时,由于技能强度会随着队伍强度变化而变化,可能出现多次计算「自动配饰」得到的结果不唯一的情况,此时只需重复计算多次取强度最高者即可。
  • 为保险起见,请在有后备队员时自动组队计算后再点一次calculate,若有变化请点击「问题反馈」留言
  • +
  • 日服新宝石的计算正在测试中,可能有计算错误,欢迎反馈
  • {% endblock %} {% block back_notice_2 %} diff --git a/templates/llnewunitsis.html b/templates/llnewunitsis.html index d22577f..d5f5da9 100644 --- a/templates/llnewunitsis.html +++ b/templates/llnewunitsis.html @@ -148,7 +148,7 @@ member[i][saveatt[j]] = document.getElementById(saveatt[j]+String(i)).value } } - return new LLSaveData({'version': 102, 'team': member, 'gemstock': comp_gemstock.saveData(), 'submember': {}}); + return new LLSaveData({'version': 102, 'team': member, 'gemstock': comp_gemstock.saveData(), 'submember': []}); } function saveunit(){