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

“Widget:融合势力属性”的版本间的差异

来自少前百科GFwiki
跳转至: 导航搜索
(区分最大1编和最大5编的单位的属性计算,关联最大5编的编制数和解析度)
 
(未显示同一用户的8个中间版本)
第1行: 第1行:
<script>
+
<style>
 +
#attr-th-1 { background: url(/images/9/9e/Data_Life.png) }
 +
#attr-th-2 { background: url(/images/1/16/Data_Pow.png) }
 +
#attr-th-3 { background: url(/images/7/72/Data_Rate.png) }
 +
#attr-th-4 { background: url(/images/6/6d/Data_Hit.png) }
 +
#attr-th-5 { background: url(/images/5/5f/Data_Dodge.png) }
 +
#attr-th-6 { background: url(/images/8/89/Data_Armor.png) }
 +
#attr-th-7 { background: url(/images/b/b2/Data_AP.png) }
 +
#attr-th-8 { background: url(/images/5/5d/Data_Ct.png) }
 +
#attr-th-9 { background: url(/images/1/12/Data_CtPow.png) }
 +
#attr-th-10 { background: url(/images/2/2f/Data_Move.png) }
 +
#attr-th-11 { background: url(/images/b/bb/Data_Range.png) }
 +
</style><script>
 
let type_coef;
 
let type_coef;
 
const size_coef = [100, 102, 105, 108, 110];
 
const size_coef = [100, 102, 105, 108, 110];
 
const rank_coef = [80, 90, 100, 110, 120];
 
const rank_coef = [80, 90, 100, 110, 120];
 
const sizes = ['微', '小', '中', '大', '巨'];
 
const sizes = ['微', '小', '中', '大', '巨'];
let div, ratios, grow;
+
const formImgPaths = ['0/0d', 'a/a8', '5/5a', '0/05', '3/3e'];
 +
let div, type, ratios, grow;
 
let maxform = 5;
 
let maxform = 5;
 
let resolution = new Array(5);
 
let resolution = new Array(5);
第15行: 第28行:
 
function calcGroup(attr, lv, rank, size, resolve) {
 
function calcGroup(attr, lv, rank, size, resolve) {
 
     let ratio = ratios[attr];
 
     let ratio = ratios[attr];
     let form = attr == 1 ? 1 : (attr == 0 ? resolve : 5);
+
     let form = attr == 1 ? 1 : (attr == 0 ? resolve+1 : 5);
 
     let base = type_coef[attr] * ratio * grow *
 
     let base = type_coef[attr] * ratio * grow *
 
         size_coef[size] * rank_coef[rank] * form / 1.25e7;
 
         size_coef[size] * rank_coef[rank] * form / 1.25e7;
第52行: 第65行:
 
         container.appendChild(radio);
 
         container.appendChild(radio);
 
         radio.addEventListener('click', e => {
 
         radio.addEventListener('click', e => {
             let val = +e.currentTarget.value + base;
+
             let val = +e.currentTarget.value;
 
             if (variables.size != val) {
 
             if (variables.size != val) {
 
                 variables.size = val;
 
                 variables.size = val;
第88行: 第101行:
 
         });
 
         });
 
     }
 
     }
     if (formCtrl) for (let i = 0; i < 5; i++) {
+
     if (formCtrl) {
        let label = document.createElement('label');
+
        for (let i = 0; i < 5; i++) {
        label.htmlFor = 'reso' + i;
+
            let label = document.createElement('label');
        label.textContent = '×' + i;
+
            label.htmlFor = 'reso' + i;
        formCtrl.appendChild(label);
+
            let labelImg = new Image();
 +
            labelImg.src = `/images/${formImgPaths[i]}/X${i+1}.png`;
 +
            labelImg.alt = '×' + (i+1);
 +
            label.append(labelImg);
 +
            formCtrl.appendChild(label);
 +
        }
 +
        formCtrl.children[4].className = 'checked';
 
     }
 
     }
 
     resCtrl.children[4].click();
 
     resCtrl.children[4].click();
第107行: 第126行:
 
     if (maxform == 5) addResFormControl(resCtrl, formCtrl);
 
     if (maxform == 5) addResFormControl(resCtrl, formCtrl);
 
     else {
 
     else {
         formCtrl.textContent = '×1';
+
         let x1Img = new Image();
 +
        x1Img.src = '/images/0/0d/X1.png';
 +
        x1Img.alt = '×1';
 +
        formCtrl.append(x1Img);
 
         addResFormControl(resCtrl);
 
         addResFormControl(resCtrl);
 
     }
 
     }
第144行: 第166行:
 
}
 
}
  
