fix: 浏览地图怪物手册 & ui

This commit is contained in:
unanmed 2024-03-02 15:35:08 +08:00
parent 6b4833ef4d
commit d9daac54d3
8 changed files with 70 additions and 46 deletions

View File

@ -4497,24 +4497,31 @@ events.prototype._checkLvUp_check = function () {
};
////// 尝试使用道具 //////
events.prototype.tryUseItem = function (itemId) {
events.prototype.tryUseItem = function (itemId, noRoute, callback) {
if (itemId == 'book') {
core.ui.closePanel();
return core.openBook(false);
core.openBook(false);
callback();
return;
}
if (itemId == 'fly') {
core.ui.closePanel();
return core.useFly(false);
core.useFly(false);
callback();
return;
}
if (itemId == 'centerFly') {
core.ui.closePanel();
return core.ui._drawCenterFly();
core.ui._drawCenterFly();
callback();
return;
}
if (core.canUseItem(itemId)) {
core.ui.closePanel();
core.useItem(itemId);
core.useItem(itemId, noRoute, callback);
} else {
core.playSound('操作失败');
core.drawTip('当前无法使用' + core.material.items[itemId].name, itemId);
}
callback();
};

View File

@ -561,6 +561,13 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
// 判定能否瞬移到该点
if (ignoreSteps == null) ignoreSteps = core.canMoveDirectly(x, y);
if (ignoreSteps >= 0) {
// 中毒也允许瞬移
if (core.hasFlag('poison')) {
var damage = ignoreSteps * core.values.poisonDamage;
if (damage >= core.status.hero.hp) return false;
core.status.hero.statistics.poisonDamage += damage;
core.status.hero.hp -= damage;
}
core.clearMap('hero');
// 获得勇士最后的朝向
var lastDirection =

View File

@ -214,7 +214,7 @@ onMounted(() => {
const style = getComputedStyle(div);
const width = parseFloat(style.width);
const height = window.innerHeight / 5;
const height = isMobile ? window.innerHeight / 7 : window.innerHeight / 5;
const c = critical.value!;
const d = def.value!;

View File

@ -46,7 +46,7 @@ export function init() {
damageCanvas = '__damage_' + x + '_' + y;
const ctx = core.createCanvas(damageCanvas, 0, 0, 32, 32, 65);
ctx.textAlign = 'left';
ctx.font = '14px normal';
ctx.font = 'bold 11px Arial';
core.fillBoldText(ctx, damage, 1, 31, color as string);
if (core.flags.displayCritical) {
const critical = enemy.calCritical(1);

View File

@ -760,7 +760,11 @@ interface Events extends EventData {
* @example core.tryUseItem('pickaxe'); // 尝试使用破墙镐
* @param itemId id
*/
tryUseItem(itemId: ItemIdOf<'tools' | 'constants'>): void;
tryUseItem(
itemId: ItemIdOf<'tools' | 'constants'>,
noRoute?: boolean,
callback?: () => void
): void;
_sys_battle(data: Block, callback?: () => void): void;

View File

@ -60,6 +60,8 @@ const floorId =
// @ts-ignore
core.floorIds[core.status.event?.ui?.index] ?? core.status.floorId;
console.log(floorId);
const enemy = core.getCurrentEnemys(floorId);
const toShow: ToShowEnemy[] = enemy.map(v =>
getDetailedEnemy(v.enemy, floorId)
@ -121,11 +123,13 @@ async function exit() {
const hold = mainUi.holdOn();
mainUi.close(props.num);
if (core.events.recoverEvents(core.status.event.interval)) {
hold.end(true);
return;
} else if (has(core.status.event.ui)) {
core.status.boxAnimateObjs = [];
// @ts-ignore
core.ui._drawViewMaps(core.status.event.ui);
hold.end(true);
} else hold.end();
}
@ -141,6 +145,7 @@ function checkScroll() {
}
//
setTimeout(() => {
gameKey.use(props.ui.symbol);
gameKey
.realize('@book_up', () => {
@ -177,6 +182,7 @@ gameKey
.realize('confirm', () => {
select(toShow[selected.value], selected.value);
});
}, 0);
onUnmounted(() => {
gameKey.dispose(props.ui.symbol);

View File

@ -219,7 +219,7 @@ onUnmounted(() => {
font-size: 4vw;
bottom: 5%;
left: 5vw;
width: 90vw;
width: 80vw;
}
}
</style>

View File

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