fix: bugs

This commit is contained in:
unanmed 2024-03-02 00:00:41 +08:00
parent d7544b98c8
commit 314cf0626c
14 changed files with 48 additions and 36 deletions

View File

@ -8,4 +8,5 @@ public/project/maps.js
public/_server/**/*.js
script/**/*.js
public/editor.html
keyCodes.ts
keyCodes.ts
*.md

View File

@ -9,6 +9,5 @@
"vueIndentScriptAndStyle": false,
"arrowParens": "avoid",
"trailingComma": "none",
"endOfLine": "auto",
"embeddedLanguageFormatting": "off"
"endOfLine": "auto"
}

View File

@ -174,6 +174,7 @@ events.prototype._gameOver_confirmUpload = function (ending, norank) {
core.ui.drawConfirmBox(
'你想记录你的ID和成绩吗',
function () {
console.log(2);
if (main.isCompetition) {
core.events._gameOver_doUpload('', ending, norank);
} else {
@ -191,6 +192,7 @@ events.prototype._gameOver_confirmUpload = function (ending, norank) {
}
},
function () {
console.log(1);
if (main.isCompetition)
core.events._gameOver_confirmDownload(ending);
else core.events._gameOver_doUpload(null, ending, norank);
@ -627,7 +629,7 @@ events.prototype._openDoor_animate = function (block, x, y, callback) {
core.maps._removeBlockFromMap(core.status.floorId, block);
if (!locked) core.unlockControl();
core.status.replay.animate = false;
Mota.require('var', 'hook').emit('afterOpenDoor', block.event.id, x, y);
core.events.afterOpenDoor(block.event.id, x, y);
if (callback) callback();
};
@ -707,7 +709,7 @@ events.prototype.getItem = function (id, num, x, y, isGentleClick, callback) {
itemHint.push(id);
}
Mota.require('var', 'hook').emit('afterGetItem', id, x, y, isGentleClick);
this.afterGetItem(id, x, y, isGentleClick);
if (callback) callback();
};

View File

@ -918,9 +918,7 @@ ui.prototype.closePanel = function () {
this.clearUI();
core.maps.generateGroundPattern();
core.updateStatusBar(true);
setTimeout(() => {
core.unlockControl();
}, 0);
core.unlockControl();
core.status.event.data = null;
core.status.event.id = null;
core.status.event.selection = null;

View File

@ -96,6 +96,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
core.drawText(
['\t[' + (reason || '结局1') + ']你死了。\n如题。'],
function () {
console.log(core.status.lockControl);
core.events.gameOver(null, replaying);
}
);
@ -241,7 +242,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
return true;
},
afterGetItem: function () {
afterGetItem: function (itemId, x, y, isGentleClick) {
// 获得一个道具后触发的事件
// itemId获得的道具IDx和y是该道具所在的坐标
// isGentleClick是否是轻按触发的
@ -272,7 +273,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
if (todo.length > 0) core.insertAction(todo, x, y);
},
afterOpenDoor: function () {
afterOpenDoor: function (x, y) {
// 开一个门后触发的事件
const todo = [];
// 检查该点的获得开门后事件。

View File

@ -89,8 +89,6 @@ watch(width, n => emits('update:width', n));
watch(height, n => emits('update:height', n));
async function click() {
console.log(1);
moveSelected.value = true;
moveTimeout = window.setTimeout(() => {
moveSelected.value = false;

View File

@ -161,7 +161,7 @@ interface IndexedGameUi extends ShowableGameUi {
}
interface HoldOnController {
end(): void;
end(noClosePanel?: boolean): void;
}
export class UiController extends Focus<IndexedGameUi> {
@ -180,7 +180,7 @@ export class UiController extends Focus<IndexedGameUi> {
v.ui.emit('close');
});
if (this.stack.length === 0) {
if (!this.hold) this.emit('end');
if (!this.hold) this.emit('end', false);
this.hold = false;
}
});
@ -225,8 +225,8 @@ export class UiController extends Focus<IndexedGameUi> {
this.hold = true;
return {
end: () => {
this.emit('end');
end: (noClosePanel: boolean = false) => {
this.emit('end', noClosePanel);
}
};
}

View File

@ -41,11 +41,13 @@ hook.once('mounted', () => {
ui.style.display = 'flex';
core.lockControl();
});
mainUi.on('end', () => {
mainUi.on('end', noClosePanel => {
ui.style.display = 'none';
try {
core.closePanel();
} catch {}
if (!noClosePanel) {
try {
core.closePanel();
} catch {}
}
});
fixedUi.on('start', () => {
fixed.style.display = 'block';

View File

@ -53,13 +53,16 @@ function _convertShop(shop: any) {
// 检测能否访问该商店
{
type: 'if',
condition: "core.isShopVisited('" + shop.id + "')",
condition:
"Mota.Plugin.require('shop_g').isShopVisited('" +
shop.id +
"')",
true: [
// 可以访问,直接插入执行效果
{
type: 'function',
function:
"function() { core.plugin._convertShop_replaceChoices('" +
"function() { Mota.Plugin.require('shop_g')._convertShop_replaceChoices('" +
shop.id +
"', false) }"
}
@ -84,7 +87,7 @@ function _convertShop(shop: any) {
{
type: 'function',
function:
"function() { core.plugin._convertShop_replaceChoices('" +
"function() { Mota.Plugin.require('shop_g')._convertShop_replaceChoices('" +
shop.id +
"', true) }"
}
@ -101,7 +104,10 @@ function _convertShop(shop: any) {
];
}
function _convertShop_replaceChoices(shopId: string, previewMode: boolean) {
export function _convertShop_replaceChoices(
shopId: string,
previewMode: boolean
) {
var shop = core.status.shops[shopId] as any;
var choices = (shop.choices || [])
.filter(function (choice: any) {

View File

@ -23,7 +23,8 @@ export function getAddStatus(equip: Equip) {
{keys.map(v => {
const value = Math.floor(
(equip.value[v] ?? 0) * core.getBuff(v) +
(core.status.hero[v] * (equip.percentage[v] ?? 0)) / 100
(core.status.hero[v] * (equip.percentage?.[v] ?? 0)) /
100
);
return (
@ -71,12 +72,12 @@ export function getNowStatus(nowEquip?: Equip, onCol: boolean = false) {
let add = 0;
if (has(nowEquip)) {
add += Math.floor(
(nowEquip.value[v] ?? 0) * core.getBuff(v)
(nowEquip.value?.[v] ?? 0) * core.getBuff(v)
);
const per = Math.floor(
(nowEquip.percentage[v] * core.getStatus(v)) / 100
);
add += isNaN(per) ? 0 : per;
// const per = Math.floor(
// (nowEquip.percentage?.[v] * getHeroStatusOn(v)) / 100
// );
// add += isNaN(per) ? 0 : per;
}
if (onCol) add = -add;

View File

@ -312,10 +312,10 @@ export function getStatusLabel(name: string) {
hpmax: '生命回复',
hp: '生命',
manamax: '魔力上限',
mana: '额外攻击',
mana: '魔力',
atk: '攻击',
def: '防御',
mdef: '智慧',
mdef: '护盾',
money: '金币',
exp: '经验',
point: '加点',

View File

@ -56,7 +56,7 @@
:type="isMobile ? 'horizontal' : 'vertical'"
></a-divider>
<div id="fly-right">
<canvas id="fly-thumbnail" @click="fly"></canvas>
<canvas id="fly-thumbnail" @click="fly" @wheel="wheel"></canvas>
<div id="fly-tools">
<double-left-outlined
@click="changeFloorByDelta(-10)"
@ -472,6 +472,10 @@ function click(e: MouseEvent) {
}
}
function wheel(ev: WheelEvent) {
changeFloorByDelta(-Math.sign(ev.deltaY));
}
function changeAreaByFloor(id: FloorIds) {
nowArea.value = Object.keys(area).find(v => area[v].includes(id))!;
}

View File

@ -184,7 +184,7 @@ function use(id: ShowItemIds) {
nextTick(() => {
core.useItem(id, false, () => {
if (mainUi.stack.length === 0) {
hold.end();
hold.end(core.status.event.id !== 'toolbox');
}
});
});

View File

@ -61,14 +61,14 @@ export default defineConfig({
target: FSHOST,
changeOrigin: true,
rewrite(path) {
return path.replace(/^\/all/, '');
return './' + path.replace(/^\/all/, '');
},
},
'^/forceTem/.*': {
target: FSHOST,
changeOrigin: true,
rewrite(path) {
return path.replace(/^\/forceTem/, '');
return './' + path.replace(/^\/forceTem/, '');
},
}
},