function main() {
+
function attrMain() {
 
     div = document.getElementById('attrs');
 
     div = document.getElementById('attrs');
 
     let unitid = div.dataset.id;
 
     let unitid = div.dataset.id;
     if (unitid < 2000 || unitid == 2006 || unitid == 3010) maxform = 1;
+
     if (unitid < 2000 || (unitid-2006)*(unitid-2018)*(unitid-3010) == 0) maxform = 1;
 
     variables.formation = maxform;
 
     variables.formation = maxform;
 +
    type = div.dataset.type;
 
     type_coef = [ [4.79, 3.67, 0.46, 0.55, 0.75, 0.18],
 
     type_coef = [ [4.79, 3.67, 0.46, 0.55, 0.75, 0.18],
 
         [3.84, 2.94, 0.42, 0.44, 0.60, 0.15],
 
         [3.84, 2.94, 0.42, 0.44, 0.60, 0.15],
         [3.60, 2.76, 0.42, 0.42, 0.57, 0.14]][div.dataset.type];
+
         [3.60, 2.76, 0.42, 0.42, 0.57, 0.14]][type];
 
     ratios = div.dataset.attrs.split(',').map(x => +x);
 
     ratios = div.dataset.attrs.split(',').map(x => +x);
 
     grow = div.dataset.grow;
 
     grow = div.dataset.grow;
第164行: 第187行:
 
     updateAttrs();
 
     updateAttrs();
 
     if (unitid > 2000) div.insertAdjacentHTML('beforebegin', `<style>
 
     if (unitid > 2000) div.insertAdjacentHTML('beforebegin', `<style>
#control #size1.checked { clip-path: path('M1,1h26v27h-10v5h-6v-5h-10v-27z'); }
+
#control #size0.checked { clip-path: path('M1,1h26v27h-10v5h-6v-5h-10v-27z'); }
#control #size2.checked { clip-path: path('M3,1h26v27h-8v5h-10v-5h-8v-27z'); }
+
#control #size1.checked { clip-path: path('M1,1h26v27h-9v5h-8v-5h-9v-27z'); }
#control #size3.checked { clip-path: path('M1,1h26v27h-5v5h-16v-5h-5v-27z'); }
+
#control #size2.checked { clip-path: path('M3,1h26v27h-7v5h-12v-5h-7v-27z'); }
 +
#control #size3.checked { clip-path: path('M1,1h26v27h-4v5h-18v-5h-4v-27z'); }
 
#control #size4.checked { clip-path: path('M3,1h26v27h-2v5h-22v-5h-2v-27z'); }
 
#control #size4.checked { clip-path: path('M3,1h26v27h-2v5h-22v-5h-2v-27z'); }
 
</style>`);
 
</style>`);
 
}
 
}
 
window.onload = main;
 
 
</script>
 
</script>

2023年3月23日 (四) 12:06的最新版本

<style>

  1. attr-th-1 { background: url(/images/9/9e/Data_Life.png) }
  2. attr-th-2 { background: url(/images/1/16/Data_Pow.png) }
  3. attr-th-3 { background: url(/images/7/72/Data_Rate.png) }
  4. attr-th-4 { background: url(/images/6/6d/Data_Hit.png) }
  5. attr-th-5 { background: url(/images/5/5f/Data_Dodge.png) }
  6. attr-th-6 { background: url(/images/8/89/Data_Armor.png) }
  7. attr-th-7 { background: url(/images/b/b2/Data_AP.png) }
  8. attr-th-8 { background: url(/images/5/5d/Data_Ct.png) }
  9. attr-th-9 { background: url(/images/1/12/Data_CtPow.png) }
  10. attr-th-10 { background: url(/images/2/2f/Data_Move.png) }
  11. attr-th-11 { background: url(/images/b/bb/Data_Range.png) }

