快速标记怪物

This commit is contained in:
unanmed 2022-12-30 11:06:46 +08:00
parent 1f1cd6ea3b
commit 3db34ffad9
11 changed files with 95 additions and 14 deletions

View File

@ -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();

View File

@ -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();
}
};

View File

@ -22,7 +22,16 @@
"markEnemy": {
"text": "标记怪物",
"desc": [
"标记怪物可以使你能够更加方便地了解一个怪物的情况。你可以在怪物手册的怪物更多信息栏进行标记。",
"标记怪物可以使你能够更加方便地了解一个怪物的情况。",
"<br>",
"你可以通过以下两种方式标记怪物:",
"<br>",
"1. 打开怪物手册,选中怪物,进入怪物更多信息栏,点击标记怪物。",
"<br>",
"2. 将鼠标移动到你想要标记的怪物上面按下M键即可标记怪物注意浏览地图中不能用该方式标记。",
"手机端暂时没有快速标记怪物的方式。",
"<br>",
"<br>",
"当一个怪物被标记后,怪物会有以下行为:",
"<br>",
"1. 当勇士恰好能打败怪物时,会进行提示",
@ -62,7 +71,7 @@
"在详细临界栏中,怪物的伤害会以可视化折线图的方式显示出来,从而你可以更为清晰地看出怪物减伤趋势。",
"除了查看怪物伤害曲线,你还可以规划宝石。每个折线图下方都有一个滑动条,你可以拖动来模拟吃宝石。",
"注意,拖动时,滑动条左边会显示当前的加攻或加防次数,这个数值指的是在勇士所在地图中需要吃的宝石数量。",
"例如当前勇士所在地图中一个宝石最低加2点攻击加攻为3那么勇士的攻击增加量就为6。",
"例如当前勇士所在地图中一个宝石最低加2点攻击加攻数为3那么勇士的攻击增加量就为6。",
"勇士增加的攻击数值也会在下方显示。当加攻次数和加防次数改变时,折线图也会变化。",
"当前状态下怪物的伤害以及减伤总量也会在下方显示。",
"<br>",

View File

@ -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;

View File

@ -4,7 +4,7 @@
<div class="des">加攻伤害</div>
<canvas ref="critical" class="chart"></canvas>
<div class="slider-div">
<span>加攻&nbsp;&nbsp;&nbsp;&nbsp;{{ addAtk }}</span>
<span>加攻&nbsp;&nbsp;&nbsp;&nbsp;{{ addAtk }}</span>
<a-slider
class="slider"
v-model:value="addAtk"
@ -25,7 +25,7 @@
<div class="des">加防伤害</div>
<canvas ref="def" class="chart"></canvas>
<div class="slider-div">
<span>加防&nbsp;&nbsp;&nbsp;&nbsp;{{ addDef }}</span>
<span>加防&nbsp;&nbsp;&nbsp;&nbsp;{{ addDef }}</span>
<a-slider
class="slider"
v-model:value="addDef"

View File

@ -116,5 +116,23 @@ export function checkMarkedEnemy(noMessage: boolean = false) {
export const checkMarkedStatus = ref(false);
export default function init() {
return { checkMarkedEnemy, checkStatus: checkMarkedStatus };
// 鼠标移动时进行监听按下M时进行快速标记
core.registerAction(
'onmove',
'mark',
(x, y) => {
if (core.isPlaying()) {
flags.mouseLoc = [x, y];
}
return false;
},
150
);
return {
checkMarkedEnemy,
checkStatus: checkMarkedStatus,
markEnemy,
hasMarkedEnemy,
unmarkEnemy
};
}

View File

@ -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;

View File

@ -14,7 +14,7 @@ type CanParseCss = keyof {
};
export default function init() {
return { has, getDamageColor, parseCss };
return { has, getDamageColor, parseCss, tip };
}
/**

12
src/types/core.d.ts vendored
View File

@ -1324,6 +1324,11 @@ interface Main extends MainData {
*
*/
listen(): void;
/**
* ts的插件转发
*/
forward(): void;
}
interface Flags {
@ -1362,6 +1367,11 @@ interface Flags {
*/
readonly __visited__: Record<FloorIds, boolean>;
/**
*
*/
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;
}

25
src/types/plugin.d.ts vendored
View File

@ -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<Record<CanParseCss, string>>;
/**
*
* @param text
*/
tip(
type: 'warn' | 'info' | 'success' | 'error' | 'warning' | 'loading',
text: string
): void;
}
interface PluginUis {

View File

@ -47,9 +47,9 @@ function exit() {
const content = computed(() => {
return desc[selected.value].desc
.map((v, i, a) => {
if (/^\d+\./.test(v)) return `${'&nbsp;'.repeat(4)}${v}`;
if (/^\d+\./.test(v)) return `${'&nbsp;'.repeat(12)}${v}`;
else if (
(has(a[i - 1] && v !== '<br>') && a[i - 1] === '<br>') ||
(has(a[i - 1]) && v !== '<br>' && a[i - 1] === '<br>') ||
i === 0
) {
return `${'&nbsp;'.repeat(8)}${v}`;