refactor: 设置获取

This commit is contained in:
AncTe committed 2024-02-02 17:59:38 +08:00
1 parent fa73b47d02
commit a825b268bc
11 files changed
+105 -125

No files matched your search

+4 -2
View File
@@ -25,9 +25,11 @@ const MAX_ROTATE = 0.5;
const FRAG_TIMING = linear();
export function init() {
Mota.rewrite(core.events, 'afterBattle', 'add', (_, enemy, x, y) => {
const fn = Mota.requireAll('fn');
Mota.rewrite(fn, 'afterBattle', 'add', (_, enemy, x, y) => {
// 打怪特效
if (core.getLocalStorage('frag') && has(x) && has(y)) {
const setting = Mota.require('var', 'mainSetting');
if (setting.getValue('screen.frag') && has(x) && has(y)) {
const frame = core.status.globalAnimateStatus % 2;
const canvas = document.createElement('canvas');
canvas.width = 32;
+2 -1
View File
@@ -11,7 +11,8 @@ export function drawHalo(
floorId: FloorIds
) {
if (main.replayChecking) return;
if (!core.getLocalStorage('showHalo', true)) return;
const setting = Mota.require('var', 'mainSetting');
if (!setting.getValue('screen.showHalo', true)) return;
const list = core.status.maps[floorId].enemy.haloList.concat(
Object.keys(flags[`melt_${floorId}`] ?? {}).map(v => {
const [x, y] = v.split(',').map(v => parseInt(v));
+2 -1
View File
@@ -1,5 +1,6 @@
function drawHeroDetail(px: number, py: number) {
if (!core.getLocalStorage('heroDetail', false)) return;
const setting = Mota.require('var', 'mainSetting');
if (!setting.getValue('screen.heroDetail', false)) return;
const { hp, atk, def } = core.status.hero;
const toDraw = {
atk: {
+2 -1
View File
@@ -33,7 +33,8 @@ export function init() {
// 获取宝石信息 并绘制
function getItemDetail(floorId: FloorIds, onMap: boolean) {
if (!core.getLocalStorage('itemDetail')) return;
const setting = Mota.require('var', 'mainSetting');
if (!setting.getValue('screen.itemDetail')) return;
floorId ??= core.status.thisMap.floorId;
let diff: Record<string | symbol, number | undefined> = {};
const before = core.status.hero;