From e88b37d009bcc61b7affcc9a26264ef24d5edd53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=AB=E8=B0=B7=E5=89=91=E4=BB=99?= Date: Sat, 19 Nov 2022 00:56:30 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A8=80=E6=9C=89=E5=BA=A6=E6=98=9F=E7=BA=A7?= =?UTF-8?q?=E4=B8=8D=E5=90=8C/=E7=9B=B8=E5=90=8C=E7=9A=84=E5=8F=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- languages/zh-TW.js | 4 ++- languages/zh.js | 4 ++- script-json_data.js | 22 +++++++++++-- script-skill-parser.js | 62 +++++++++++++----------------------- script-universal_function.js | 37 +++++++++++++++++++-- 5 files changed, 82 insertions(+), 47 deletions(-) diff --git a/languages/zh-TW.js b/languages/zh-TW.js index 52a94f17..e2a915f3 100644 --- a/languages/zh-TW.js +++ b/languages/zh-TW.js @@ -135,7 +135,7 @@ compo_type_series: tp`隊員組成全為 ${'ids'} 合作時`, compo_type_evolution: tp`隊員組成全為 ${'ids'} 進化時`, compo_type_team_total_rarity: tp`隊伍的總★稀有度 ≤${'rarity'} 時`, - compo_type_team_rarity_different: tp`隊伍的稀有度各不相同時`, + compo_type_team_same_rarity: tp`隊伍的稀有度都為${'rarity'}時`, stage_less_or_equal: tp`${'stage'} ≤ ${'max'} 時`, //地下城层数 stage_greater_or_equal: tp`${'stage'} ≥ ${'min'} 時`, @@ -214,6 +214,8 @@ affix_awakening: tp`${'cotent'}覺醒`, //詞綴-覺醒 affix_exclude: tp`${'cotent'}以外`, //詞綴-屬性 each_time: tp`每一次`, + different: tp`不同`, + same: tp`相同`, }, attrs: { [0]: tp`${'icon'}火`, diff --git a/languages/zh.js b/languages/zh.js index c17a8c9b..4428dd14 100644 --- a/languages/zh.js +++ b/languages/zh.js @@ -135,7 +135,7 @@ compo_type_series: tp`队员组成全为 ${'ids'} 合作时`, compo_type_evolution: tp`队员组成全为 ${'ids'} 进化时`, compo_type_team_total_rarity: tp`队伍的总★稀有度 ≤${'rarity'} 时`, - compo_type_team_rarity_different: tp`队伍的稀有度各不相同时`, + compo_type_team_same_rarity: tp`队伍的稀有度都为${'rarity'}时`, stage_less_or_equal: tp`${'stage'} ≤ ${'max'} 时`, //地下城层数 stage_greater_or_equal: tp`${'stage'} ≥ ${'min'} 时`, @@ -215,6 +215,8 @@ affix_awakening: tp`${'cotent'}觉醒`, //词缀-觉醒 affix_exclude: tp`${'cotent'}以外`, //词缀-属性 each_time: tp`每一次`, + different: tp`不同`, + same: tp`相同`, }, attrs: { [0]: tp`${'icon'}火`, diff --git a/script-json_data.js b/script-json_data.js index b564d7f9..46560c7a 100644 --- a/script-json_data.js +++ b/script-json_data.js @@ -151,7 +151,7 @@ let localTranslating = { compo_type_series: tp`When all subs from ${'ids'} collab (Needs at least 1 sub), `, compo_type_evolution: tp`When all monsters in team are ${'ids'}, `, compo_type_team_total_rarity: tp`When the total ★ rarity of the team is ≤${'rarity'}, `, - compo_type_team_rarity_different: tp`When the team's rarity is different, `, + compo_type_team_same_rarity: tp`When the ★ rarity of the team is ${'rarity'}, `, stage_less_or_equal: tp`When ${'stage'} ≤ ${'max'}, `, stage_greater_or_equal: tp`When ${'stage'} ≥ ${'min'}, `, @@ -231,6 +231,8 @@ let localTranslating = { affix_awakening: tp`${'cotent'} awoken`, affix_exclude: tp`, exclude ${'cotent'}`, each_time: tp`each time`, + different: tp`different`, + same: tp`the same`, }, attrs: { [0]: tp`${'icon'}Fire`, @@ -3248,12 +3250,26 @@ const specialSearchFunctions = (function() { return `★≤${sk[0]}`; } }, - {name:"Team's rarity required different",otLangName:{chs:"要求队员稀有度各不相同",cht:"要求隊員稀有度各不相同"}, + {name:"Team's rarity required different",otLangName:{chs:"要求队员稀有度相同/各不相同",cht:"要求隊員稀有度相同/各不相同"}, function:cards=>cards.filter(card=>{ const searchTypeArray = [245]; const skill = getCardLeaderSkill(card, searchTypeArray); return skill; - }) + }), + addition:card=>{ + const searchTypeArray = [245]; + const skill = getCardLeaderSkill(card, searchTypeArray); + if (!skill) return; + const sk = skill.params; + switch (sk[0]) { + case -1: + return `★各不相同`; + case -2: + return `★全部相同`; + default: + return `★全为${sk[0]}`; + } + } }, ]}, {group:true,name:"-----Extra Effects-----",otLangName:{chs:"-----附加效果-----",cht:"-----附加效果-----"}, functions: [ diff --git a/script-skill-parser.js b/script-skill-parser.js index 01e0a480..4c47170c 100644 --- a/script-skill-parser.js +++ b/script-skill-parser.js @@ -1098,7 +1098,7 @@ const parsers = { [58](attr, min, max) { return damageEnemy('all', attr, v.randomATK(min, max)); }, [59](attr, min, max) { return damageEnemy('single', attr, v.randomATK(min, max)); }, [60](turns, mul, attr) { return activeTurns(turns, counterAttack(attr, v.percent(100), v.percent(mul))); }, - [61](attrs, min, base, bonus, max) { return powerUp(null, null, p.scaleAttrs(flags(attrs), min, max ?? min, [base, 100], [bonus, 0])); }, + [61](attrs, min, base, bonus, stage) { return powerUp(null, null, p.scaleAttrs(flags(attrs), min, min + (stage ?? 0), [base, 100], [bonus, 0])); }, [62](type, mul) { return powerUp(null, [type], p.mul({ hp: mul, atk: mul })); }, [63](type, mul) { return powerUp(null, [type], p.mul({ hp: mul, rcv: mul })); }, [64](type, mul) { return powerUp(null, [type], p.mul({ atk: mul, rcv: mul })); }, @@ -1582,8 +1582,8 @@ const parsers = { } return activeTurns(turns, boardSizeChange(width, height)); }, - [245](_1, _2, _3, hp, atk, rcv) { //全员满足某种情况,现在是全部星级不一样 - return powerUp(null, null, p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 }), c.compo('team-rarity-diffrent', flags(_2))); + [245](rarity, _2, _3, hp, atk, rcv) { //全员满足某种情况,现在是全部星级不一样 + return powerUp(flags(_2), null, p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 }), c.compo('team-same-rarity', rarity)); }, [1000](type, pos, ...ids) { const posType = (type=>{ @@ -1598,40 +1598,6 @@ const parsers = { }, }; -//将内容添加到代码片段 -DocumentFragment.prototype.ap = function(...args) -{ - args.forEach(arg=>{ - if (Array.isArray(arg)) //数组,递归自身 - { - arg.forEach(item=>this.ap(item)); - } - else //其他内容的转换为文字添加 - { - this.append(arg); - } - }, this); - return this; -} - -//将数组和分隔符添加到一个代码片段,类似join -Array.prototype.nodeJoin = function(separator) -{ - const frg = document.createDocumentFragment(); - this.forEach((item, idx, arr)=>{ - frg.ap(item); - if (idx < (arr.length - 1) && separator !== undefined) - frg.ap(separator instanceof Node ? separator.cloneNode(true) : separator); - }); - return frg; -} -//按住Ctrl点击技能在控制台输出技能的对象 -function showParsedSkill(event) { - if (event.ctrlKey) { - //const skillId = parseInt(this.getAttribute("data-skill-id")); - console.log(this.skill); - } -} function renderSkillTitle(skillId) { const skill = Skills[skillId]; @@ -1656,6 +1622,13 @@ function renderSkillTitle(skillId) { function renderSkillEntry(skills) { + //按住Ctrl点击技能在控制台输出技能的对象 + function showParsedSkill(event) { + if (event.ctrlKey) { + //const skillId = parseInt(this.getAttribute("data-skill-id")); + console.log(this.skill); + } + } const ul = document.createElement("ul"); ul.className = "card-skill-list"; skills.forEach(skill=>{ @@ -2803,8 +2776,19 @@ function renderCondition(cond) { frg.ap(tsp.cond.compo_type_team_total_rarity(dict)); break; } - case 'team-rarity-diffrent':{ - frg.ap(tsp.cond.compo_type_team_rarity_different(dict)); + case 'team-same-rarity':{ + let rarity = cond.compo.ids; + switch (rarity) { + case -1: + dict.rarity = tsp.word.different(); + break; + case -2: + dict.rarity = tsp.word.same(); + break; + default: + dict.rarity = rarity; + } + frg.ap(tsp.cond.compo_type_team_same_rarity(dict)); break; } } diff --git a/script-universal_function.js b/script-universal_function.js index 480c5784..43256a74 100644 --- a/script-universal_function.js +++ b/script-universal_function.js @@ -132,6 +132,33 @@ Array.prototype.groupBy = function(func) { }, []); return groups; } +//将内容添加到代码片段 +DocumentFragment.prototype.ap = function(...args) +{ + args.forEach(arg=>{ + if (Array.isArray(arg)) //数组,递归自身 + { + arg.forEach(item=>this.ap(item)); + } + else //其他内容的转换为文字添加 + { + this.append(arg); + } + }, this); + return this; +} + +//将数组和分隔符添加到一个代码片段,类似join +Array.prototype.nodeJoin = function(separator) +{ + const frg = document.createDocumentFragment(); + this.forEach((item, idx, arr)=>{ + frg.ap(item); + if (idx < (arr.length - 1) && separator !== undefined) + frg.ap(separator instanceof Node ? separator.cloneNode(true) : separator); + }); + return frg; +} Math.randomInteger = function(max, min = 0) { return this.floor(this.random() * (max - min + 1) + min); @@ -871,7 +898,6 @@ function descriptionToHTML(str) latent.setAttribute("data-latent-hole", 1); return latent; }); - return nodeArr.nodeJoin(); } //默认的技能解释的显示行为 @@ -1027,9 +1053,14 @@ function countTeamHp(team, leader1id, leader2id, solo, noAwoken = false) { break; } case 245: { //全员满足某种情况,不包括好友队长,现在是全部星级不一样 - let cardsRarity = memberArr.slice(0, 5).filter(m => m.id > 0).map(m => m.card.rarity); //所有的卡片星级 - if (new Set(cardsRarity).size === cardsRarity.length) //如果星级去重后数量一致,即各不相同 + const cardsRarity = memberArr.slice(0, 5).filter(m => m.id > 0).map(m => m.card.rarity); //所有的卡片星级 + const distinctRarity = cardsRarity.concat().distinct(); //数组拷贝去重 + if (sk[0] == -1 && distinctRarity.length === cardsRarity.length || //全部不同 + sk[0] == -2 && distinctRarity.length === 1 || //全部相同 + sk[0] > 0 && distinctRarity.length === 1 && distinctRarity[0] === sk[0] //指定稀有度 + ) { scale = sk[3] / 100; + } break; } case 138: //调用其他队长技