</style><script> let type_coef; const size_coef = [100, 102, 105, 108, 110]; const rank_coef = [80, 90, 100, 110, 120]; const sizes = ['微', '小', '中', '大', '巨']; const formImgPaths = ['0/0d', 'a/a8', '5/5a', '0/05', '3/3e']; let div, type, ratios, grow; let maxform = 5; let resolution = new Array(5);

let variables = {size: 0, formation: 5, lv: 100, rank: 4, resolution: 4}; let stars; let resFlower; let checked = {size: null, rank: null};

function calcGroup(attr, lv, rank, size, resolve) {

   let ratio = ratios[attr];
   let form = attr == 1 ? 1 : (attr == 0 ? resolve+1 : 5);
   let base = type_coef[attr] * ratio * grow *
       size_coef[size] * rank_coef[rank] * form / 1.25e7;
   let accretion = type_coef[attr] * ratio * (lv - 1) * grow *
       size_coef[size] * rank_coef[rank] * form / 5e8;
   return Math.ceil(base + accretion) + (attr == 0 ? form : 1) * resolution[0][attr];

}

function calcSole(attr, lv, rank, size, resolve) {

   let ratio = ratios[attr];
   let base = type_coef[attr] * ratio * grow *
       size_coef[size] * rank_coef[rank] / 2.5e6;
   let accretion = type_coef[attr] * ratio * (lv - 1) * grow *
       size_coef[size] * rank_coef[rank] / 1e8;
   return Math.ceil(base + accretion) + resolution[resolve][attr];

}

function updateAttrs() {

   for (let i = 7; --i;) document.getElementById('attr-td-' + i).textContent = window.calcAttr(
       i-1, variables.lv, variables.rank, variables.size, variables.resolution);

}

function updateResSignal() {

   let res = variables.resolution;
   if (res) resFlower.setAttribute('mask', `url(#res${res})`);
   else resFlower.setAttribute('mask', );

}

function addSizeControl(container) {

   let sizes = ['微', '小', '中', '大', '巨'];
   for (let i = 0; i < 5; i++) {
       let radio = document.createElement('span');
       radio.textContent = sizes[i];
       radio.id = 'size' + i;
       radio.value = i;
       container.appendChild(radio);
       radio.addEventListener('click', e => {
           let val = +e.currentTarget.value;
           if (variables.size != val) {
               variables.size = val;
               updateAttrs();
           }
           if (checked.size) checked.size.className = ;
           checked.size = e.currentTarget;
           checked.size.className = 'checked';
       });
   }
   container.children[4].click();

}

function addResFormControl(resCtrl, formCtrl = null) {

   for (let i = 0; i < 5; i++) {
       let input = document.createElement('input');
       input.id = 'reso' + i;
       input.type = 'radio';
       input.value = i;
       input.name = 'resolution';
       resCtrl.appendChild(input);
       input.addEventListener('click', e => {
           let t = e.currentTarget;
           let val = +t.value;
           if (variables.resolution != val) {
               variables.resolution = val;
               updateAttrs();
               updateResSignal();
               if (t.labels.length) {
                   if (checked.formation) checked.formation.className = ;
                   checked.formation = t.labels[0];
                   checked.formation.className = 'checked';
               }
           }
       });
   }
   if (formCtrl) {
       for (let i = 0; i < 5; i++) {
           let label = document.createElement('label');
           label.htmlFor = 'reso' + i;
           let labelImg = new Image();
           labelImg.src = `/images/${formImgPaths[i]}/X${i+1}.png`;
           labelImg.alt = '×' + (i+1);
           label.append(labelImg);
           formCtrl.appendChild(label);
       }
       formCtrl.children[4].className = 'checked';
   }
   resCtrl.children[4].click();

}

