From d7d545260ab4bd00c2669acb6d559e2bb123995a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=AB=E8=B0=B7=E5=89=91=E4=BB=99?= Date: Sun, 15 Aug 2021 18:31:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=BA=9Bbug?= =?UTF-8?q?=EF=BC=8C=E6=8B=86=E5=88=86=E6=9D=A1=E4=BB=B6=E6=8A=80=E8=83=BD?= =?UTF-8?q?=E5=86=8D=E5=90=88=E5=B9=B6=EF=BC=88=E6=9D=A1=E4=BB=B6=E5=89=8D?= =?UTF-8?q?=E5=90=8E=E4=B8=8D=E8=83=BD=E5=90=88=E5=B9=B6=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- languages/en.js | 2 +- script-json_data.js | 2 +- script-skill-parser.js | 54 ++++++++++++++++++++++++++++++++++-------- style.css | 5 ++++ 4 files changed, 51 insertions(+), 12 deletions(-) diff --git a/languages/en.js b/languages/en.js index 991063c0..04bacd43 100644 --- a/languages/en.js +++ b/languages/en.js @@ -84,7 +84,7 @@ rate_multiply_exp: tp`${'icon'}Rank EXP`, reduce_damage: tp`${'condition'}${'icon'}Reduces${'attrs'} damage taken by ${'value'}`, power_up: tp`${'condition'}${'targets'}${'value'}${'reduceDamage'}${'addCombo'}${'followAttack'}`, - power_up_targets: tp`${'attrs'}${'types'}'s `, + power_up_targets: tp`[${'attrs_types'}]'s `, //attrs, types, attrs_types henshin: tp`Transforms into ${'card'}`, void_poison: tp`Voids ${'poison'} damage`, skill_proviso: tp`The follow-up effect can only be initiated ${'condition'}`, diff --git a/script-json_data.js b/script-json_data.js index 7a1550b3..a82ffd11 100644 --- a/script-json_data.js +++ b/script-json_data.js @@ -97,7 +97,7 @@ let localTranslating = { rate_multiply_exp: tp`${'icon'}等级经验倍率`, reduce_damage: tp`${'condition'}受到的${'attrs'}伤害${'icon'}减少${'value'}`, power_up: tp`${'condition'}${'targets'}${'value'}${'reduceDamage'}${'addCombo'}${'followAttack'}`, - power_up_targets: tp`${'attrs'}${'types'}的 `, + power_up_targets: tp`${'attrs_types'}的 `, henshin: tp`变身为${'card'}`, void_poison: tp`消除${'poison'}时不会受到毒伤害`, skill_proviso: tp`${'condition'}才能发动后续效果`, diff --git a/script-skill-parser.js b/script-skill-parser.js index d4cffbe6..5f75817d 100644 --- a/script-skill-parser.js +++ b/script-skill-parser.js @@ -649,6 +649,7 @@ function skillParser(skillId) multiplier.forEach(skill=>skills.splice(skills.indexOf(skill),1)); //去掉所有后面的 } } + return skills; } const skill = Skills[skillId]; if (!skill) return []; @@ -657,10 +658,31 @@ function skillParser(skillId) } //此处用apply将这个parser传递到后面解析函数的this里,用于递归解析 const result = parsers[skill.type].apply({ parser: skillParser }, skill.params); - const skills = (Array.isArray(result) ? result : [result]) + let skills = (Array.isArray(result) ? result : [result]) .filter(s => Boolean(s)) .map(s => ({ id: skillId, type: skill.type, params: skill.params, ...s })); - if (merge_skill) merge(skills); + + function splitProvisoSkill(skills) + { + let idx = skills.findIndex(skill=>skill.kind == SkillKinds.SkillProviso); + if (idx>=0) + { + return [ + skills.slice(0,idx), + skills.slice(idx, idx+1), + skills.slice(idx+1), + ]; + }else + { + return [skills]; + } + } + if (merge_skill) + { + let skillsSplit = splitProvisoSkill(skills).map(_skills=>merge(_skills)); + skills = skillsSplit.flat(1); + } + return skills; } @@ -1160,7 +1182,7 @@ const parsers = { [158](len, attrs, types, atk, hp, rcv) { return [ minMatch(len), - powerUp(flags(attrs), flags(types), p.mul({ hp, atk, rcv })) + powerUp(flags(attrs), flags(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])); }, @@ -1170,7 +1192,7 @@ const parsers = { [163](attrs, types, hp, atk, rcv, rAttrs, rPercent) { return [ noSkyfall(), - (hp || atk || rcv) && powerUp(flags(attrs), flags(types), p.mul({ hp, atk, rcv })) || null, + (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, ].filter(Boolean); }, @@ -1202,7 +1224,7 @@ const parsers = { ].filter((buff) => typeof buff === 'string') )); }, - [175](series1, series2, series3, hp, atk, rcv) { return powerUp(null, null, p.mul({ hp, atk, rcv }), c.compo('series', [series1, series2, series3].filter(Boolean))); }, + [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)) } @@ -1211,14 +1233,14 @@ const parsers = { [177](attrs, types, hp, atk, rcv, remains, mul) { return [ noSkyfall(), - (hp || atk || rcv) && powerUp(flags(attrs), flags(types), p.mul({ hp, atk, rcv })) || null, + (hp || atk || rcv) && powerUp(flags(attrs), flags(types), p.mul({ hp: hp || 100, atk: atk || 100, rcv: rcv || 100 })) || null, mul && powerUp(null, null, p.mul({ atk: mul }), c.remainOrbs(remains)) || 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, atk, rcv })), + (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, ].filter(Boolean); }, @@ -1957,9 +1979,21 @@ function renderSkill(skill, option = {}) }; if (condition) dict.condition = renderCondition(condition); - let targetDict = {}; - if (attrs?.filter(attr=> attr !== 5)?.length && !isEqual(attrs, Attributes.all())) targetDict.attrs = renderAttrs(attrs || [], {affix: true}); - if (types?.length) targetDict.attrs = renderTypes(types || [], {affix: true}); + let targetDict = {}, attrs_types = []; + if (attrs?.filter(attr=> attr !== 5)?.length && !isEqual(attrs, Attributes.all())) + { + targetDict.attrs = renderAttrs(attrs || [], {affix: true}); + attrs_types.push(targetDict.attrs); + } + if (types?.length) + { + targetDict.types = renderTypes(types || [], {affix: true}); + attrs_types.push(targetDict.types); + } + if (attrs_types.length) + { + targetDict.attrs_types = attrs_types.nodeJoin(tsp.word.slight_pause()); + } if (targetDict.attrs || targetDict.types) dict.targets = tsp.skill.power_up_targets(targetDict); diff --git a/style.css b/style.css index 8b98aa4f..7cda33d1 100644 --- a/style.css +++ b/style.css @@ -3277,6 +3277,11 @@ table .orb-icon { color: #ff3600; } +.card-skill-list .skill-proviso +{ + border-bottom: 1px brown dashed; +} + .icon-skill.status-incr::after, .icon-skill.status-decr::after, .icon-skill.status-bind::after,