From 4f189cbb719493297a54232b121ef88773b2605b Mon Sep 17 00:00:00 2001 From: UCPr <2032385471@qq.com> Date: Wed, 22 Jan 2025 23:59:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=98=89=E9=9F=B3=E5=88=AB?= =?UTF-8?q?=E5=90=8D=EF=BC=9B=E4=BF=AE=E5=A4=8D=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- defSet/alias.yaml | 7 + lib/convert/weapon.js | 23 --- model/damage/BuffManager.js | 7 +- model/damage/BuffManager.ts | 6 +- model/damage/avatar.js | 20 +- model/damage/avatar.ts | 19 +- resources/map/WeaponId2Data.json | 338 ------------------------------- 7 files changed, 35 insertions(+), 385 deletions(-) delete mode 100644 resources/map/WeaponId2Data.json diff --git a/defSet/alias.yaml b/defSet/alias.yaml index 1fec5ca..620cb8e 100644 --- a/defSet/alias.yaml +++ b/defSet/alias.yaml @@ -1,3 +1,10 @@ +耀嘉音: + - 嘉音 + - 耀佳音 + - 佳音 + - 要加衣 + - '+1' + - Astra Yao 「11号」: - 十一号 - 十一 diff --git a/lib/convert/weapon.js b/lib/convert/weapon.js index 7148086..798059a 100644 --- a/lib/convert/weapon.js +++ b/lib/convert/weapon.js @@ -30,26 +30,3 @@ export const weaponFileNameToID = name => { export const getAllWeaponID = () => { return Object.keys(WeaponId2Sprite); }; - -const WeaponId2Data = getMapData('WeaponId2Data'); - -/** - * 武器名称转id - * @param {string} name 武器全称 - * @returns {number | null} - */ -export const weaponNameToID = name => { - for (const [id, data] of Object.entries(WeaponId2Data)) { - if (data.name === name) return +id; - } - return null; -} - -/** - * 武器ID转职业 - * @param {number} id 武器全称 - * @returns {number | null} - */ -export const weaponIDToProfession = id => { - return WeaponId2Data[id]?.profession ?? null; -} diff --git a/model/damage/BuffManager.js b/model/damage/BuffManager.js index 25ad2c5..3e44065 100644 --- a/model/damage/BuffManager.js +++ b/model/damage/BuffManager.js @@ -1,4 +1,3 @@ -import { weaponIDToProfession } from '../../lib/convert/weapon.js'; import _ from 'lodash'; export var elementEnum; (function (elementEnum) { @@ -90,8 +89,10 @@ export class BuffManager { // 武器buff职业检查 if (buff.source === 'Weapon') { const professionCheck = (avatar) => { - const weapon_profession = weaponIDToProfession(avatar.weapon.id); - return !weapon_profession || avatar.avatar_profession === weapon_profession; + const weapon_profession = avatar.weapon?.profession; + if (!weapon_profession) + return true; + return avatar.avatar_profession === weapon_profession; }; const oriCheck = typeof buff.check === 'function' && buff.check; buff.check = ({ avatar, buffM, calc }) => professionCheck(avatar) && (!oriCheck || oriCheck({ avatar, buffM, calc })); diff --git a/model/damage/BuffManager.ts b/model/damage/BuffManager.ts index 971c8fb..d28d8eb 100644 --- a/model/damage/BuffManager.ts +++ b/model/damage/BuffManager.ts @@ -1,6 +1,5 @@ import type { ZZZAvatarInfo } from '../avatar.js' import type { Calculator, skill } from './Calculator.ts' -import { weaponIDToProfession } from '../../lib/convert/weapon.js' import _ from 'lodash' export enum elementEnum { @@ -139,8 +138,9 @@ export class BuffManager { // 武器buff职业检查 if (buff.source === 'Weapon') { const professionCheck = (avatar: ZZZAvatarInfo) => { - const weapon_profession = weaponIDToProfession(avatar.weapon.id) - return !weapon_profession || avatar.avatar_profession === weapon_profession + const weapon_profession = avatar.weapon?.profession + if (!weapon_profession) return true + return avatar.avatar_profession === weapon_profession } const oriCheck = typeof buff.check === 'function' && buff.check buff.check = ({ avatar, buffM, calc }) => professionCheck(avatar) && (!oriCheck || oriCheck({ avatar, buffM, calc })) diff --git a/model/damage/avatar.js b/model/damage/avatar.js index cb856a9..b1d2c9b 100644 --- a/model/damage/avatar.js +++ b/model/damage/avatar.js @@ -106,8 +106,10 @@ export function avatar_ability(avatar) { return calc.calc(); } /** 武器加成 */ -export function weapon_buff(equipment, buffM) { - const name = equipment.name; +export function weapon_buff(weapon, buffM) { + const name = weapon?.name; + if (!name) + return; logger.debug('武器:' + name); const m = calcFnc.weapon[name]; if (!m) @@ -116,29 +118,29 @@ export function weapon_buff(equipment, buffM) { if (m.buffs) buffM.new(m.buffs); if (m.calc) - m.calc(buffM, equipment.star); + m.calc(buffM, weapon.star); buffM.default({}); } /** 套装加成 */ -export function set_buff(equip, buffM) { +export function set_buff(equips, buffM) { buffM.default({ name: '', source: 'Set' }); const setCount = {}; - for (const equip_detail of equip) { - if (equip_detail.equipment_type == 5) { + for (const equip of equips) { + if (equip.equipment_type == 5) { // 属伤加成 - const index = [31503, 31603, 31703, 31803, 31903].indexOf(equip_detail.main_properties[0].property_id); + const index = [31503, 31603, 31703, 31803, 31903].indexOf(equip.main_properties[0].property_id); if (index > -1 && elementEnum[index]) { // @ts-ignore buffM.new({ name: '驱动盘5号位', type: '增伤', - value: Number(equip_detail.main_properties[0].base.replace('%', '')) / 100, + value: Number(equip.main_properties[0].base.replace('%', '')) / 100, isForever: true, element: elementEnum[index] }); } } - const suit_name = equip_detail.equip_suit.name; + const suit_name = equip.equip_suit.name; setCount[suit_name] = (setCount[suit_name] || 0) + 1; } buffM.setCount = setCount; diff --git a/model/damage/avatar.ts b/model/damage/avatar.ts index 5e911a9..30dc67d 100644 --- a/model/damage/avatar.ts +++ b/model/damage/avatar.ts @@ -133,37 +133,38 @@ export function avatar_ability(avatar: ZZZAvatarInfo) { } /** 武器加成 */ -export function weapon_buff(equipment: ZZZAvatarInfo['weapon'], buffM: BuffManager) { - const name = equipment.name +export function weapon_buff(weapon: ZZZAvatarInfo['weapon'], buffM: BuffManager) { + const name = weapon?.name + if (!name) return logger.debug('武器:' + name) const m = calcFnc.weapon[name] if (!m) return buffM.default({ name, source: 'Weapon' }) if (m.buffs) buffM.new(m.buffs) - if (m.calc) m.calc(buffM, equipment.star) + if (m.calc) m.calc(buffM, weapon.star) buffM.default({}) } /** 套装加成 */ -export function set_buff(equip: ZZZAvatarInfo['equip'], buffM: BuffManager) { +export function set_buff(equips: ZZZAvatarInfo['equip'], buffM: BuffManager) { buffM.default({ name: '', source: 'Set' }) const setCount: { [name: string]: number } = {} - for (const equip_detail of equip) { - if (equip_detail.equipment_type == 5) { + for (const equip of equips) { + if (equip.equipment_type == 5) { // 属伤加成 - const index = [31503, 31603, 31703, 31803, 31903].indexOf(equip_detail.main_properties[0].property_id) + const index = [31503, 31603, 31703, 31803, 31903].indexOf(equip.main_properties[0].property_id) if (index > -1 && elementEnum[index]) { // @ts-ignore buffM.new({ name: '驱动盘5号位', type: '增伤', - value: Number(equip_detail.main_properties[0].base.replace('%', '')) / 100, + value: Number(equip.main_properties[0].base.replace('%', '')) / 100, isForever: true, element: elementEnum[index] }) } } - const suit_name = equip_detail.equip_suit.name + const suit_name = equip.equip_suit.name setCount[suit_name] = (setCount[suit_name] || 0) + 1 } buffM.setCount = setCount diff --git a/resources/map/WeaponId2Data.json b/resources/map/WeaponId2Data.json deleted file mode 100644 index 99d4230..0000000 --- a/resources/map/WeaponId2Data.json +++ /dev/null @@ -1,338 +0,0 @@ -{ - "12001": { - "id": 12001, - "name": "「月相」-望", - "rarity": "B", - "profession": 1 - }, - "12002": { - "id": 12002, - "name": "「月相」-晦", - "rarity": "B", - "profession": 1 - }, - "12003": { - "id": 12003, - "name": "「月相」-朔", - "rarity": "B", - "profession": 1 - }, - "12004": { - "id": 12004, - "name": "「残响」-Ⅰ型", - "rarity": "B", - "profession": 4 - }, - "12005": { - "id": 12005, - "name": "「残响」-Ⅱ型", - "rarity": "B", - "profession": 4 - }, - "12006": { - "id": 12006, - "name": "「残响」-Ⅲ型", - "rarity": "B", - "profession": 4 - }, - "12007": { - "id": 12007, - "name": "「湍流」-铳型", - "rarity": "B", - "profession": 2 - }, - "12008": { - "id": 12008, - "name": "「湍流」-矢型", - "rarity": "B", - "profession": 2 - }, - "12009": { - "id": 12009, - "name": "「湍流」-斧型", - "rarity": "B", - "profession": 2 - }, - "12010": { - "id": 12010, - "name": "「电磁暴」-壹式", - "rarity": "B", - "profession": 3 - }, - "12011": { - "id": 12011, - "name": "「电磁暴」-贰式", - "rarity": "B", - "profession": 3 - }, - "12012": { - "id": 12012, - "name": "「电磁暴」-叁式", - "rarity": "B", - "profession": 3 - }, - "12013": { - "id": 12013, - "name": "「恒等式」-本格", - "rarity": "B", - "profession": 5 - }, - "12014": { - "id": 12014, - "name": "「恒等式」-变格", - "rarity": "B", - "profession": 5 - }, - "13001": { - "id": 13001, - "name": "街头巨星", - "rarity": "A", - "profession": 1 - }, - "13002": { - "id": 13002, - "name": "时光切片", - "rarity": "A", - "profession": 4 - }, - "13003": { - "id": 13003, - "name": "雨林饕客", - "rarity": "A", - "profession": 3 - }, - "13004": { - "id": 13004, - "name": "星徽引擎", - "rarity": "A", - "profession": 1 - }, - "13005": { - "id": 13005, - "name": "人为刀俎", - "rarity": "A", - "profession": 2 - }, - "13006": { - "id": 13006, - "name": "贵重骨核", - "rarity": "A", - "profession": 2 - }, - "13007": { - "id": 13007, - "name": "正版变身器", - "rarity": "A", - "profession": 5 - }, - "13008": { - "id": 13008, - "name": "双生泣星", - "rarity": "A", - "profession": 3 - }, - "13009": { - "id": 13009, - "name": "触电唇彩", - "rarity": "A", - "profession": 3 - }, - "13010": { - "id": 13010, - "name": "兔能环", - "rarity": "A", - "profession": 5 - }, - "13011": { - "id": 13011, - "name": "春日融融", - "rarity": "A", - "profession": 5 - }, - "13013": { - "id": 13013, - "name": "鎏金花信", - "rarity": "A", - "profession": 1 - }, - "13015": { - "id": 13015, - "name": "强音热望", - "rarity": "A", - "profession": 1 - }, - "13101": { - "id": 13101, - "name": "德玛拉电池Ⅱ型", - "rarity": "A", - "profession": 2 - }, - "13103": { - "id": 13103, - "name": "聚宝箱", - "rarity": "A", - "profession": 4 - }, - "13106": { - "id": 13106, - "name": "家政员", - "rarity": "A", - "profession": 1 - }, - "13108": { - "id": 13108, - "name": "仿制星徽引擎", - "rarity": "A", - "profession": 1 - }, - "13111": { - "id": 13111, - "name": "旋钻机-赤轴", - "rarity": "A", - "profession": 1 - }, - "13112": { - "id": 13112, - "name": "比格气缸", - "rarity": "A", - "profession": 5 - }, - "13113": { - "id": 13113, - "name": "含羞恶面", - "rarity": "A", - "profession": 4 - }, - "13115": { - "id": 13115, - "name": "好斗的阿炮", - "rarity": "A", - "profession": 4 - }, - "13127": { - "id": 13127, - "name": "维序者-特化型", - "rarity": "A", - "profession": 5 - }, - "13128": { - "id": 13128, - "name": "轰鸣座驾", - "rarity": "A", - "profession": 3 - }, - "14001": { - "id": 14001, - "name": "加农转子", - "rarity": "A", - "profession": 1 - }, - "14002": { - "id": 14002, - "name": "逍遥游球", - "rarity": "A", - "profession": 4 - }, - "14003": { - "id": 14003, - "name": "左轮转子", - "rarity": "A", - "profession": 2 - }, - "14102": { - "id": 14102, - "name": "钢铁肉垫", - "rarity": "S", - "profession": 1 - }, - "14104": { - "id": 14104, - "name": "硫磺石", - "rarity": "S", - "profession": 1 - }, - "14107": { - "id": 14107, - "name": "奔袭獠牙", - "rarity": "S", - "profession": 5 - }, - "14109": { - "id": 14109, - "name": "霰落星殿", - "rarity": "S", - "profession": 3 - }, - "14110": { - "id": 14110, - "name": "燃狱齿轮", - "rarity": "S", - "profession": 2 - }, - "14114": { - "id": 14114, - "name": "拘缚者", - "rarity": "S", - "profession": 2 - }, - "14116": { - "id": 14116, - "name": "焰心桂冠", - "rarity": "S", - "profession": 2 - }, - "14117": { - "id": 14117, - "name": "灼心摇壶", - "rarity": "S", - "profession": 3 - }, - "14118": { - "id": 14118, - "name": "嵌合编译器", - "rarity": "S", - "profession": 3 - }, - "14119": { - "id": 14119, - "name": "深海访客", - "rarity": "S", - "profession": 1 - }, - "14120": { - "id": 14120, - "name": "残心青囊", - "rarity": "S", - "profession": 1 - }, - "14121": { - "id": 14121, - "name": "啜泣摇篮", - "rarity": "S", - "profession": 4 - }, - "14122": { - "id": 14122, - "name": "时流贤者", - "rarity": "S", - "profession": 3 - }, - "14124": { - "id": 14124, - "name": "防暴者Ⅵ型", - "rarity": "S", - "profession": 1 - }, - "14125": { - "id": 14125, - "name": "玉壶青冰", - "rarity": "S", - "profession": 2 - }, - "14126": { - "id": 14126, - "name": "淬锋钳刺", - "rarity": "S", - "profession": 3 - } -} \ No newline at end of file