function addControl() {

   let sizeCtrl = document.getElementById('size-control');
   let formCtrl = document.getElementById('formation-control');
   let resSignal = document.getElementById('resolve-signal');
   let lvCtrl = document.getElementById('lv-control');
   let rankCtrl = document.getElementById('rank-control');
   let resCtrl = document.getElementById('resolve-control');
   if (sizeCtrl) addSizeControl(sizeCtrl);
   if (maxform == 5) addResFormControl(resCtrl, formCtrl);
   else {
       let x1Img = new Image();
       x1Img.src = '/images/0/0d/X1.png';
       x1Img.alt = '×1';
       formCtrl.append(x1Img);
       addResFormControl(resCtrl);
   }
   resSignal.insertAdjacentHTML('beforeend', `<svg xmlns="http://www.w3.org/2000/svg" width="94" height="94"><defs><g id="diamonds"><polygon points="0,47 23.5,33 70.5,61 94,47 70.5,33 23.5,61"\/><polygon points="47,0 33,23.5 61,70.5 47,94 33,70.5 61,23.5"\/><\/g><\/defs><mask id="res1"><rect width="94" height="94" fill="#fff"\/><polygon points="0,0 94,0 47,47"\/><\/mask><mask id="res2"><rect width="94" height="94" fill="#fff"\/><polygon points="0,0 94,0 0,94 94,94"\/><\/mask><mask id="res3"><rect width="94" height="94"\/><polygon points="94,0 47,47 94,94" fill="#fff"\/><\/mask><mask id="res4"><rect width="94" height="94"\/><\/mask><rect x="23" y="23" width="48" height="48" fill="#3d3d3d"\/><use fill="#ff004e" href="#diamonds"\/><use id="flower" fill="#161616" mask="url(#res4)" href="#diamonds"\/><\/svg>`);
   resFlower = document.getElementById('flower');
   let lvLabel = document.createElement('label');
   lvLabel.textContent = '等级';
   let lvInput = document.createElement('input');
   lvInput.type = 'number';
   lvInput.max = 100;
   lvInput.min = 1;
   lvInput.value = 100;
   lvLabel.appendChild(lvInput);
   lvCtrl.appendChild(lvLabel);
   lvInput.addEventListener('input', e => {
       let val = e.currentTarget.value;
       if (variables.lv != val) {
           variables.lv = val;
           updateAttrs();
       }
   });
   stars = rankCtrl.children;
   for (let i = 5; i--;) stars[i].src = '/images/0/0a/StarWhite.svg';
   for (let i = 2 - type; i < 5; i++) {
       let star = stars[i];
       stars[i].addEventListener('click', e => {
           let rank = +e.currentTarget.dataset.id;
           if (variables.rank != rank) {
               variables.rank = rank;
               for (let j = 3 - type; j <= rank; j++) stars[j].className = ;
               for (let j = rank + 1; j < 5; j++) stars[j].className = 'star-dark';
               updateAttrs();
           }
       });
   }

}

function attrMain() {

   div = document.getElementById('attrs');
   let unitid = div.dataset.id;
   if (unitid < 2000 || (unitid-2006)*(unitid-2018)*(unitid-3010) == 0) maxform = 1;
   variables.formation = maxform;
   type = div.dataset.type;
   type_coef = [ [4.79, 3.67, 0.46, 0.55, 0.75, 0.18],
       [3.84, 2.94, 0.42, 0.44, 0.60, 0.15],
       [3.60, 2.76, 0.42, 0.42, 0.57, 0.14]][type];
   ratios = div.dataset.attrs.split(',').map(x => +x);
   grow = div.dataset.grow;
   let r2d = div.dataset.resolution.split(';');
   for (let i = 0; i < 5; i++) {
       rs = r2d[i].split(',');
       resolution[i] = new Array(6);
       for (let j = 0; j < 6; j++) resolution[i][j] = +rs[j];
   }
   window.calcAttr = maxform == 5 ? calcGroup : calcSole;
   addControl();
   updateAttrs();
   if (unitid > 2000) div.insertAdjacentHTML('beforebegin', `<style>
  1. control #size0.checked { clip-path: path('M1,1h26v27h-10v5h-6v-5h-10v-27z'); }
  2. control #size1.checked { clip-path: path('M1,1h26v27h-9v5h-8v-5h-9v-27z'); }
  3. control #size2.checked { clip-path: path('M3,1h26v27h-7v5h-12v-5h-7v-27z'); }
  4. control #size3.checked { clip-path: path('M1,1h26v27h-4v5h-18v-5h-4v-27z'); }
  5. control #size4.checked { clip-path: path('M3,1h26v27h-2v5h-22v-5h-2v-27z'); }

</style>`); } </script>