diff --git a/components/profile-data/enka.js b/components/profile-data/enka.js index 2b972b93..7b03d23b 100644 --- a/components/profile-data/enka.js +++ b/components/profile-data/enka.js @@ -23,7 +23,7 @@ export default new ProfileServ({ // 处理服务返回 async response (data, req) { if (!data.playerInfo) { - if(data.error) { + if (data.error) { console.log(`Enka ReqErr: ${data.error}`) } return req.err('error', 60) diff --git a/config/system/character.js b/config/system/character.js index 68433596..988fa726 100644 --- a/config/system/character.js +++ b/config/system/character.js @@ -86,9 +86,9 @@ export const characters = { duizhang: ['卡皮塔诺', '队长'], nahida: ['纳西妲', '草神', '小吉祥', '小吉祥草王', '花神', '草萝莉'], alhaitham: ['艾尔海森', '海哥', '埃尔海森'], - dixiya: ['迪希雅'], - daiyin: ['戴因斯雷布', '戴因', '男派蒙'], - tianli: ['天理'] + dixiya: ['迪希雅', '迪希亚', '迪希娅', '迪西雅', '迪西亚'], + daiyin: ['戴因斯雷布', '戴因', '男派蒙', '大派蒙', '末光之剑', '拾枝者'], + tianli: ['天理', '天理维系者', '维系者'] } export const wifeData = { diff --git a/models/ProfileArtis.js b/models/ProfileArtis.js index ad133fa7..cfcb78a0 100644 --- a/models/ProfileArtis.js +++ b/models/ProfileArtis.js @@ -155,47 +155,36 @@ export default class ProfileArtis extends Base { getCharCfg () { let char = Character.get(this.charid) - // let { attrWeight, title } = char.getArtisMarkCfg(this.profile, this) let { attrWeight, title } = CharArtis.getCharArtisCfg(char, this.profile, this) - let attrMark = {} - + let attrs = {} let baseAttr = char.baseAttr || { hp: 14000, atk: 230, def: 700 } - lodash.forEach(attrWeight, (weight, attr) => { - attrMark[attr] = weight / attrValue[attr] - }) - - // let baseAttr = [400, 500, 300]; - if (attrMark.hp) { - attrMark.hpPlus = attrMark.hp / baseAttr.hp * 100 - } - if (attrMark.atk) { - // 以520作为武器白值均值计算 - attrMark.atkPlus = attrMark.atk / (baseAttr.atk * 1 + 520) * 100 - } - if (attrMark.def) { - attrMark.defPlus = attrMark.def / baseAttr.def * 100 - } - let maxMark = ArtisMark.getMaxMark(attrWeight) - let titleMark = {} - let titleWeight = {} - lodash.forEach(attrMark, (mark, attr) => { - let aTitle = attrMap[attr].title - if (/小/.test(aTitle)) { - return + lodash.forEach(attrMap, (attr, key) => { + let k = attr.base || '' + let weight = attrWeight[k || key] + if (!weight || weight * 1 === 0) { + return true } - titleMark[aTitle] = mark - titleWeight[aTitle] = attrWeight[attr] || 0 - if (/大/.test(aTitle)) { - let sTitle = aTitle.replace('大', '小') - titleWeight[sTitle] = titleWeight[aTitle] + let ret = { + ...attr, + weight, + fixWeight: weight, + mark: weight / attrValue[key] } + if (!k) { + ret.mark = weight / attrValue[key] + } else { + let plus = k === 'atk' ? 520 : 0 + ret.mark = weight / attrValue[k] / (baseAttr[k] + plus) * 100 + ret.fixWeight = weight * attr.value / attrMap[k].value / (baseAttr[k] + plus) * 100 + } + attrs[key] = ret }) + let maxMark = ArtisMark.getMaxMark(attrs) return { + attrs, classTitle: title, weight: attrWeight, - mark: attrMark, - titleMap: titleMark, - titleWeight, + mark: lodash.mapValues(attrs, (ds) => ds.mark), maxMark } } @@ -204,7 +193,10 @@ export default class ProfileArtis extends Base { let charCfg = this.getCharCfg() let artis = {} let setCount = {} - let usefulMark = charCfg.titleWeight + let usefulMark = {} + lodash.forEach(charCfg.attrs, (ds) => { + usefulMark[ds.title] = ds.weight + }) let totalMark = 0 this.forEach((arti, idx) => { let mark = ArtisMark.getMark(charCfg, idx, arti.main, arti.attrs) diff --git a/models/ProfileReq.js b/models/ProfileReq.js index 97053b5b..02934bca 100644 --- a/models/ProfileReq.js +++ b/models/ProfileReq.js @@ -69,9 +69,9 @@ export default class ProfileReq extends Base { params.timeout = params.timeout || 1000 * 20 let req = await fetch(reqParam.url, params) data = await req.text() - if(data[0] === '<'){ + if (data[0] === '<') { let titleRet = /(.+)<\/title>/.exec(data) - if(titleRet && titleRet[1]) { + if (titleRet && titleRet[1]) { data = { error: titleRet[1] } } else { return this.err('error', 60) diff --git a/models/ProfileServ.js b/models/ProfileServ.js index 4544b642..6b492c06 100644 --- a/models/ProfileServ.js +++ b/models/ProfileServ.js @@ -49,7 +49,7 @@ export default class ProfileServ extends Base { return { url: param.api || api, - params: param.params || {} + params: param.params || {} } } diff --git a/models/profile-lib/ArtisMark.js b/models/profile-lib/ArtisMark.js index ea081e33..31602e69 100644 --- a/models/profile-lib/ArtisMark.js +++ b/models/profile-lib/ArtisMark.js @@ -117,7 +117,7 @@ let ArtisMark = { let val = ds.value || ds[1] return (attrMark[attr] || 0) * val }, - getMaxMark (attrWeight) { + getMaxMark (attrs) { let ret = {} for (let idx = 1; idx <= 5; idx++) { let totalMark = 0 @@ -128,26 +128,26 @@ let ArtisMark = { } else if (idx === 2) { mAttr = 'atkPlus' } else if (idx >= 3) { - mAttr = ArtisMark.getMaxAttr(attrWeight, mainAttr[idx])[0] - mMark = attrWeight[mAttr] - totalMark += attrWeight[mAttr] * 2 + mAttr = ArtisMark.getMaxAttr(attrs, mainAttr[idx])[0] + mMark = attrs[mAttr].fixWeight + totalMark += attrs[mAttr].fixWeight * 2 } - let sAttr = ArtisMark.getMaxAttr(attrWeight, subAttr, 4, mAttr) + let sAttr = ArtisMark.getMaxAttr(attrs, subAttr, 4, mAttr) lodash.forEach(sAttr, (attr, aIdx) => { - totalMark += attrWeight[attr] * (aIdx === 0 ? 6 : 1) + totalMark += attrs[attr].fixWeight * (aIdx === 0 ? 6 : 1) }) ret[idx] = totalMark ret['m' + idx] = mMark } return ret }, - getMaxAttr (charAttr = {}, list2 = [], maxLen = 1, banAttr = '') { + getMaxAttr (attrs = {}, list2 = [], maxLen = 1, banAttr = '') { let tmp = [] lodash.forEach(list2, (attr) => { if (attr === banAttr) return - if (!charAttr[attr]) return - tmp.push({ attr, mark: charAttr[attr] }) + if (!attrs[attr]) return + tmp.push({ attr, mark: attrs[attr].fixWeight }) }) tmp = lodash.sortBy(tmp, 'mark') tmp = tmp.reverse() diff --git a/models/profile-lib/CharArtis.js b/models/profile-lib/CharArtis.js index 35578188..de4ff5d5 100644 --- a/models/profile-lib/CharArtis.js +++ b/models/profile-lib/CharArtis.js @@ -20,8 +20,16 @@ async function init () { await init() const CharArtis = { + reduceWeight (weight, key, plus, max) { + let original = weight[key] || 0 + if (original < max) { + weight[key] = Math.max(original + plus, max) + return true + } + return false + }, getCharArtisCfg (char, profile, artis) { - let { attr } = profile + let { attr, weapon } = profile let rule = function (title, attrWeight) { return { @@ -31,12 +39,55 @@ const CharArtis = { } let def = function (attrWeight) { - let title = '通用' + let title = [] let weight = attrWeight || usefulAttr[char.name] || { atk: 75, cp: 100, cd: 100 } - if (artis.is('绝缘4') && weight.recharge < 75) { - weight.recharge = 75 - title = '绝缘4' + let check = (key, max = 75, maxPlus = 75, isWeapon = true) => { + let original = weight[key] || 0 + if (original < max) { + let plus = isWeapon ? maxPlus * (1 + weapon.affix / 5) / 2 : maxPlus + weight[key] = Math.min(Math.round(original + plus), max) + return true + } + return false } + let wn = weapon.name + + // 增加攻击力或直接伤害类武器判定 + const weaponCfg = { + 磐岩结绿: { + attr: 'hp', + abbr: '绿剑' + }, + 赤角石溃杵: { + attr: 'def', + abbr: '赤角' + }, + 猎人之径: { + attr: 'mastery' + }, + 薙草之稻光: { + attr: 'recharge', + abbr: '薙刀' + } + } + if (weight.atk > 0 && weaponCfg[wn]) { + let wCfg = weaponCfg[wn] + if (check(wCfg.attr, wCfg.max || 75, wCfg.plus || 75)) { + title.push(wCfg.abbr || wn) + } + } + + // 不与攻击力挂钩的武器判定 + if (wn === '辰砂之纺锤' && check('def')) { + title.push('纺锤') + } + + // 圣遗物判定 + if (artis.is('绝缘4') && check('recharge', 75, 45, false)) { + title.push('绝缘4') + } + + title = title.length > 0 ? title.join('') : '通用' return { title: `${char.abbr}-${title}`, attrWeight: weight @@ -48,7 +99,7 @@ const CharArtis = { } if (charRule) { - return charRule({ attr, artis, rule, def, weapon: profile.weapon, cons: profile.cons }) + return charRule({ attr, artis, rule, def, weapon, cons: profile.cons }) } } } diff --git a/resources/meta/character/优菈/artis.js b/resources/meta/character/优菈/artis.js index 00b37609..2183b119 100644 --- a/resources/meta/character/优菈/artis.js +++ b/resources/meta/character/优菈/artis.js @@ -1,7 +1,7 @@ export default function ({ attr, rule, def }) { // 优菈核爆 - if (attr.cpct < 30 && attr.cdmg > 150) { + if (attr.cpct < 15 && attr.cdmg > 200) { return rule('优菈-核爆', { atk: 100, cd: 100, phy: 100 }) } return def({ atk: 75, cp: 100, cd: 100, phy: 100, recharge: 55 }) -} \ No newline at end of file +} diff --git a/resources/meta/character/可莉/artis.js b/resources/meta/character/可莉/artis.js index d6b2f3fc..a09f70ae 100644 --- a/resources/meta/character/可莉/artis.js +++ b/resources/meta/character/可莉/artis.js @@ -1,7 +1,6 @@ export default function ({ attr, weapon, rule, def }) { - // 蒸发可莉,具体数值待定 - if (attr.mastery < 80) { - return rule('可莉-纯火', { atk: 75, cp: 100, cd: 100, dmg: 100, recharge: 30 }) + if (attr.mastery < 50 && attr.cp * 2 + attr.cd > 320) { + return rule('可莉-纯火', { atk: 85, cp: 100, cd: 100, dmg: 100, recharge: 55 }) } return def({ atk: 75, cp: 100, cd: 100, mastery: 75, dmg: 100, recharge: 30 }) -} \ No newline at end of file +} diff --git a/resources/meta/character/宵宫/artis.js b/resources/meta/character/宵宫/artis.js index 284d9d80..fee2c0ed 100644 --- a/resources/meta/character/宵宫/artis.js +++ b/resources/meta/character/宵宫/artis.js @@ -1,9 +1,9 @@ -export default function ({ attr, rule, def }) { +export default function ({ attr, artis, rule, def }) { // 宵宫纯色流派 - if (attr.mastery < 80) { - return rule('宵宫-纯色', { atk: 75, cp: 100, cd: 100, dmg: 100 }) + if (attr.mastery < 50 && attr.cp * 2 + attr.cd > 320) { + return rule('宵宫-纯火', { atk: 85, cp: 100, cd: 100, dmg: 100 }) } - if (attr.mastery > 200) { + if (attr.mastery > 200 && artis.is('mastery', 3)) { return rule('宵宫-精通', { atk: 75, cp: 100, cd: 100, mastery: 100, dmg: 100 }) } return def({ atk: 75, cp: 100, cd: 100, mastery: 75, dmg: 100 }) diff --git a/resources/meta/character/甘雨/artis.js b/resources/meta/character/甘雨/artis.js index 1eff6638..aea0f267 100644 --- a/resources/meta/character/甘雨/artis.js +++ b/resources/meta/character/甘雨/artis.js @@ -1,6 +1,6 @@ export default function ({ artis, rule, def }) { if (artis.is('冰套4')) { - return rule('甘雨-永冻', { atk: 75, cp: 100, cd: 100, dmg: 100, recharge: 75 }) + return rule('甘雨-永冻', { atk: 75, cp: 100, cd: 100, dmg: 100, recharge: 55 }) } return def({ atk: 75, cp: 100, cd: 100, mastery: 75, dmg: 100 }) } diff --git a/resources/meta/character/胡桃/artis.js b/resources/meta/character/胡桃/artis.js index 8380cc10..e412b8a4 100644 --- a/resources/meta/character/胡桃/artis.js +++ b/resources/meta/character/胡桃/artis.js @@ -1,7 +1,7 @@ export default function ({ attr, rule, def }) { - // 核爆胡桃,具体数值待定 - if (attr.cpct < 30 && attr.cdmg > 200) { - return rule('胡桃-核爆', { hp: 85, atk: 50, cd: 100, mastery: 85, dmg: 100 }) + // 核爆胡桃 + if (attr.cpct < 15 && attr.cdmg > 280) { + return rule('胡桃-核爆', { hp: 90, atk: 50, cd: 100, mastery: 90, dmg: 100 }) } return def({ hp: 80, atk: 50, cp: 100, cd: 100, mastery: 75, dmg: 100 }) } diff --git a/resources/meta/reliquaries/artis-mark.js b/resources/meta/reliquaries/artis-mark.js index ed0d30cb..e3b7d960 100644 --- a/resources/meta/reliquaries/artis-mark.js +++ b/resources/meta/reliquaries/artis-mark.js @@ -12,11 +12,11 @@ export const attrValue = { } export const attrMap = { atk: { title: '大攻击', format: 'pct', type: 'normal', value: 5.83, text: '5.83%' }, - atkPlus: { title: '小攻击', format: 'comma', type: 'plus' }, + atkPlus: { title: '小攻击', format: 'comma', type: 'plus', base: 'atk', value: 15.56 }, def: { title: '大防御', format: 'pct', type: 'normal', value: 7.29, text: '7.29%' }, - defPlus: { title: '小防御', format: 'comma', type: 'plus' }, + defPlus: { title: '小防御', format: 'comma', type: 'plus', base: 'def', value: 18.52 }, hp: { title: '大生命', format: 'pct', type: 'normal', value: 5.83, text: '5.83%' }, - hpPlus: { title: '小生命', format: 'comma', type: 'plus' }, + hpPlus: { title: '小生命', format: 'comma', type: 'plus', base: 'hp', value: 239.0 }, cp: { title: '暴击率', format: 'pct', type: 'normal', value: 3.89, text: '3.89%' }, cd: { title: '暴击伤害', format: 'pct', type: 'normal', value: 7.77, text: '7.77%' }, mastery: { title: '元素精通', format: 'comma', type: 'normal', value: 23.31, text: '23.31' },