From 2cfbe4984f65d807817fa9c197df31d91f15057d Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Fri, 6 Jan 2023 22:26:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=AE=9A=E7=82=B9=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/panel/enemyCritical.vue | 33 +++++++++++++++++++++------------ src/ui/fixed.vue | 2 +- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/panel/enemyCritical.vue b/src/panel/enemyCritical.vue index 4df76b0..546f2d0 100644 --- a/src/panel/enemyCritical.vue +++ b/src/panel/enemyCritical.vue @@ -102,8 +102,11 @@ const def = ref(); const enemy = core.plugin.bookDetailEnemy; const ceil = Math.ceil; -let originCri = getCriticalDamage(enemy); -let originDef = getDefDamage(enemy); +const x = ref(props.fromBook ? void 0 : flags.mouseLoc[0]); +const y = ref(props.fromBook ? void 0 : flags.mouseLoc[1]); + +let originCri = getCriticalDamage(enemy, 0, 0, x.value, y.value); +let originDef = getDefDamage(enemy, 0, 0, x.value, y.value); // 当前数据 const allCri = ref(originCri); @@ -113,17 +116,22 @@ const allDef = ref(originDef); const addAtk = ref(0); const addDef = ref(0); -const originDamage = core.getDamageInfo(enemy); +const originDamage = core.getDamageInfo(enemy, void 0, x.value, y.value); // 转发core上的内容至当前作用域 const format = core.formatBigNumber; const ratio = core.status.thisMap.ratio; const nowDamage = computed(() => { - const dam = core.getDamageInfo(enemy, { - atk: core.getStatus('atk') + addAtk.value * ratio, - def: core.getStatus('def') + addDef.value * ratio - }); + const dam = core.getDamageInfo( + enemy, + { + atk: core.getStatus('atk') + addAtk.value * ratio, + def: core.getStatus('def') + addDef.value * ratio + }, + x.value, + y.value + ); if (!has(dam)) return ['???', '???']; if (!has(originDamage)) return [-dam.damage, dam.damage]; return [originDamage.damage - dam.damage, dam.damage]; @@ -177,20 +185,21 @@ function generateData(data: [number, number][]): ChartConfiguration['data'] { } const update = debounce((atk: Chart, def: Chart) => { - const [x, y] = props.fromBook ? [void 0, void 0] : flags.mouseLoc; + x.value = props.fromBook ? void 0 : flags.mouseLoc[0]; + y.value = props.fromBook ? void 0 : flags.mouseLoc[1]; allCri.value = getCriticalDamage( enemy, addAtk.value * ratio, addDef.value * ratio, - x, - y + x.value, + y.value ); allDef.value = getDefDamage( enemy, addDef.value * ratio, addAtk.value * ratio, - x, - y + x.value, + y.value ); if (allCri.value.length > originCri.length) originCri = allCri.value; if (allDef.value.length > originDef.length) originDef = allDef.value; diff --git a/src/ui/fixed.vue b/src/ui/fixed.vue index 126b612..30b945e 100644 --- a/src/ui/fixed.vue +++ b/src/ui/fixed.vue @@ -80,8 +80,8 @@ async function calHeight() { vw = window.innerWidth; width.value = vh * 0.28; await new Promise(res => requestAnimationFrame(res)); - if (!main) return; main = document.getElementById('enemy-fixed') as HTMLDivElement; + if (!main) return; const style = getComputedStyle(main); const h = parseFloat(style.height); const [cx, cy] = flags.clientLoc;