From 36cf6150e4f5f85b75a61be6fd4dda01376f6083 Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Fri, 6 Jan 2023 22:18:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E7=82=B9=E6=9F=A5=E7=9C=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/project/functions.js | 8 ++++++++ src/panel/enemyCritical.vue | 13 +++++++++++-- src/plugin/ui/book.tsx | 38 +++++++++++++++++++++++++++---------- src/plugin/ui/fixed.ts | 4 ++++ src/plugin/uiController.ts | 8 ++++++-- src/types/plugin.d.ts | 6 ++++++ src/ui/book.vue | 6 +++++- src/ui/bookDetail.vue | 17 +++++++++++++++-- src/ui/fixed.vue | 1 + src/ui/fixedDetail.vue | 34 +++++++++++++++++++++++++++++++++ 10 files changed, 118 insertions(+), 17 deletions(-) create mode 100644 src/ui/fixedDetail.vue diff --git a/public/project/functions.js b/public/project/functions.js index a5af39e..896094a 100644 --- a/public/project/functions.js +++ b/public/project/functions.js @@ -1247,6 +1247,14 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = { case 72: // H:打开帮助页面 core.useItem('I560', true); break; + case 75: // J:定点查看 + if ( + core.getBlockCls(...flags.mouseLoc)?.startsWith('enemy') + ) { + core.plugin.showFixed.value = false; + core.plugin.fixedDetailOpened.value = true; + } + break; case 77: // M:快速标记 const [x, y] = flags.mouseLoc; const mx = Math.round(x + core.bigmap.offsetX / 32); diff --git a/src/panel/enemyCritical.vue b/src/panel/enemyCritical.vue index b5a57be..4df76b0 100644 --- a/src/panel/enemyCritical.vue +++ b/src/panel/enemyCritical.vue @@ -92,6 +92,10 @@ import { has, setCanvasSize } from '../plugin/utils'; import { debounce } from 'lodash'; import { isMobile } from '../plugin/use'; +const props = defineProps<{ + fromBook?: boolean; +}>(); + const critical = ref(); const def = ref(); @@ -173,15 +177,20 @@ 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; allCri.value = getCriticalDamage( enemy, addAtk.value * ratio, - addDef.value * ratio + addDef.value * ratio, + x, + y ); allDef.value = getDefDamage( enemy, addDef.value * ratio, - addAtk.value * ratio + addAtk.value * ratio, + x, + y ); if (allCri.value.length > originCri.length) originCri = allCri.value; if (allDef.value.length > originDef.length) originDef = allDef.value; diff --git a/src/plugin/ui/book.tsx b/src/plugin/ui/book.tsx index 5faa73f..a204839 100644 --- a/src/plugin/ui/book.tsx +++ b/src/plugin/ui/book.tsx @@ -48,7 +48,10 @@ export function getSpecialHint(enemy: Enemy & DetailedEnemy) { export function getDefDamage( enemy: DetailedEnemy, addDef: number = 0, - addAtk: number = 0 + addAtk: number = 0, + x?: number, + y?: number, + floorId?: FloorIds ) { const ratio = core.status.thisMap.ratio; const res: [number, number][] = []; @@ -59,10 +62,16 @@ export function getDefDamage( const max = 100 - Math.floor(addDef / ratio); for (let i = 0; i <= max; i++) { - const dam = core.getDamageInfo(enemy.id, { - def: core.getStatus('def') + ratio * i + addDef, - atk: core.getStatus('atk') + addAtk - }); + const dam = core.getDamageInfo( + enemy.id, + { + def: core.getStatus('def') + ratio * i + addDef, + atk: core.getStatus('atk') + addAtk + }, + x, + y, + floorId + ); if (res.length === 0) { origin = dam?.damage; @@ -88,7 +97,10 @@ export function getDefDamage( export function getCriticalDamage( enemy: DetailedEnemy, addAtk: number = 0, - addDef: number = 0 + addDef: number = 0, + x?: number, + y?: number, + floorId?: FloorIds ): [number, number][] { const ratio = core.status.thisMap.ratio; const res: [number, number][] = []; @@ -99,10 +111,16 @@ export function getCriticalDamage( const max = 100 - Math.floor(addAtk / ratio); for (let i = 0; i <= max; i++) { - const dam = core.getDamageInfo(enemy.id, { - atk: core.getStatus('atk') + ratio * i + addAtk, - def: core.getStatus('def') + addDef - }); + const dam = core.getDamageInfo( + enemy.id, + { + atk: core.getStatus('atk') + ratio * i + addAtk, + def: core.getStatus('def') + addDef + }, + x, + y, + floorId + ); if (res.length === 0) { origin = dam?.damage; diff --git a/src/plugin/ui/fixed.ts b/src/plugin/ui/fixed.ts index a0fc6f3..0c5cfb9 100644 --- a/src/plugin/ui/fixed.ts +++ b/src/plugin/ui/fixed.ts @@ -23,6 +23,10 @@ export default function init() { showFixed.value = false; show(ev); }); + + return { + showFixed + }; } export function getDetailedEnemy( diff --git a/src/plugin/uiController.ts b/src/plugin/uiController.ts index 34532ac..df79740 100644 --- a/src/plugin/uiController.ts +++ b/src/plugin/uiController.ts @@ -8,6 +8,7 @@ import Desc from '../ui/desc.vue'; import Skill from '../ui/skill.vue'; import SkillTree from '../ui/skillTree.vue'; import Fly from '../ui/fly.vue'; +import FixedDetail from '../ui/fixedDetail.vue'; export const bookOpened = ref(false); export const toolOpened = ref(false); @@ -19,6 +20,7 @@ export const skillOpened = ref(false); export const skillTreeOpened = ref(false); export const flyOpened = ref(false); export const showStudiedSkill = ref(false); +export const fixedDetailOpened = ref(false); export const transition = ref(true); export const noClosePanel = ref(false); @@ -34,7 +36,8 @@ const UI_LIST: [Ref, Component][] = [ [descOpened, Desc], [skillOpened, Skill], [skillTreeOpened, SkillTree], - [flyOpened, Fly] + [flyOpened, Fly], + [fixedDetailOpened, FixedDetail] ]; /** ui栈 */ @@ -69,7 +72,8 @@ export default function init() { skillOpened, skillTreeOpened, flyOpened, - showStudiedSkill + showStudiedSkill, + fixedDetailOpened }; } diff --git a/src/types/plugin.d.ts b/src/types/plugin.d.ts index c03de69..9b93ac6 100644 --- a/src/types/plugin.d.ts +++ b/src/types/plugin.d.ts @@ -178,6 +178,12 @@ interface PluginUis { /** 是否展示已学习的技能 */ readonly showStudiedSkill: Ref; + /** 定点查看是否打开 */ + readonly fixedDetailOpened: Ref; + + /** 是否展示移动鼠标显示怪物信息的盒子 */ + readonly showFixed: Ref; + /** ui栈 */ readonly uiStack: Ref; diff --git a/src/ui/book.vue b/src/ui/book.vue index d303371..36234f0 100644 --- a/src/ui/book.vue +++ b/src/ui/book.vue @@ -30,7 +30,11 @@ - + + +