修复加载问题

This commit is contained in:
unanmed 2023-04-21 11:34:08 +08:00
parent 9db03e998e
commit 9927946b3e
15 changed files with 97 additions and 93 deletions

View File

@ -1,7 +1,7 @@
{
"name": "mota-ts",
"private": true,
"version": "0.0.0",
"version": "1.0.0-alpha",
"type": "module",
"scripts": {
"dev": "vite",

View File

@ -219,13 +219,14 @@ function main() {
}
// >>>> body end
main.prototype.loadScript = async function (src, module) {
main.prototype.loadScript = function (src, module) {
const script = document.createElement('script');
script.src = src;
if (module) script.type = 'module';
document.body.appendChild(script);
await new Promise(res => {
return new Promise((res, rej) => {
script.addEventListener('load', res);
script.addEventListener('error', rej);
});
};
@ -285,21 +286,27 @@ main.prototype.init = async function (mode, callback) {
await main.loadScript(`project/floors.min.js?v=${main.version}`);
main.dom.mainTips.style.display = 'none';
} else {
try {
await main.loadScript(
await new Promise(res => {
main.loadScript(
`/all/__all_floors__.js?v=${
main.version
}&id=${main.floorIds.join(',')}`
).then(
() => {
main.dom.mainTips.style.display = 'none';
main.supportBunch = true;
res();
},
async () => {
await Promise.all(
mainData.floorIds.map(v =>
main.loadScript(`project/floors/${v}.js`)
)
);
res();
}
);
main.dom.mainTips.style.display = 'none';
main.supportBunch = true;
} catch {
await Promise.all(
mainData.floorIds.map(v =>
main.loadScript(`project/floors/${v}.js`)
)
);
}
});
}
// 初始化core

View File

@ -147,14 +147,10 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
],
"bgms": [
"beforeBoss.mp3",
"beforeNight.mp3",
"cave.mp3",
"escape.mp3",
"grass.mp3",
"mount.mp3",
"night.mp3",
"palaceNorth.mp3",
"palaceSouth.mp3",
"plot1.mp3",
"road.mp3",
"title.mp3",

View File

@ -379,8 +379,8 @@ main.floors.MT14=
[152,152,152,152,152,152,152, 91,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,20053, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,20075],
[152,376,482,152,482, 27,152, 0, 0,236, 0, 0, 33,152,482,378, 21,381, 0, 27,152, 34, 29,152,152,20056, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,129],
[152, 0, 28,152,381, 0,235, 21,129,152,502,152,381,492,494,152,152,152,152,482,152, 29, 34,152,152,20064,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065, 0],
[152,152, 0,152,492,152,152, 0,152, 29, 33,152, 0,152,376,482, 21,378,152, 0,498, 34, 29,152,152, 27,336, 33, 0, 28, 0,345, 33,381, 0,235,141, 27,492,376,378,403,484, 0, 22,141, 21,336, 27, 28,381, 0, 34,502, 34,141,141,141,376,403,403, 0,254,333, 0, 0, 32,336, 32,333,376, 0,482,403,482,503, 0, 34,378, 0,129, 34,376, 0,336, 28,492,376,378, 21,403,503, 33,503,482, 85, 0,378,375,20007,482, 0,375,494, 0,207, 0,141, 0,499, 0,141, 22, 27,345,492, 0,376,345,403, 21, 34,378,336,376,381,376,20053],
[152,482,498, 0, 27, 0,152,482,152, 0,152,152, 0,152,482,152,371,403,152,152,152,492,254,152,152,482,498, 0,345,345, 0,345, 0,336,336, 0,381, 32,141,141,492,141,141,141,371,141, 27,336,141,141,498,141,502,333,502, 0,403,492, 34,141,333,333, 0, 32, 32, 27, 21,502, 0,333,141,141,492,141,503,141,141,141, 34, 0,336, 33,378, 0,336, 28,345,222,141,141,141, 33,336, 33,390,396, 0,482, 0,492, 0,20007, 33,20007, 34,20007, 27,141,482,141, 0,141, 28, 33,345, 0,336, 34,345, 0,340,376, 0,336, 32,378, 32,20056],
[152,152, 0,152,492,152,152, 0,152, 29, 33,152, 0,152,376,482, 21,378,152, 0,498, 34, 29,152,152, 27,336, 33, 0, 28, 0,345, 33,381, 0,235,141, 27,492,376,378,403,484, 0, 22,141, 21,336, 27, 28,381, 0, 34,502, 34,141,141,141,376,403,403, 0,254,333, 0, 0, 32,336, 32,333,376, 0,482,403,482,503, 0, 34,378,336,129, 34,376, 0,336, 28,492,376,378, 21,403,503, 33,503,482, 85, 0,378,375,20007,482, 0,375,494, 0,207, 0,141, 0,499, 0,141, 22, 27,345,492, 0,376,345,403, 21, 34,378,336,376,381,376,20053],
[152,482,498, 0, 27, 0,152,482,152, 0,152,152, 0,152,482,152,371,403,152,152,152,492,254,152,152,482,498, 0,345,345, 0,345, 0,336,336, 0,381, 32,141,141,492,141,141,141,371,141, 27,336,141,141,498,141,502,333,502, 0,403,492, 34,141,333,333, 0, 32, 32, 27, 21,502, 0,333,141,141,492,141,503,141,141,141, 34,336,336, 33,378, 0,336, 28,345,222,141,141,141, 33,336, 33,390,396, 0,482, 0,492, 0,20007, 33,20007, 34,20007, 27,141,482,141, 0,141, 28, 33,345, 0,336, 34,345, 0,340,376, 0,336, 32,378, 32,20056],
[152,492,152,482, 0,152,152,152,152,152,152, 0,502,152,152,152, 0,152,152, 0,482, 29, 0,152,152,381,336, 27,492, 27,272, 28,498, 33,336,502,141,141,141,235, 0, 34,403,492, 0,254, 33,336, 0, 27, 0,492, 34,502, 34,141, 0,371, 0,141, 0,378,211,333, 0,503,336,336,502, 0, 28, 32,498,141, 0,376,482,498,129, 0,375, 34,403, 0,336, 28,345, 0, 33,141,141,503, 33,503,403,403, 0,336,378,482,499,20007,378,20007,381,20007,381,378, 0,141, 34,141,345,381, 0,499,336, 0,345, 32,340,492,222,336,492,336,222, 0],
[152,482,152,152,235,152, 29, 34,152, 33, 0, 21,152,152,272, 0,502,482,502, 28, 0,235,152,152,152,336,336, 0,345,345, 33,345,336, 28,336, 0, 0,502, 0, 32,141,141, 0,141, 33,141, 0,381,211, 33,141,141,502,333,502,141,141,141,141,141,336,482,336,336,371,482,376,492, 33,333,502,141,381,141,375,141,141, 0,345, 0, 0, 0, 0, 0, 0,375, 0,381,371,141,141,141,141, 21,336,403,371, 0,20007,492,20007,20007, 33,20007,378,20007,141,141,141,141,378,141,345,345,492, 0, 27,503,345,345,340, 0, 0,336, 0,336, 34,336],
[152, 0, 28, 21, 0,492, 34,502, 0, 0, 27,212, 0, 0, 33, 29,152,152,152,492,152, 0, 33, 0, 85, 0,487,254, 0,340,381,340,502, 0, 0,381,333,141,141,503,141,141,498, 0, 28,141,498,492,336, 0, 28,381, 34,502, 34,141,381, 28,376, 0,503,381,492,403,403,381,482,336, 27,333, 0, 32, 0,141, 0, 32,141, 27, 33,371,345, 0,333,336,336,482,336,336, 33, 27,378,381, 33,207,403,482,340,351, 34,381,378, 34,503,20007,381,20007, 0, 0, 34,376,272,381, 33, 0, 0,371,492, 34,403, 0, 0,492, 0,381, 32,336,403, 94],

View File

@ -56,7 +56,7 @@ main.floors.MT17=
"12,6": [
{
"type": "function",
"function": "function(){\nif (core.status.hero.hp - flags.hphphp >= 150000) {\n\tcore.completeAchievement('normal', 1);\n\tdelete flags.hphphp;\n}\n}"
"function": "function(){\nif (core.status.hero.hp - flags.hphphp >= 150000) {\n\tcore.completeAchievement('normal', 1);\n}\ndelete flags.hphphp;\n}"
}
]
},

View File

@ -34,7 +34,7 @@ main.floors.MT36=
"从本区域开始将会出现各种光环怪,这需要你认真思考解决办法",
"注意坚固怪受到光环加成后可能无法被打败,因为会首先计算坚固属性再计算光环",
"本区域的地图较为复杂,请善用楼传的小地图功能",
"本区域不能使用跳跃技能"
"由于本区域的跳跃技能表现很奇怪,因此本区域不能使用跳跃技能"
]
},
"changeFloor": {

View File

@ -70,6 +70,10 @@ main.floors.MT41=
"那我就送你回到标题界面吧!",
{
"type": "restart"
},
{
"type": "function",
"function": "function(){\ncore.completeAchievement('explore', 3);\n}"
}
]
},
@ -108,7 +112,7 @@ main.floors.MT41=
[ 0, 0, 0, 0, 0, 0, 0, 0, 0,381, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0,603,336, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 17, 0, 0, 0, 34, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,381, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 91, 0, 0, 0, 0,381, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0,617, 0, 0, 0,336,602, 0, 0, 0, 0],
[ 0, 0,129, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0,540, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

View File

@ -34,26 +34,64 @@ main.floors.MT47=
}
},
"beforeBattle": {},
"afterBattle": {},
"afterBattle": {
"6,3": [
{
"type": "setValue",
"name": "flag:door_MT47_7_3",
"operator": "+=",
"value": "1"
}
],
"8,3": [
{
"type": "setValue",
"name": "flag:door_MT47_7_3",
"operator": "+=",
"value": "1"
}
]
},
"afterGetItem": {},
"afterOpenDoor": {},
"autoEvent": {},
"autoEvent": {
"7,3": {
"0": {
"condition": "flag:door_MT47_7_3==2",
"currentFloor": true,
"priority": 0,
"delayExecute": false,
"multiExecute": false,
"data": [
{
"type": "openDoor"
},
{
"type": "setValue",
"name": "flag:door_MT47_7_3",
"operator": "=",
"value": "null"
}
]
}
}
},
"cannotMove": {},
"cannotMoveIn": {},
"map": [
[ 0, 0,70030, 0, 0, 0,604, 91,604,70029,70029,70029,70029, 0, 0],
[ 0, 0,70030, 0,70031, 0,604, 0,604, 0, 0, 0,70028,70030,70030],
[70030,70030,70030,70031,70031,70031, 0,608, 0,70028,70028,70028,70028, 0, 0],
[ 0, 0, 0,70031, 0, 0, 0,604, 0, 0, 0, 0,70029,70029,70029],
[70031, 0, 0, 0, 0, 0, 0,604, 0, 0,604, 0, 0, 0,604],
[70031,586,586,586,586,586, 0, 0, 0, 0,604, 0,604, 0,604],
[70031, 0, 0, 0, 0,586, 0,604, 0, 0, 0, 0,604, 0,604],
[70031, 0, 0,585, 0, 0, 0,604, 0,587,587,587,587,587,587],
[ 0,585,585,585, 0,586,586,586, 0,587,587, 0, 0, 0,587],
[ 0, 0, 0, 0, 0, 0, 0,586, 0, 0, 0, 0,587, 0,587],
[ 0, 0, 0,584,584, 0,584,584,584, 0,584, 0,585,585,585],
[70030,70030,70030,70031,70031,70031,604,608,604,70028,70028,70028,70028, 0, 0],
[ 0, 0, 0,70031, 0, 0,611, 85,611, 0, 0, 0,70029,70029,70029],
[70031, 0, 0, 0, 0,613, 0, 0, 0, 0,604,643, 0, 0,604],
[70031,586,586,586,586,586,602,604,608,604,604, 0,604, 0,604],
[70031, 0, 0,494, 32,586, 0,604, 0,602, 0, 0,604, 0,604],
[70031, 0, 0,585,592, 0, 0,604, 0,587,587,587,587,587,587],
[ 0,617,585,585,492,586,586,586, 0,587,587, 0,492,482,587],
[ 0, 0,611, 0, 0, 0, 0,492, 0, 0,602, 0,587,482,587],
[ 0,643,584,584,584,614,584,584,584,600,584,608,585,585,585],
[70029, 0, 0, 0,584, 0, 0,584, 0, 0,584, 0, 0, 0,585],
[70029, 0, 0, 0,584, 0, 0, 0, 0, 0,584, 0, 0, 0,585],
[70029, 0, 0, 0,584, 0, 0,643, 0, 0,584, 0, 0, 0,585],
[70029,584,584,584,584,584,584, 0,584,584,584,584,584,584,584],
[70029, 0, 0, 0, 0, 0, 0, 93, 0, 0, 0, 0, 0, 0, 0]
],

View File

@ -34,8 +34,8 @@ main.floors.tower5=
[527,527,527,527,527,527,527,527,527,527,527,527,527,527,527],
[527,376, 0,381,528, 0,378,528, 0, 27, 28, 0,528, 0,527],
[527, 0, 32,279, 0,381, 0,546, 0,528, 0, 32,547, 0,527],
[527,528,528, 0,528,528,492,528,528,528,492,528,528, 28,527],
[527, 0,492,381,528, 0,376,528, 87,528,376, 32,528, 27,527],
[527,528,528, 0,528,528,492,528,527,528,492,528,528, 28,527],
[527, 0,492,381,528, 0,376,527, 87,527,376, 32,528, 27,527],
[527,376,528, 27,556, 32, 0,528,516,528, 32,378,492, 32,527],
[527, 32,556, 28,528,550,528,528, 0,528,528,279,528,528,527],
[527, 0,528, 32,528, 0, 0, 0, 0,536, 0, 27, 32, 0,542],

View File

@ -926,57 +926,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
// 勇士位置应该在这里进行计算,四个位置依次遍历,去重
let toMap = [];
if (
core.has(x) &&
core.has(y) &&
!(core.has(hero?.x) && core.has(hero?.y)) &&
core.has(floorId) &&
flags.autoLocate &&
flags.chapter >= 2
) {
const floor = core.status.maps[floorId];
// 存在坐标,进行遍历
for (const [dir, { x: dx, y: dy }] of Object.entries(
core.utils.scan
)) {
// 只有攻击和防御和特殊光环需要注意,其他的都不会随楼层与坐标变化
const nx = x + dx;
const ny = y + dy;
if (
nx < 0 ||
nx >= floor.width ||
ny < 0 ||
ny >= floor.height
) {
continue;
}
if (
core.noPass(nx, ny) ||
!core.canMoveHero(nx, ny, backDir(dir), floorId)
) {
continue;
}
const toGet = ['atk', 'def'];
const status = core.plugin.hero.getHeroStatusOf(
hero,
toGet,
nx,
ny,
floorId
);
if (
toMap.some(v =>
toGet.every(vv => v[1][vv] === status[vv])
)
) {
continue;
}
toMap.push(dir);
}
} else {
// 指定了勇士坐标或者没有怪物坐标时
toMap = ['none'];
}
// 指定了勇士坐标或者没有怪物坐标时
toMap = ['none'];
function getDamage(h) {
const enemyInfo = core.getEnemyInfo(enemy, hero, x, y, floorId);

View File

@ -140,6 +140,7 @@ const skills = {
index: 11,
title: '学习',
desc: [
'<span style="color: lightcoral">当前版本此技能无效!</span>',
'<span style="color: gold">主动技能</span>可以消耗500智慧学习一个怪物的技能',
'持续5场战斗每学习一次消耗的智慧点增加250每次升级使持续的战斗次数增加3次。更多信息可在学习后在百科全书查看。'
],

View File

@ -59,6 +59,14 @@
"percent": true,
"point": 50
},
{
"name": "源头?",
"text": [
"在冰封雪原第一个山洞的水源处使用跳跃技能,并向前一步触发剧情"
],
"hide": "该探索成就需要你自己探索如何达成",
"point": 30
},
{
"name": "学坏了",
"text": [

View File

@ -165,14 +165,10 @@ type SoundIds =
type BgmIds =
| 'beforeBoss.mp3'
| 'beforeNight.mp3'
| 'cave.mp3'
| 'escape.mp3'
| 'grass.mp3'
| 'mount.mp3'
| 'night.mp3'
| 'palaceNorth.mp3'
| 'palaceSouth.mp3'
| 'plot1.mp3'
| 'road.mp3'
| 'title.mp3'

2
src/types/ui.d.ts vendored
View File

@ -592,7 +592,7 @@ interface Ui {
*/
drawIcon(
name: CtxRefer,
id: AllIds | 'hero',
id: AllIds,
x: number,
y: number,
w?: number,

View File

@ -290,6 +290,8 @@ function openStudy() {}
#status-spring {
line-height: 0;
color: rgb(167, 255, 167);
top: 0;
font-size: 1.4vw;
}
#status-key {