From 3db34ffad945fdfad8c1a58253fe6bd3842ebf05 Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Fri, 30 Dec 2022 11:06:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BF=AB=E9=80=9F=E6=A0=87=E8=AE=B0=E6=80=AA?= =?UTF-8?q?=E7=89=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/project/functions.js | 18 ++++++++++++++++-- public/project/plugins.js | 3 ++- src/data/desc.json | 13 +++++++++++-- src/initPlugin.ts | 6 ++++-- src/panel/enemyCritical.vue | 4 ++-- src/plugin/mark.ts | 20 +++++++++++++++++++- src/plugin/pop.ts | 2 +- src/plugin/utils.ts | 2 +- src/types/core.d.ts | 12 ++++++++++++ src/types/plugin.d.ts | 25 +++++++++++++++++++++++++ src/ui/desc.vue | 4 ++-- 11 files changed, 95 insertions(+), 14 deletions(-) diff --git a/public/project/functions.js b/public/project/functions.js index c2a501e..a9807b0 100644 --- a/public/project/functions.js +++ b/public/project/functions.js @@ -1224,8 +1224,22 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = { case 72: // H:打开帮助页面 core.ui._drawHelp(); break; - case 77: // M:打开存档笔记 - core.actions._clickNotes_show(); + case 77: // M:快速标记 + const [x, y] = flags.mouseLoc; + const mx = Math.round(x + core.bigmap.offsetX / 32); + const my = Math.round(y + core.bigmap.offsetY / 32); + const blocks = core.getMapBlocksObj(); + const block = blocks[`${mx},${my}`]; + if (block.event.cls.startsWith('enemy')) { + const name = core.material.enemys[block.event.id].name; + if (core.hasMarkedEnemy(block.event.id)) { + core.tip('success', `已取消标记${name}!`); + core.unmarkEnemy(block.event.id); + } else { + core.tip('success', `已标记${name}!`); + core.markEnemy(block.event.id); + } + } break; case 78: // N:重新开始 core.confirmRestart(); diff --git a/public/project/plugins.js b/public/project/plugins.js index c9d95c8..62f1adf 100644 --- a/public/project/plugins.js +++ b/public/project/plugins.js @@ -3,7 +3,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { init: function () { this._afterLoadResources = function () { - if (!main.replayChecking) { + if (!main.replayChecking && main.mode === 'play') { + main.forward(); core.resetSettings(); } }; diff --git a/src/data/desc.json b/src/data/desc.json index 7f02600..914bbad 100644 --- a/src/data/desc.json +++ b/src/data/desc.json @@ -22,7 +22,16 @@ "markEnemy": { "text": "标记怪物", "desc": [ - "标记怪物可以使你能够更加方便地了解一个怪物的情况。你可以在怪物手册的怪物更多信息栏进行标记。", + "标记怪物可以使你能够更加方便地了解一个怪物的情况。", + "
", + "你可以通过以下两种方式标记怪物:", + "
", + "1. 打开怪物手册,选中怪物,进入怪物更多信息栏,点击标记怪物。", + "
", + "2. 将鼠标移动到你想要标记的怪物上面,按下M键,即可标记怪物,注意浏览地图中不能用该方式标记。", + "手机端暂时没有快速标记怪物的方式。", + "
", + "
", "当一个怪物被标记后,怪物会有以下行为:", "
", "1. 当勇士恰好能打败怪物时,会进行提示", @@ -62,7 +71,7 @@ "在详细临界栏中,怪物的伤害会以可视化折线图的方式显示出来,从而你可以更为清晰地看出怪物减伤趋势。", "除了查看怪物伤害曲线,你还可以规划宝石。每个折线图下方都有一个滑动条,你可以拖动来模拟吃宝石。", "注意,拖动时,滑动条左边会显示当前的加攻或加防次数,这个数值指的是在勇士所在地图中需要吃的宝石数量。", - "例如,当前勇士所在地图中一个宝石最低加2点攻击,加攻数值为3,那么勇士的攻击增加量就为6。", + "例如,当前勇士所在地图中一个宝石最低加2点攻击,加攻次数为3,那么勇士的攻击增加量就为6。", "勇士增加的攻击数值也会在下方显示。当加攻次数和加防次数改变时,折线图也会变化。", "当前状态下怪物的伤害以及减伤总量也会在下方显示。", "
", diff --git a/src/initPlugin.ts b/src/initPlugin.ts index eed364e..d9a8d0b 100644 --- a/src/initPlugin.ts +++ b/src/initPlugin.ts @@ -9,7 +9,7 @@ import mark from './plugin/mark'; import setting from './plugin/settings'; import chapter from './plugin/ui/chapter'; -window.addEventListener('load', () => { +function forward() { // 每个引入的插件都要在这里执行,否则不会被转发 const toForward: any[] = [ pop(), @@ -42,4 +42,6 @@ window.addEventListener('load', () => { console.log('插件转发完成!'); })(); -}); +} + +main.forward = forward; diff --git a/src/panel/enemyCritical.vue b/src/panel/enemyCritical.vue index 70475bc..36e3043 100644 --- a/src/panel/enemyCritical.vue +++ b/src/panel/enemyCritical.vue @@ -4,7 +4,7 @@
加攻伤害
- 加攻数值    {{ addAtk }} + 加攻次数    {{ addAtk }} 加防伤害
- 加防数值    {{ addDef }} + 加防次数    {{ addDef }} { + if (core.isPlaying()) { + flags.mouseLoc = [x, y]; + } + return false; + }, + 150 + ); + return { + checkMarkedEnemy, + checkStatus: checkMarkedStatus, + markEnemy, + hasMarkedEnemy, + unmarkEnemy + }; } diff --git a/src/plugin/pop.ts b/src/plugin/pop.ts index bf2ea8d..8fea5ba 100644 --- a/src/plugin/pop.ts +++ b/src/plugin/pop.ts @@ -15,7 +15,7 @@ export default function init() { * 弹出文字 */ function popValue() { - let ctx = core.getContextByName('pop'); + let ctx = core.getContextByName('pop')!; if (!ctx) ctx = core.createCanvas('pop', 0, 0, core._PX_, core._PY_, 90); core.clearMap(ctx); let count = 0; diff --git a/src/plugin/utils.ts b/src/plugin/utils.ts index 4876571..0ccaebb 100644 --- a/src/plugin/utils.ts +++ b/src/plugin/utils.ts @@ -14,7 +14,7 @@ type CanParseCss = keyof { }; export default function init() { - return { has, getDamageColor, parseCss }; + return { has, getDamageColor, parseCss, tip }; } /** diff --git a/src/types/core.d.ts b/src/types/core.d.ts index 76393bf..3d0e16f 100644 --- a/src/types/core.d.ts +++ b/src/types/core.d.ts @@ -1324,6 +1324,11 @@ interface Main extends MainData { * 执行样板的所有监听 */ listen(): void; + + /** + * 执行ts的插件转发 + */ + forward(): void; } interface Flags { @@ -1362,6 +1367,11 @@ interface Flags { */ readonly __visited__: Record; + /** + * 鼠标位置 + */ + mouseLoc: LocArr; + [key: string]: any; } @@ -1453,4 +1463,6 @@ declare const plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1: PluginDeclaration; interface Window { core: CoreMixin; + flags: Flags; + hero: HeroStatus; } diff --git a/src/types/plugin.d.ts b/src/types/plugin.d.ts index ad5c758..e49e94d 100644 --- a/src/types/plugin.d.ts +++ b/src/types/plugin.d.ts @@ -49,6 +49,22 @@ interface PluginDeclaration extends PluginUtils, PluginUis, PluginUse { */ checkMarkedEnemy(): void; + /** + * 标记怪物 + * @param id 怪物id + */ + markEnemy(id: EnemyIds): void; + + /** + * 是否标记过某个怪物 + */ + hasMarkedEnemy(id: EnemyIds): void; + + /** + * 取消标记过某个怪物 + */ + unmarkEnemy(id: EnemyIds): void; + /** * 重置设置信息 */ @@ -73,6 +89,15 @@ interface PluginUtils { * @param css 要解析的css字符串 */ parseCss(css: string): Partial>; + + /** + * 弹出一段提示 + * @param text 提示信息 + */ + tip( + type: 'warn' | 'info' | 'success' | 'error' | 'warning' | 'loading', + text: string + ): void; } interface PluginUis { diff --git a/src/ui/desc.vue b/src/ui/desc.vue index 92fee34..b2cd066 100644 --- a/src/ui/desc.vue +++ b/src/ui/desc.vue @@ -47,9 +47,9 @@ function exit() { const content = computed(() => { return desc[selected.value].desc .map((v, i, a) => { - if (/^\d+\./.test(v)) return `${' '.repeat(4)}${v}`; + if (/^\d+\./.test(v)) return `${' '.repeat(12)}${v}`; else if ( - (has(a[i - 1] && v !== '
') && a[i - 1] === '
') || + (has(a[i - 1]) && v !== '
' && a[i - 1] === '
') || i === 0 ) { return `${' '.repeat(8)}${v}`;