diff --git a/script-json_data.js b/script-json_data.js index 91f633cd..a2049901 100644 --- a/script-json_data.js +++ b/script-json_data.js @@ -956,7 +956,7 @@ const specialSearchFunctions = (function() { break; } case 154:{ - outArr.push(changes(flags(sk[0] || 1), flags(sk[1] || 1))); + outArr.push(changes(Bin.unflags(sk[0] || 1), Bin.unflags(sk[1] || 1))); break; } } @@ -988,20 +988,20 @@ const specialSearchFunctions = (function() { { outArr.push({ count: sk[0], - to: flags(sk[1] || 1), - exclude: flags(sk[2]), + to: Bin.unflags(sk[1] || 1), + exclude: Bin.unflags(sk[2]), }); }else { outArr.push({ count: sk[0], - to: flags(sk[1] || 1), - exclude: flags(sk[2]), + to: Bin.unflags(sk[1] || 1), + exclude: Bin.unflags(sk[2]), }); outArr.push({ count: sk[3], - to: flags(sk[4] || 1), - exclude: flags(sk[5]), + to: Bin.unflags(sk[4] || 1), + exclude: Bin.unflags(sk[5]), }); } } @@ -1030,7 +1030,7 @@ const specialSearchFunctions = (function() { const sk = skill.params; const fragment = document.createDocumentFragment(); fragment.appendChild(createSkillIcon('orb-locked')); - fragment.appendChild(createOrbsList(flags(sk[0] || 1))); + fragment.appendChild(createOrbsList(Bin.unflags(sk[0] || 1))); return fragment; } function dropLock_Addition(card) @@ -1040,7 +1040,7 @@ const specialSearchFunctions = (function() { if (!skill) return; const sk = skill.params; const fragment = document.createDocumentFragment(); - fragment.appendChild(createOrbsList(flags(sk[0] != -1 ? sk[0] : 0b1111111111), 'locked')); + fragment.appendChild(createOrbsList(Bin.unflags(sk[0] != -1 ? sk[0] : 0b1111111111), 'locked')); fragment.appendChild(document.createTextNode(`×${sk[1]}T`)); return fragment; } @@ -1051,7 +1051,7 @@ const specialSearchFunctions = (function() { if (!skill) return; const sk = skill.params; - const colors = flags(sk[0]); + const colors = Bin.unflags(sk[0]); const fragment = document.createDocumentFragment(); fragment.appendChild(createOrbsList(colors, 'drop')); @@ -1068,7 +1068,7 @@ const specialSearchFunctions = (function() { const colors = []; for (let ai=0;ai 0) { outObj.skilltype = 1; - outObj.attrs = flags(sk[1]); - outObj.types = flags(sk[2]); + outObj.attrs = Bin.unflags(sk[1]); + outObj.types = Bin.unflags(sk[2]); outObj.turns = sk[0]; outObj.rate = sk[3]; } @@ -1345,8 +1345,8 @@ const specialSearchFunctions = (function() { const sk = skill.params; if (skill.type == 228 && sk[4] > 0) { outObj.skilltype = 1; - outObj.attrs = flags(sk[1]); - outObj.types = flags(sk[2]); + outObj.attrs = Bin.unflags(sk[1]); + outObj.types = Bin.unflags(sk[2]); outObj.turns = sk[0]; outObj.rate = sk[4]; } else if (skill.type == 231 && sk[7] > 0) { @@ -1967,7 +1967,7 @@ const specialSearchFunctions = (function() { attrs = sk.slice(0,-1); break; } case 140:{ - attrs = flags(sk[0]); break; + attrs = Bin.unflags(sk[0]); break; } } const fragment = document.createDocumentFragment(); @@ -1989,7 +1989,7 @@ const specialSearchFunctions = (function() { const sk = skill.params; const fragment = document.createDocumentFragment(); fragment.appendChild(document.createTextNode(`自封`)); - fragment.appendChild(createOrbsList(flags(sk[1] || 1))); + fragment.appendChild(createOrbsList(Bin.unflags(sk[1] || 1))); fragment.appendChild(document.createTextNode(`×${sk[0]}T`)); return fragment; } @@ -2393,7 +2393,7 @@ const specialSearchFunctions = (function() { const fragment = document.createDocumentFragment(); fragment.append(createSkillIcon('board-roulette')); if (skill.type == 249) { - fragment.append(createOrbsList(flags(sk[1]))); + fragment.append(createOrbsList(Bin.unflags(sk[1]))); } fragment.append(`${sk[7]? sk[7] : '固定'+sk.slice(2,7).flatMap(flags).length }`,`×${sk[0]}T`); return fragment; @@ -2428,7 +2428,7 @@ const specialSearchFunctions = (function() { const skill = getCardActiveSkill(card, searchTypeArray); if (!skill) return; const sk = skill.params; - const colums = flags(sk[1]), rows = flags(sk[2]); + const colums = Bin.unflags(sk[1]), rows = Bin.unflags(sk[2]); const fragment = document.createDocumentFragment(); if (colums.length) fragment.append(`${colums.length}竖`); @@ -2597,7 +2597,7 @@ const specialSearchFunctions = (function() { const fragment = document.createDocumentFragment(); fragment.append(createSkillIcon('orb-thorn')); if ((sk[1] & 0b1111111111) != 1023) { - let attrs = flags(sk[1]); + let attrs = Bin.unflags(sk[1]); fragment.append(createOrbsList(attrs)); } fragment.append(`${sk[3]}%×${sk[0]}T`, document.createElement("br"), "/" ,createSkillIcon('maxhp-locked'), `${sk[2]}%`); @@ -2889,7 +2889,7 @@ const specialSearchFunctions = (function() { function:cards=>cards.filter(card=>{ function is30(sk) { - return Boolean(flags(sk[1]).length * sk[0] == 30); + return Boolean(Bin.unflags(sk[1]).length * sk[0] == 30); } const searchTypeArray = [141]; const skill = getCardActiveSkill(card, searchTypeArray); @@ -2901,7 +2901,7 @@ const specialSearchFunctions = (function() { function:cards=>cards.filter(card=>{ function is1515(sk) { - return Boolean(flags(sk[1]).length == 2 && sk[0] == 15); + return Boolean(Bin.unflags(sk[1]).length == 2 && sk[0] == 15); } const searchTypeArray = [141]; const skill = getCardActiveSkill(card, searchTypeArray); @@ -3115,7 +3115,7 @@ const specialSearchFunctions = (function() { function:cards=>cards.filter(card=>{ const searchTypeArray = [128]; const skill = getCardActiveSkill(card, searchTypeArray); - return skill && (skill.params.length>=3 || flags(skill.params[0]).length>=2); + return skill && (skill.params.length>=3 || Bin.unflags(skill.params[0]).length>=2); }), addition:generateRowOrbs_Addition }, @@ -3503,7 +3503,7 @@ const specialSearchFunctions = (function() { if (!skill) return; const sk = skill.params; const fragment = document.createDocumentFragment(); - fragment.append(createOrbsList(flags(sk[0])), sk[2] ? `≤${sk[2]}` : `≥${sk[1]}`); + fragment.append(createOrbsList(Bin.unflags(sk[0])), sk[2] ? `≤${sk[2]}` : `≥${sk[1]}`); return fragment; } }, @@ -3568,7 +3568,7 @@ const specialSearchFunctions = (function() { const fragment = document.createDocumentFragment(); const sup = document.createElement("sup"); sup.textContent = "N"; - const orbs = createOrbsList(flags(sk[0])); + const orbs = createOrbsList(Bin.unflags(sk[0])); fragment.append(`ATK×${sk[3]/100}`,sup,"/",orbs); if (sk[1]) { fragment.append(`×≥${sk[1]}`); @@ -3675,7 +3675,7 @@ const specialSearchFunctions = (function() { const skill = getCardLeaderSkill(card, searchTypeArray); if (!skill) return; const sk = skill.params; - const attrs = flags(sk[0]), types = flags(sk[1]); + const attrs = Bin.unflags(sk[0]), types = Bin.unflags(sk[1]); const fragment = document.createDocumentFragment(); if (attrs.length) fragment.appendChild(createOrbsList(attrs)); @@ -3737,7 +3737,7 @@ const specialSearchFunctions = (function() { let skill; if (skill = getCardLeaderSkill(card, [235])) { nodeArr.push("/"); - nodeArr.push(createOrbsList(flags(skill.params[0]))); + nodeArr.push(createOrbsList(Bin.unflags(skill.params[0]))); nodeArr.push(`×${skill.params[2]}`); } return nodeArr.nodeJoin(); @@ -3761,7 +3761,7 @@ const specialSearchFunctions = (function() { nodeArr.push("/十字"); } else if (skill = getCardLeaderSkill(card, [235])) { nodeArr.push("/"); - nodeArr.push(createOrbsList(flags(skill.params[0]))); + nodeArr.push(createOrbsList(Bin.unflags(skill.params[0]))); nodeArr.push(`×${skill.params[2]}`); } return nodeArr.nodeJoin(); @@ -3810,7 +3810,7 @@ const specialSearchFunctions = (function() { const skill = getCardLeaderSkill(card, searchTypeArray); if (!skill) return; const sk = skill.params; - let attrs = flags(sk[0]), types = flags(sk[1]), awakenings = sk.slice(2); + let attrs = Bin.unflags(sk[0]), types = Bin.unflags(sk[1]), awakenings = sk.slice(2); const fragment = document.createDocumentFragment(); if (attrs.length) fragment.appendChild(createOrbsList(attrs)); diff --git a/script-skill-parser.js b/script-skill-parser.js index 809cb6bb..940c866e 100644 --- a/script-skill-parser.js +++ b/script-skill-parser.js @@ -796,23 +796,6 @@ function skillParser(skillId) return skills; } -//返回flag里值为true的数组,如[1,4,7] -function flags(num){ - /* - return Array.from(new Array(32),(i,n)=>n).filter(n => num & (1 << n)); //性能太差 - return new Array(32).fill(null).map((i,n)=>n).filter(n => num & (1 << n)); //性能比上者好,但还是不够快 - */ - const arr = []; - for (let i = 0; i<32;i++) - { - if (num & (1< this.parser(id))); }, - [119](attrs, min, base, bonus, max) { return powerUp(null, null, p.scaleMatchLength(flags(attrs), min, max, [base || 100, 100], [bonus, 0])); }, + [119](attrs, min, base, bonus, max) { return powerUp(null, null, p.scaleMatchLength(Bin.unflags(attrs), min, max, [base || 100, 100], [bonus, 0])); }, - [121](attrs, types, hp, atk, rcv) { return powerUp(flags(attrs), flags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 })); }, - [122](percent, attrs, types, atk, rcv) { return powerUp(flags(attrs), flags(types), p.mul({ atk: atk || 100, rcv: rcv || 100 }), c.hp(0, percent)); }, - [123](percent, attrs, types, atk, rcv) { return powerUp(flags(attrs), flags(types), p.mul({ atk: atk || 100, rcv: rcv || 100 }), c.hp(percent, 100)); }, + [121](attrs, types, hp, atk, rcv) { return powerUp(Bin.unflags(attrs), Bin.unflags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 })); }, + [122](percent, attrs, types, atk, rcv) { return powerUp(Bin.unflags(attrs), Bin.unflags(types), p.mul({ atk: atk || 100, rcv: rcv || 100 }), c.hp(0, percent)); }, + [123](percent, attrs, types, atk, rcv) { return powerUp(Bin.unflags(attrs), Bin.unflags(types), p.mul({ atk: atk || 100, rcv: rcv || 100 }), c.hp(percent, 100)); }, [124](attrs1, attrs2, attrs3, attrs4, attrs5, min, mul, bonus) { const attrs = [attrs1, attrs2, attrs3, attrs4, attrs5].filter(Boolean); return powerUp(null, null, p.scaleMatchAttrs(attrs.flatMap(flags), min, bonus ? attrs.length : min, [mul, 100], [bonus, 0])); }, [125](mon1, mon2, mon3, mon4, mon5, hp, atk, rcv) { return powerUp(null, null, p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 }), c.compo('card', [mon1, mon2, mon3, mon4, mon5].filter(Boolean))); }, - [126](attrs, turns, turns2, percent) { return activeTurns(turns === turns2 ? turns : [turns, turns2], orbDropIncrease(v.percent(percent), flags(attrs))); }, + [126](attrs, turns, turns2, percent) { return activeTurns(turns === turns2 ? turns : [turns, turns2], orbDropIncrease(v.percent(percent), Bin.unflags(attrs))); }, [127](cols1, attrs1, cols2, attrs2) { return fixedOrbs( - { orbs: flags(attrs1), type: 'col', positions: flags(cols1) }, - { orbs: flags(attrs2), type: 'col', positions: flags(cols2) } + { orbs: Bin.unflags(attrs1), type: 'col', positions: Bin.unflags(cols1) }, + { orbs: Bin.unflags(attrs2), type: 'col', positions: Bin.unflags(cols2) } ); }, [128](rows1, attrs1, rows2, attrs2) { return fixedOrbs( - { orbs: flags(attrs1), type: 'row', positions: flags(rows1) }, - { orbs: flags(attrs2), type: 'row', positions: flags(rows2) } + { orbs: Bin.unflags(attrs1), type: 'row', positions: Bin.unflags(rows1) }, + { orbs: Bin.unflags(attrs2), type: 'row', positions: Bin.unflags(rows2) } ); }, [129](attrs, types, hp, atk, rcv, rAttrs, rPercent) { return [ - (hp || atk || rcv) && powerUp(flags(attrs), flags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 })) || null, - rPercent && reduceDamage(flags(rAttrs), v.percent(rPercent)) || null + (hp || atk || rcv) && powerUp(Bin.unflags(attrs), Bin.unflags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 })) || null, + rPercent && reduceDamage(Bin.unflags(rAttrs), v.percent(rPercent)) || null ].filter(Boolean); }, [130](percent, attrs, types, atk, rcv, rAttrs, rPercent) { return [ - (atk || rcv) && powerUp(flags(attrs), flags(types), p.mul({ atk: atk || 100, rcv: rcv || 100 }), c.hp(0, percent)) || null, - rPercent && reduceDamage(flags(rAttrs), v.percent(rPercent), c.hp(0, percent)) || null + (atk || rcv) && powerUp(Bin.unflags(attrs), Bin.unflags(types), p.mul({ atk: atk || 100, rcv: rcv || 100 }), c.hp(0, percent)) || null, + rPercent && reduceDamage(Bin.unflags(rAttrs), v.percent(rPercent), c.hp(0, percent)) || null ].filter(Boolean); }, [131](percent, attrs, types, atk, rcv, rAttrs, rPercent) { return [ - (atk || rcv) && powerUp(flags(attrs), flags(types), p.mul({ atk: atk || 100, rcv: rcv || 100 }), c.hp(percent, 100)) || null, - rPercent && reduceDamage(flags(rAttrs), v.percent(rPercent), c.hp(percent, 100)) || null + (atk || rcv) && powerUp(Bin.unflags(attrs), Bin.unflags(types), p.mul({ atk: atk || 100, rcv: rcv || 100 }), c.hp(percent, 100)) || null, + rPercent && reduceDamage(Bin.unflags(rAttrs), v.percent(rPercent), c.hp(percent, 100)) || null ].filter(Boolean); }, [132](turns, time, percent) { return activeTurns(turns, timeExtend(time ? v.constant(time / 10) : v.percent(percent))); }, - [133](attrs, types, atk, rcv) { return powerUp(flags(attrs), flags(types), p.mul({ atk: atk || 100, rcv: rcv || 100 }), c.useSkill()); }, + [133](attrs, types, atk, rcv) { return powerUp(Bin.unflags(attrs), Bin.unflags(types), p.mul({ atk: atk || 100, rcv: rcv || 100 }), c.useSkill()); }, [136](attrs1, hp1, atk1, rcv1, attrs2, hp2, atk2, rcv2) { return [ - powerUp(flags(attrs1), null, p.mul({ hp: hp1 || 100, atk: atk1 || 100, rcv: rcv1 || 100 })), - powerUp(flags(attrs2), null, p.mul({ hp: hp2 || 100, atk: atk2 || 100, rcv: rcv2 || 100 })), + powerUp(Bin.unflags(attrs1), null, p.mul({ hp: hp1 || 100, atk: atk1 || 100, rcv: rcv1 || 100 })), + powerUp(Bin.unflags(attrs2), null, p.mul({ hp: hp2 || 100, atk: atk2 || 100, rcv: rcv2 || 100 })), ]; }, [137](types1, hp1, atk1, rcv1, types2, hp2, atk2, rcv2) { return [ - powerUp(null, flags(types1), p.mul({ hp: hp1 || 100, atk: atk1 || 100, rcv: rcv1 || 100 })), - powerUp(null, flags(types2), p.mul({ hp: hp2 || 100, atk: atk2 || 100, rcv: rcv2 || 100 })), + powerUp(null, Bin.unflags(types1), p.mul({ hp: hp1 || 100, atk: atk1 || 100, rcv: rcv1 || 100 })), + powerUp(null, Bin.unflags(types2), p.mul({ hp: hp2 || 100, atk: atk2 || 100, rcv: rcv2 || 100 })), ]; }, [138](...ids) { return ids.flatMap(id => this.parser(id)); }, [139](attrs, types, percent1, less1, mul1, percent2, less2, mul2) { return [ - powerUp(flags(attrs), flags(types), p.mul({ atk: mul1 || 100 }), less1 ? c.hp(0, percent1) : c.hp(percent1, 100)), - powerUp(flags(attrs), flags(types), p.mul({ atk: mul2 || 100 }), less1 ? + powerUp(Bin.unflags(attrs), Bin.unflags(types), p.mul({ atk: mul1 || 100 }), less1 ? c.hp(0, percent1) : c.hp(percent1, 100)), + powerUp(Bin.unflags(attrs), Bin.unflags(types), p.mul({ atk: mul2 || 100 }), less1 ? (less2 ? c.hp(percent1, percent2) : c.hp(percent2, 100)) : (less2 ? c.hp(0, percent2) : c.hp(percent2, percent1 - 1)) ), ]; }, - [140](attrs, mul) { return setOrbState(flags(attrs), 'enhanced', {enhance: v.percent(mul)}); }, - [141](count, to, exclude) { return generateOrbs(flags(to), flags(exclude), count); }, + [140](attrs, mul) { return setOrbState(Bin.unflags(attrs), 'enhanced', {enhance: v.percent(mul)}); }, + [141](count, to, exclude) { return generateOrbs(Bin.unflags(to), Bin.unflags(exclude), count); }, [142](turns, attr) { return activeTurns(turns, changeAttr('self', attr)); }, [143](mul, dmgAttr) { return damageEnemy('all', dmgAttr ?? 0, v.xTeamHP(mul)); }, - [144](teamAttrs, mul, single, dmgAttr) { return damageEnemy(single ? 'single' : 'all', dmgAttr ?? 0, v.xTeamATK(flags(teamAttrs), mul)); }, + [144](teamAttrs, mul, single, dmgAttr) { return damageEnemy(single ? 'single' : 'all', dmgAttr ?? 0, v.xTeamATK(Bin.unflags(teamAttrs), mul)); }, [145](mul) { return heal(v.xTeamRCV(mul)); }, [146](turns1, turns2) { return skillBoost(v.constant(turns1), turns2 ? v.constant(turns2) : undefined); }, @@ -1323,10 +1306,10 @@ const skillObjectParsers = { [151](mul1, mul2, percent) { return powerUp(null, null, p.scaleCross([{ single: true, attr: [Attributes.Heart], atk: mul1 || 100, rcv: mul2 || 100 }]), null, v.percent(percent)); }, - [152](attrs, count) { return setOrbState(flags(attrs), 'locked', {count: v.constant(count)}); }, + [152](attrs, count) { return setOrbState(Bin.unflags(attrs), 'locked', {count: v.constant(count)}); }, [153](attr, _) { return changeAttr('opponent', attr); }, - [154](from, to) { return changeOrbs(fromTo(flags(from), flags(to))); }, - [155](attrs, types, hp, atk, rcv) { return powerUp(flags(attrs), flags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 }), c.multiplayer()); }, + [154](from, to) { return changeOrbs(fromTo(Bin.unflags(from), Bin.unflags(to))); }, + [155](attrs, types, hp, atk, rcv) { return powerUp(Bin.unflags(attrs), Bin.unflags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 }), c.multiplayer()); }, [156](turns, awoken1, awoken2, awoken3, type, mul) { if (type == 1) { @@ -1350,18 +1333,18 @@ const skillObjectParsers = { [158](len, attrs, types, atk, hp, rcv) { return [ minMatch(len), - powerUp(flags(attrs), flags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 })) + powerUp(Bin.unflags(attrs), Bin.unflags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 })) ]; }, - [159](attrs, min, base, bonus, max) { return powerUp(null, null, p.scaleMatchLength(flags(attrs), min, max, [base, 100], [bonus, 0])); }, + [159](attrs, min, base, bonus, max) { return powerUp(null, null, p.scaleMatchLength(Bin.unflags(attrs), min, max, [base, 100], [bonus, 0])); }, [160](turns, combo) { return activeTurns(turns, addCombo(combo)); }, [161](percent) { return gravity(v.xMaxHP(percent)); }, [162]() { return boardSizeChange(); }, [163](attrs, types, hp, atk, rcv, rAttrs, rPercent) { return [ noSkyfall(), - (hp || atk || rcv) && powerUp(flags(attrs), flags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 })) || null, - rPercent && reduceDamage(flags(rAttrs), v.percent(rPercent)) || null, + (hp || atk || rcv) && powerUp(Bin.unflags(attrs), Bin.unflags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 })) || null, + rPercent && reduceDamage(Bin.unflags(rAttrs), v.percent(rPercent)) || null, ].filter(Boolean); }, [164](attrs1, attrs2, attrs3, attrs4, min, atk, rcv, bonus) { @@ -1369,21 +1352,21 @@ const skillObjectParsers = { return powerUp(null, null, p.scaleMatchAttrs(attrs.flatMap(flags), min, attrs.length, [atk, rcv], [bonus, bonus])); }, [165](attrs, min, baseAtk, baseRcv, bonusAtk, bonusRcv, incr) { - const attrsArr = flags(attrs); + const attrsArr = Bin.unflags(attrs); return powerUp(null, null, p.scaleAttrs(attrsArr, min, min + (min < attrsArr.length ? (incr ?? 0) : 0), [baseAtk || 100, baseRcv || 100], [bonusAtk, bonusRcv])); }, [166](min, baseAtk, baseRcv, bonusAtk, bonusRcv, max) { return powerUp(null, null, p.scaleCombos(min, max, [baseAtk, baseRcv], [bonusAtk, bonusRcv])); }, - [167](attrs, min, baseAtk, baseRcv, bonusAtk, bonusRcv, max) { return powerUp(null, null, p.scaleMatchLength(flags(attrs), min, max, [baseAtk, baseRcv], [bonusAtk, bonusRcv])); }, + [167](attrs, min, baseAtk, baseRcv, bonusAtk, bonusRcv, max) { return powerUp(null, null, p.scaleMatchLength(Bin.unflags(attrs), min, max, [baseAtk, baseRcv], [bonusAtk, bonusRcv])); }, [168](turns, awoken1, awoken2, awoken3, awoken4, awoken5, awoken6, mul) { return activeTurns(turns, powerUp(null, null, p.scaleStateKind([awoken1, awoken2, awoken3, awoken4, awoken5, awoken6].filter(Boolean), null, null, p.mul({atk: mul, hp:0, rcv:0}))) ); }, [169](min, base, percent, bonus, max) { return powerUp(null, null, p.scaleCombos(min, max ?? min, [base || 100, 100], [bonus, 0]), null, v.percent(percent)); }, - //stage的真实用法目前不知道,缺少样本来判断,不知道到底是直接算数(stage-1)还是算二进制个数(flags(stage).length)。 2022年5月23日 + //stage的真实用法目前不知道,缺少样本来判断,不知道到底是直接算数(stage-1)还是算二进制个数(Bin.unflags(stage).length)。 2022年5月23日 //按 瘦鹅 的说法,也可能是因为暗牛头限制了5色, 所以就算是3级到了6色,也只算5色。 [170](attrs, min, base, percent, bonus, stage) { - let attrsArr = flags(attrs); + let attrsArr = Bin.unflags(attrs); return powerUp(null, null, p.scaleAttrs(attrsArr, min, Math.min(min + (stage || 0), attrsArr.length), [base, 100], [bonus ?? 0, 0]), null, v.percent(percent)); }, [171](attrs1, attrs2, attrs3, attrs4, min, mul, percent, bonus) { @@ -1403,27 +1386,27 @@ const skillObjectParsers = { [175](series1, series2, series3, hp, atk, rcv) { return powerUp(null, null, p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 }), c.compo('series', [series1, series2, series3].filter(Boolean))); }, [176](row1, row2, row3, row4, row5, attrs) { return fixedOrbs( - { orbs: [attrs ?? 0], type: 'shape', positions: [row1, row2, row3, row4, row5].map(row=>flags(row)) } + { orbs: [attrs ?? 0], type: 'shape', positions: [row1, row2, row3, row4, row5].map(row=>Bin.unflags(row)) } ); }, [177](attrs, types, hp, atk, rcv, remains, baseAtk, bonusAtk) { return [ noSkyfall(), - (hp || atk || rcv) && powerUp(flags(attrs), flags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 })) || null, + (hp || atk || rcv) && powerUp(Bin.unflags(attrs), Bin.unflags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 })) || null, baseAtk && powerUp(null, null, p.scaleRemainOrbs(remains, [baseAtk ?? 100, 100], [bonusAtk ?? 0, 0])) || null ].filter(Boolean); }, [178](time, attrs, types, hp, atk, rcv, attrs2, percent) { return [ fixedTime(time), - (hp || atk || rcv) && powerUp(flags(attrs), flags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 })), - percent && reduceDamage(flags(attrs2), v.percent(percent)) || null, + (hp || atk || rcv) && powerUp(Bin.unflags(attrs), Bin.unflags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 })), + percent && reduceDamage(Bin.unflags(attrs2), v.percent(percent)) || null, ].filter(Boolean); - /*const reduceAttrs = flags(attrs2); + /*const reduceAttrs = Bin.unflags(attrs2); const isAllAttr = isEqual(reduceAttrs, Attributes.attr); return [ fixedTime(time), - (hp || atk || rcv) && powerUp(flags(attrs), flags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 }), null, isAllAttr ? v.percent(percent) : null), + (hp || atk || rcv) && powerUp(Bin.unflags(attrs), Bin.unflags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 }), null, isAllAttr ? v.percent(percent) : null), percent && !isAllAttr && reduceDamage(reduceAttrs, v.percent(percent)) || null, ].filter(Boolean);*/ }, @@ -1435,24 +1418,24 @@ const skillObjectParsers = { }, [180](turns, percent) { return activeTurns(turns, orbDropIncrease(v.percent(percent), [], 'enhanced')); }, - [182](attrs, len, mul, percent) { return powerUp(null, null, p.scaleMatchLength(flags(attrs), len, len, [mul || 100, 100], [0, 0]), null, v.percent(percent)); }, + [182](attrs, len, mul, percent) { return powerUp(null, null, p.scaleMatchLength(Bin.unflags(attrs), len, len, [mul || 100, 100], [0, 0]), null, v.percent(percent)); }, [183](attrs, types, percent1, atk1, reduce, percent2, atk2, rcv2) { return [ - (percent1 > 0) && powerUp(flags(attrs), flags(types), p.mul({ atk: atk1 || 100 }), c.hp(percent1, 100), v.percent(reduce)) || null, - (atk2 || rcv2) && powerUp(flags(attrs), flags(types), p.mul({ atk: atk2 || 100, rcv: rcv2 || 100 }), c.hp(0, percent2 || percent1)) || null + (percent1 > 0) && powerUp(Bin.unflags(attrs), Bin.unflags(types), p.mul({ atk: atk1 || 100 }), c.hp(percent1, 100), v.percent(reduce)) || null, + (atk2 || rcv2) && powerUp(Bin.unflags(attrs), Bin.unflags(types), p.mul({ atk: atk2 || 100, rcv: rcv2 || 100 }), c.hp(0, percent2 || percent1)) || null ].filter(Boolean); }, [184](turns) { return activeTurns(turns, noSkyfall()); }, [185](time, attrs, types, hp, atk, rcv) { return [ timeExtend(v.constant(time / 100)), - powerUp(flags(attrs), flags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 })), + powerUp(Bin.unflags(attrs), Bin.unflags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 })), ]; }, [186](attrs, types, hp, atk, rcv) { return [ boardSizeChange(), - (hp || atk ||rcv) && powerUp(flags(attrs), flags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 })) || null, + (hp || atk ||rcv) && powerUp(Bin.unflags(attrs), Bin.unflags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 })) || null, ].filter(Boolean); }, @@ -1471,13 +1454,13 @@ const skillObjectParsers = { return activeTurns(turns, voidEnemyBuff(['damage-void'])); }, [192](attrs, len, mul, combo) { - return powerUp(null, null, p.scaleMatchLength(flags(attrs), len, len, [mul || 100, 100], [0, 0], true), null, null, combo ? [addCombo(combo)] : null); + return powerUp(null, null, p.scaleMatchLength(Bin.unflags(attrs), len, len, [mul || 100, 100], [0, 0], true), null, null, combo ? [addCombo(combo)] : null); }, [193](attrs, atk, rcv, percent) { - return powerUp(null, null, p.mul([atk || 100, rcv || 100]), c.LShape(flags(attrs)), v.percent(percent)); + return powerUp(null, null, p.mul([atk || 100, rcv || 100]), c.LShape(Bin.unflags(attrs)), v.percent(percent)); }, [194](attrs, min, mul, combo) { - return powerUp(null, null, p.scaleAttrs(flags(attrs), min, min, [mul || 100, 100], [0, 0]), null, null, combo ? [addCombo(combo)] : null); + return powerUp(null, null, p.scaleAttrs(Bin.unflags(attrs), min, min, [mul || 100, 100], [0, 0]), null, null, combo ? [addCombo(combo)] : null); }, [195](percent) { return selfHarm(percent ? v.xCHP(100 - percent) : v.constantTo(1)); @@ -1492,10 +1475,10 @@ const skillObjectParsers = { return powerUp(null, null, p.mul([atk || 100, 100]), c.heal(heal), percent && v.percent(percent), awokenBind && [unbind(0, awokenBind ?? 0)]); }, [199](attrs, min, damage) { - return powerUp(null, null, p.scaleAttrs(flags(attrs), min, min, [100, 100], [0, 0]), null, null, [followAttackFixed(damage)]); + return powerUp(null, null, p.scaleAttrs(Bin.unflags(attrs), min, min, [100, 100], [0, 0]), null, null, [followAttackFixed(damage)]); }, [200](attrs, len, damage) { - return powerUp(null, null, p.scaleMatchLength(flags(attrs), len, len, [100, 100], [0, 0]), null, null, [followAttackFixed(damage)]); + return powerUp(null, null, p.scaleMatchLength(Bin.unflags(attrs), len, len, [100, 100], [0, 0]), null, null, [followAttackFixed(damage)]); }, [201](attrs1, attrs2, attrs3, attrs4, min, damage) { const attrs = [attrs1, attrs2, attrs3, attrs4].filter(Boolean); @@ -1516,7 +1499,7 @@ const skillObjectParsers = { c.compo('evolution', [evotype])); }, - [205](attrs, turns) { return activeTurns(turns, orbDropIncrease(null, flags(attrs == -1 ? 0b1111111111: attrs), 'locked')); }, + [205](attrs, turns) { return activeTurns(turns, orbDropIncrease(null, Bin.unflags(attrs == -1 ? 0b1111111111: attrs), 'locked')); }, [206](attrs1, attrs2, attrs3, attrs4, attrs5, min, combo) { const attrs = [attrs1, attrs2, attrs3, attrs4, attrs5].filter(Boolean); return powerUp(null, null, p.scaleMatchAttrs(attrs.flatMap(flags), min, min, [100, 100], [0, 0]), null, null, combo ? [addCombo(combo)] : null); @@ -1524,7 +1507,7 @@ const skillObjectParsers = { [207](turns, time, row1, row2, row3, row4, row5, count) { /*return activeTurns(turns, count ? generateOrbs( ['variation'], null, count, time/100): - fixedOrbs( { orbs: ['variation'], time: time/100, type: 'shape', positions: [row1, row2, row3, row4, row5].map(row=>flags(row)) }) + fixedOrbs( { orbs: ['variation'], time: time/100, type: 'shape', positions: [row1, row2, row3, row4, row5].map(row=>Bin.unflags(row)) }) );*/ const options = { time: time/100}; if (count) { @@ -1538,21 +1521,21 @@ const skillObjectParsers = { }, [208](count1, to1, exclude1, count2, to2, exclude2) { return [ - generateOrbs(flags(to1), flags(exclude1), count1), - generateOrbs(flags(to2), flags(exclude2), count2), + generateOrbs(Bin.unflags(to1), Bin.unflags(exclude1), count1), + generateOrbs(Bin.unflags(to2), Bin.unflags(exclude2), count2), ]; }, [209](combo) { return powerUp(null, null, p.scaleCross([{ single: true, attr: [Attributes.Heart], atk: 100, rcv: 100}]), null, null, combo ? [addCombo(combo)] : null); }, [210](attrs, reduce, combo) { - return powerUp(null, null, p.scaleCross([{ single: false, attr: flags(attrs), atk: 100, rcv: 100}]), null, v.percent(reduce), combo ? [addCombo(combo)] : null); + return powerUp(null, null, p.scaleCross([{ single: false, attr: Bin.unflags(attrs), atk: 100, rcv: 100}]), null, v.percent(reduce), combo ? [addCombo(combo)] : null); }, [213](attrs, types, ...awakenings) { //赋予觉醒的队长技 - return impartAwakenings(flags(attrs), flags(types), awakenings); + return impartAwakenings(Bin.unflags(attrs), Bin.unflags(types), awakenings); }, [214](turns) { return activeTurns(turns, bindSkill()); }, - [215](turns, attrs) { return activeTurns(turns, setOrbState(flags(attrs), 'bound')); }, + [215](turns, attrs) { return activeTurns(turns, setOrbState(Bin.unflags(attrs), 'bound')); }, [217](rarity, hp, atk, rcv) { return powerUp(null, null, p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 }), @@ -1561,14 +1544,14 @@ const skillObjectParsers = { [218](turns) { return skillBoost(v.constant(-turns)); }, [219](attrs, len, combo) { - return powerUp(null, null, p.scaleMatchLength(flags(attrs), len, len, [100, 100], [0, 0]), null, null, combo ? [addCombo(combo)] : null); + return powerUp(null, null, p.scaleMatchLength(Bin.unflags(attrs), len, len, [100, 100], [0, 0]), null, null, combo ? [addCombo(combo)] : null); }, [220](attrs, combo) { - var skill = powerUp(null, null, p.mul([100,100]), c.LShape(flags(attrs)), null, combo ? [addCombo(combo)] : null); + var skill = powerUp(null, null, p.mul([100,100]), c.LShape(Bin.unflags(attrs)), null, combo ? [addCombo(combo)] : null); return skill; }, [221](attrs, damage) { - return powerUp(null, null, p.mul([100,100]), c.LShape(flags(attrs)), null, damage ? [followAttackFixed(damage)] : null); + return powerUp(null, null, p.mul([100,100]), c.LShape(Bin.unflags(attrs)), null, damage ? [followAttackFixed(damage)] : null); }, [223](combo, damage) { @@ -1580,15 +1563,15 @@ const skillObjectParsers = { [227]() { return leaderChange(1); }, [228](turns, attrs, types, atk, rcv) { return activeTurns(turns, - powerUp(null, null, p.scaleStateKind(null, flags(attrs), flags(types), p.mul({atk: atk, rcv: rcv ?? 0, hp:0}))) + powerUp(null, null, p.scaleStateKind(null, Bin.unflags(attrs), Bin.unflags(types), p.mul({atk: atk, rcv: rcv ?? 0, hp:0}))) ); }, [229](attrs, types, hp, atk, rcv) { - return powerUp(null, null, p.scaleStateKind(null, flags(attrs), flags(types), p.mul({hp: hp || 0, atk: atk || 0, rcv: rcv || 0}))); + return powerUp(null, null, p.scaleStateKind(null, Bin.unflags(attrs), Bin.unflags(types), p.mul({hp: hp || 0, atk: atk || 0, rcv: rcv || 0}))); }, [230](turns, target, mul) { const targetTypes = ["self","leader-self","leader-helper","sub-members"]; - const typeArr = flags(target).map(n => targetTypes[n]); + const typeArr = Bin.unflags(target).map(n => targetTypes[n]); return activeTurns(turns, powerUp({targets: typeArr}, null, p.mul({ atk: mul }))); }, [231](turns, awoken1, awoken2, awoken3, awoken4, awoken5, atk, rcv) { @@ -1601,13 +1584,13 @@ const skillObjectParsers = { // const len = lenMin || lenExact; //宝珠长度 // const ee = Boolean(lenExact); //是否为刚好等于 //第二个参数为多少以上就算,第三个参数为多少以上才算 - //return powerUp(null, null, p.mul({ atk: atk || 100}), c.exact('match-length', lenExact, flags(attr)), v.percent(percent), [combo ? addCombo(combo) : null, damage ? followAttackFixed(damage) : null].filter(Boolean), true); + //return powerUp(null, null, p.mul({ atk: atk || 100}), c.exact('match-length', lenExact, Bin.unflags(attr)), v.percent(percent), [combo ? addCombo(combo) : null, damage ? followAttackFixed(damage) : null].filter(Boolean), true); //let powerup, condition; let powerup = Boolean(lenMin) - ? p.scaleMatchLength(flags(attrs), lenMin, lenMin, [atk || 100, 100], [0, 0]) + ? p.scaleMatchLength(Bin.unflags(attrs), lenMin, lenMin, [atk || 100, 100], [0, 0]) : p.mul({ atk: atk || 100}); let condition = Boolean(lenExact) - ? c.exact('match-length', lenExact, flags(attrs)) + ? c.exact('match-length', lenExact, Bin.unflags(attrs)) : null; let additional = [combo ? addCombo(combo) : null, damage ? followAttackFixed(damage) : null].filter(Boolean); const eachTime = true; @@ -1627,20 +1610,20 @@ const skillObjectParsers = { ); }, [239](colum, turns, row) { //产封条 - //const colums = flags(colum), rows = flags(row); + //const colums = Bin.unflags(colum), rows = Bin.unflags(row); return activeTurns(turns, - boardJammingStates('immobility', 'fixed', { positions: {colums: flags(colum), rows: flags(row)} }) + boardJammingStates('immobility', 'fixed', { positions: {colums: Bin.unflags(colum), rows: Bin.unflags(row)} }) ); }, [241](turns, cap) { //改变伤害上限主动技 // const targetTypes = ["self","leader-self","leader-helper","sub-members"]; - // const typeArr = flags(target).map(n => targetTypes[n]); + // const typeArr = Bin.unflags(target).map(n => targetTypes[n]); return activeTurns(turns, increaseDamageCap(cap * 1e8, ["self"]) ); }, [243](turns, attrs, hpPercent, probPercent) { //掉落荆棘珠 - return activeTurns(turns, orbDropIncrease(v.percent(probPercent), flags(attrs), 'thorn', v.xMaxHP(hpPercent))); + return activeTurns(turns, orbDropIncrease(v.percent(probPercent), Bin.unflags(attrs), 'thorn', v.xMaxHP(hpPercent))); }, [244](turns, type) { //改变板面大小主动技 let width, height; @@ -1668,13 +1651,13 @@ const skillObjectParsers = { return activeTurns(turns, boardSizeChange(width, height)); }, [245](rarity, _2, _3, hp, atk, rcv) { //全员满足某种情况,现在是全部星级不一样 - return powerUp(flags(_2), flags(_3), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 }), c.compo('team-same-rarity', rarity)); + return powerUp(Bin.unflags(_2), Bin.unflags(_3), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 }), c.compo('team-same-rarity', rarity)); }, [246](time, combo, cap) { //限定时间内转出多少C提高伤害上限 return CTW(v.constant(time), c.combos(combo) , increaseDamageCap(cap * 1e8, ["self"])); }, [247](time, attr, min, cap) { //限定时间内转出多少色提高伤害上限 - return CTW(v.constant(time), c.attrs(flags(attr), min) , increaseDamageCap(cap * 1e8, ["self"])); + return CTW(v.constant(time), c.attrs(Bin.unflags(attr), min) , increaseDamageCap(cap * 1e8, ["self"])); }, [248](turns, ...ids) { //几回合后才生效的技能 return delayActiveTurns(turns, @@ -1683,7 +1666,7 @@ const skillObjectParsers = { }, [249](turns, attr, row1, row2, row3, row4, row5, count) { const options = { - attrs: flags(attr), + attrs: Bin.unflags(attr), }; if (count) { options.count = count; @@ -1709,7 +1692,7 @@ const skillObjectParsers = { return predictionFalling(); }, //剩余多少个属性珠才能使用技能 - [255](attr, min, max) { return skillProviso(c.remainAttrOrbs(flags(attr), min ?? 0, max ?? 0)); }, + [255](attr, min, max) { return skillProviso(c.remainAttrOrbs(Bin.unflags(attr), min ?? 0, max ?? 0)); }, [257]() { return [ @@ -1721,7 +1704,7 @@ const skillObjectParsers = { [258](turns, cap, target) { //改变伤害上限主动技 const targetTypes = ["self","leader-self","leader-helper","sub-members"]; - const typeArr = flags(target).map(n => targetTypes[n]); + const typeArr = Bin.unflags(target).map(n => targetTypes[n]); return activeTurns(turns, increaseDamageCap(cap * 1e8, typeArr) ); @@ -1735,7 +1718,7 @@ const skillObjectParsers = { default: return type; } })(type); - return obstructOpponent(posType, flags(pos), ids); + return obstructOpponent(posType, Bin.unflags(pos), ids); }, }; @@ -2583,7 +2566,7 @@ function renderSkill(skill, option = {}) let ids = skill.ids, random = skill.random; let doms = ids.map(id=>{ let dom = cardN(id); - dom.monDom.onclick = changeToIdInSkillDetail; + //dom.monDom.onclick = changeToIdInSkillDetail; return dom; }) let dict = { cards: doms.nodeJoin(), @@ -2972,7 +2955,7 @@ function renderCondition(cond) { case 'card':{ dict.ids = cond.compo.ids.map(mid=>{ const dom = cardN(mid); - dom.monDom.onclick = changeToIdInSkillDetail; + //dom.monDom.onclick = changeToIdInSkillDetail; return dom; }).nodeJoin(); frg.ap(tsp.cond.compo_type_card(dict)); diff --git a/script-universal_function.js b/script-universal_function.js index 94016023..5f3d6717 100644 --- a/script-universal_function.js +++ b/script-universal_function.js @@ -418,13 +418,6 @@ class Bin extends Set { } } } -//将二进制flag转为数组 -function flags(num) { - return Bin.unflags(num); -} -function reflags(arr) { - return Bin.enflags(arr); -} //带标签的模板字符串 function tp(stringsArr, ...keys) { @@ -832,7 +825,7 @@ function calculateAbility(member, assist = null, solo = true, teamsCount = 1) { //地下城阴阳加护强化 if (dge.benefit) { //当存在加护 const benefitAwokens = [128 , 129]; //0b1是阳,0b10是阴,可以两者都强化 - flags(dge.benefit).forEach(idx=>{ + Bin.unflags(dge.benefit).forEach(idx=>{ const akId = benefitAwokens[idx]; //得到加护觉醒编号 latterAwokenScale[0].push({ index: akId, scale: 1.2 }); //HP latterAwokenScale[1].push({ index: akId, scale: 5 }); //ATK @@ -965,7 +958,7 @@ function searchCards(cards, {attrs: sAttrs, fixMainColor, types, typeAndOr, rare //如果固定顺序就直接使用当前颜色顺序;否则不考虑顺序时,去除任意色 const attrNums = sAttrs.filter(attr=>fixMainColor || attr > 0 && (attr & anyAttrsFlag) !== anyAttrsFlag) .map(attr=>{ - const attrNum = flags(attr); + const attrNum = Bin.unflags(attr); if (attrNum.includes(6)) attrNum.push(undefined,-1); //如果是包含6的,就添加-1和undefined的值 return attrNum; }); @@ -1134,26 +1127,20 @@ function cardN(id) { const monDom = createCardA({noBoxCount: true}); monOuterDom.appendChild(monDom); monOuterDom.monDom = monDom; + monOuterDom.monDom.onclick = cardNClick changeid({ id: id }, monDom); + + function cardNClick(event) { + event?.preventDefault(); + const monstersID = document.getElementById("card-id"); + const formIdSearch = document.getElementById("form-id-search"); + monstersID.value = this.getAttribute("data-cardid"); + formIdSearch.onchange(); + editBox.show(); + } return monOuterDom; } -//返回文字说明内怪物Card的纯HTML -function cardNClick() { - const id = parseInt(this.getAttribute("data-cardid"), 10); - editBox.show(); - editBox.mid = id; - editBoxChangeMonId(id); - //showSearch([id]); - return false; -} -//技能介绍里的头像的切换 -function changeToIdInSkillDetail(event) { - const monstersID = document.getElementById("card-id"); - const mid = this.getAttribute("data-cardid"); - monstersID.value = mid; - monstersID.onchange(); - return false; //取消链接的默认操作 -} + //产生队伍目标类型 function createTeamFlags(target) { @@ -1167,7 +1154,7 @@ function createTeamFlags(target) let _target = []; if (Number.isInteger(target)) { - _target = flags(target).map(n=>targetTypes[n]); + _target = Bin.unflags(target).map(n=>targetTypes[n]); } else if (Array.isArray(target)) { if (target.every(item=>Number.isInteger(item))) { @@ -1210,7 +1197,7 @@ function createIndexedIcon(type, index) { if (type == 'card') {//卡片头像 const avatar = cardN(index); avatar.contentEditable = false; - avatar.monDom.setAttribute("onclick", "cardNClick.call(this);return false;") + //avatar.monDom.setAttribute("onclick", "cardNClick.call(this);return false;") return avatar; } const icon = document.createElement("icon"); @@ -1389,7 +1376,7 @@ function countTeamHp(team, leader1id, leader2id, solo, noAwoken = false) { case 163: case 177: case 186: - scale = hpMul({ attrs: flags(sk[0]), types: flags(sk[1]) }, sk[2]); + scale = hpMul({ attrs: Bin.unflags(sk[0]), types: Bin.unflags(sk[1]) }, sk[2]); break; case 125: //队伍中必须有指定队员 const needMonIdArr = sk.slice(0, 5).filter(s => s > 0); @@ -1397,18 +1384,18 @@ function countTeamHp(team, leader1id, leader2id, solo, noAwoken = false) { scale = needMonIdArr.every(mid => memberIdArr.includes(mid)) ? sk[5] / 100 : 1; break; case 136: - scale = hpMul({ attrs: flags(sk[0]) }, sk[1]); - if (sk[4]) scale *= hpMul({ attrs: flags(sk[4]) }, sk[5]); + scale = hpMul({ attrs: Bin.unflags(sk[0]) }, sk[1]); + if (sk[4]) scale *= hpMul({ attrs: Bin.unflags(sk[4]) }, sk[5]); break; case 137: - scale = hpMul({ types: flags(sk[0]) }, sk[1]); - if (sk[4]) scale *= hpMul({ types: flags(sk[4]) }, sk[5]); + scale = hpMul({ types: Bin.unflags(sk[0]) }, sk[1]); + if (sk[4]) scale *= hpMul({ types: Bin.unflags(sk[4]) }, sk[5]); break; case 155: - scale = solo ? 1 : hpMul({ attrs: flags(sk[0]), types: flags(sk[1]) }, sk[2]); + scale = solo ? 1 : hpMul({ attrs: Bin.unflags(sk[0]), types: Bin.unflags(sk[1]) }, sk[2]); break; case 158: - scale = hpMul({ attrs: flags(sk[1]), types: flags(sk[2]) }, sk[4]); + scale = hpMul({ attrs: Bin.unflags(sk[1]), types: Bin.unflags(sk[2]) }, sk[4]); break; case 175: //队伍组成全为合作,不包括双方队长 const needCollabIdIdArr = sk.slice(0, 3).filter(s => s > 0); @@ -1417,7 +1404,7 @@ function countTeamHp(team, leader1id, leader2id, solo, noAwoken = false) { break; case 178: case 185: - scale = hpMul({ attrs: flags(sk[1]), types: flags(sk[2]) }, sk[3]); + scale = hpMul({ attrs: Bin.unflags(sk[1]), types: Bin.unflags(sk[2]) }, sk[3]); break; case 203:{ //队员为指定类型,不包括双方队长,且队员数大于0 let trueMemberCardsArr = memberArr.slice(1, 5).filter(m => m.id > 0).map(m => m.card); @@ -1442,7 +1429,7 @@ function countTeamHp(team, leader1id, leader2id, solo, noAwoken = false) { case 229:{ //队员中存在每个属性或Type都算一次 const {attrs, types} = countTeamTotalAttrsTypes(memberArr, assistArr); - let correAttrs = flags(sk[0]), correTypes = flags(sk[1]); //符合的属性/类型 + let correAttrs = Bin.unflags(sk[0]), correTypes = Bin.unflags(sk[1]); //符合的属性/类型 //符合的次数 let correTimes = correAttrs.reduce((pre,attr)=>pre + (attrs[attr] || 0),0) + correTypes.reduce((pre,type)=>pre + (types[type] || 0),0); @@ -1818,7 +1805,7 @@ function getReduceRange(reduceScales) } else if ((scale.attrs & 31) != 31) //不符合全属性的 { - const attrs = flags(scale.attrs); //得到属性数组 + const attrs = Bin.unflags(scale.attrs); //得到属性数组 attrs.forEach(n=>{ attrsRanges[n] = attrsRanges[n].map(range=>new reduceRange(range)); //复制一个新数组 processingRanges(attrsRanges[n], scale); //计算这个数组的减伤比例 diff --git a/script.js b/script.js index 762fb47b..2042fe8d 100644 --- a/script.js +++ b/script.js @@ -913,7 +913,7 @@ Formation.prototype.outObj = function() { }); let dge = this.dungeonEnchance; if (Object.values(dge.rate).some(rate => rate != 1) || dge.benefit || dge.stage>1) obj.r = [ - [reflags(dge.types),reflags(dge.attrs),reflags(dge.rarities),dge.collabs.length ? dge.collabs : 0, reflags(dge.gachas)].deleteLatter(0), //类型,属性,星级 + [Bin.enflags(dge.types),Bin.enflags(dge.attrs),Bin.enflags(dge.rarities),dge.collabs.length ? dge.collabs : 0, Bin.enflags(dge.gachas)].deleteLatter(0), //类型,属性,星级 [dge.rate.hp,dge.rate.atk,dge.rate.rcv].deleteLatter(1), dge.benefit || 0, //地下城阴阳加护 dge.stage || 1 //地下城层数 @@ -1005,11 +1005,11 @@ Formation.prototype.loadObj = function(f) { if (Array.isArray(f.r[0])) { const [[types, attrs, rarities, collabs, gachas] = [], [hp , atk, rcv] = [], benefit, stage] = f.r; - dge.types = flags(types ?? 0); - dge.attrs = flags(attrs ?? 0); - dge.rarities = flags(rarities ?? 0); + dge.types = Bin.unflags(types ?? 0); + dge.attrs = Bin.unflags(attrs ?? 0); + dge.rarities = Bin.unflags(rarities ?? 0); dge.collabs = collabs?.length ? collabs : []; - dge.gachas = Array.isArray(gachas) ? gachas.flatMap(n=>flags(n)) :flags(gachas || 0); + dge.gachas = Array.isArray(gachas) ? gachas.flatMap(n=>Bin.unflags(n)) :Bin.unflags(gachas || 0); dge.rate.hp = hp ?? 1; dge.rate.atk = atk ?? 1; @@ -1018,8 +1018,8 @@ Formation.prototype.loadObj = function(f) { dge.benefit = benefit || 0; dge.stage = stage || 1; } else { - dge.attrs = flags(f.r[0] ?? 0); - dge.types = flags(f.r[1] ?? 0); + dge.attrs = Bin.unflags(f.r[0] ?? 0); + dge.types = Bin.unflags(f.r[1] ?? 0); dge.rarities.length = 0; dge.rate.hp = f.r[2] ?? 1; dge.rate.atk = f.r[3] ?? 1; @@ -2162,16 +2162,16 @@ function loadData(force = false) const card = _cards[i]; if (card.searchFlags) card.leaderSkillTypes = new LeaderSkillType(card); card.onlyAssist = Boolean(card.flags & 1<<4); - card.gachaIds = flags(card.gachaGroupsFlag); - card.typesFlag = reflags(card.types); - /*card.unk01p = flags(card.unk01); - card.unk02p = flags(card.unk02); - card.unk03p = flags(card.unk03); - card.unk04p = flags(card.unk04); - card.unk05p = flags(card.unk05); - card.unk06p = flags(card.unk06); - card.unk07p = flags(card.unk07); - card.unk08p = flags(card.unk08);*/ + card.gachaIds = Bin.unflags(card.gachaGroupsFlag); + card.typesFlag = Bin.enflags(card.types); + /*card.unk01p = Bin.unflags(card.unk01); + card.unk02p = Bin.unflags(card.unk02); + card.unk03p = Bin.unflags(card.unk03); + card.unk04p = Bin.unflags(card.unk04); + card.unk05p = Bin.unflags(card.unk05); + card.unk06p = Bin.unflags(card.unk06); + card.unk07p = Bin.unflags(card.unk07); + card.unk08p = Bin.unflags(card.unk08);*/ cards[card?.id] = card; } return cards; @@ -5181,7 +5181,7 @@ function initialize() { const attrs = (function(formData){ const attrsArr = []; for (let i = 0; i <= 2; i++) { - const attrNum = reflags(formData.getAll(`attr-${i+1}`).map(Str2Int)); + const attrNum = Bin.enflags(formData.getAll(`attr-${i+1}`).map(Str2Int)); attrsArr.push(attrNum); } return attrsArr; diff --git a/service-worker.js b/service-worker.js index f07470f1..dd2b93db 100644 --- a/service-worker.js +++ b/service-worker.js @@ -447,7 +447,7 @@ const cachesMap = new Map([ ], [ "images/cards_ja/CARDS_112.PNG", - "1b2cfb84e20c50052fbca7dc26b03939" + "0e0ee24b4fd20e6998e69ef29d4184bd" ], [ "sound/voice/ja/padv001.wav", @@ -25511,19 +25511,19 @@ const cachesMap = new Map([ ], [ "script-json_data.js", - "c6a6fdc30e80d5b4d86752179f895419" + "11cec86f554c4b4dceb01d57850b20a9" ], [ "script-skill-parser.js", - "d298d99ce21c86143f6db51815aaf3ff" + "3ec1eb93ca9b88f454c0e9e69e347a06" ], [ "script-universal_function.js", - "d0be9845a7b584b3a5699e39c55c146d" + "7d4cc7769b061422c6f55b392f3fd445" ], [ "script.js", - "fa3b6f54a8e3527a787c0b5384308b79" + "bf5e60b56a64419c5592a5c641258d3f" ], [ "solo.html",