mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-05-10 18:43:24 +08:00
fix: 浏览地图怪物手册 & ui
This commit is contained in:
parent
6b4833ef4d
commit
d9daac54d3
@ -4497,24 +4497,31 @@ events.prototype._checkLvUp_check = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
////// 尝试使用道具 //////
|
////// 尝试使用道具 //////
|
||||||
events.prototype.tryUseItem = function (itemId) {
|
events.prototype.tryUseItem = function (itemId, noRoute, callback) {
|
||||||
if (itemId == 'book') {
|
if (itemId == 'book') {
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
return core.openBook(false);
|
core.openBook(false);
|
||||||
|
callback();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (itemId == 'fly') {
|
if (itemId == 'fly') {
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
return core.useFly(false);
|
core.useFly(false);
|
||||||
|
callback();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (itemId == 'centerFly') {
|
if (itemId == 'centerFly') {
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
return core.ui._drawCenterFly();
|
core.ui._drawCenterFly();
|
||||||
|
callback();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (core.canUseItem(itemId)) {
|
if (core.canUseItem(itemId)) {
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
core.useItem(itemId);
|
core.useItem(itemId, noRoute, callback);
|
||||||
} else {
|
} else {
|
||||||
core.playSound('操作失败');
|
core.playSound('操作失败');
|
||||||
core.drawTip('当前无法使用' + core.material.items[itemId].name, itemId);
|
core.drawTip('当前无法使用' + core.material.items[itemId].name, itemId);
|
||||||
}
|
}
|
||||||
|
callback();
|
||||||
};
|
};
|
||||||
|
@ -561,6 +561,13 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
|
|||||||
// 判定能否瞬移到该点
|
// 判定能否瞬移到该点
|
||||||
if (ignoreSteps == null) ignoreSteps = core.canMoveDirectly(x, y);
|
if (ignoreSteps == null) ignoreSteps = core.canMoveDirectly(x, y);
|
||||||
if (ignoreSteps >= 0) {
|
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');
|
core.clearMap('hero');
|
||||||
// 获得勇士最后的朝向
|
// 获得勇士最后的朝向
|
||||||
var lastDirection =
|
var lastDirection =
|
||||||
|
@ -214,7 +214,7 @@ onMounted(() => {
|
|||||||
const style = getComputedStyle(div);
|
const style = getComputedStyle(div);
|
||||||
|
|
||||||
const width = parseFloat(style.width);
|
const width = parseFloat(style.width);
|
||||||
const height = window.innerHeight / 5;
|
const height = isMobile ? window.innerHeight / 7 : window.innerHeight / 5;
|
||||||
const c = critical.value!;
|
const c = critical.value!;
|
||||||
const d = def.value!;
|
const d = def.value!;
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ export function init() {
|
|||||||
damageCanvas = '__damage_' + x + '_' + y;
|
damageCanvas = '__damage_' + x + '_' + y;
|
||||||
const ctx = core.createCanvas(damageCanvas, 0, 0, 32, 32, 65);
|
const ctx = core.createCanvas(damageCanvas, 0, 0, 32, 32, 65);
|
||||||
ctx.textAlign = 'left';
|
ctx.textAlign = 'left';
|
||||||
ctx.font = '14px normal';
|
ctx.font = 'bold 11px Arial';
|
||||||
core.fillBoldText(ctx, damage, 1, 31, color as string);
|
core.fillBoldText(ctx, damage, 1, 31, color as string);
|
||||||
if (core.flags.displayCritical) {
|
if (core.flags.displayCritical) {
|
||||||
const critical = enemy.calCritical(1);
|
const critical = enemy.calCritical(1);
|
||||||
|
6
src/types/event.d.ts
vendored
6
src/types/event.d.ts
vendored
@ -760,7 +760,11 @@ interface Events extends EventData {
|
|||||||
* @example core.tryUseItem('pickaxe'); // 尝试使用破墙镐
|
* @example core.tryUseItem('pickaxe'); // 尝试使用破墙镐
|
||||||
* @param itemId 道具id,其中敌人手册、传送器和飞行器会被特殊处理
|
* @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;
|
_sys_battle(data: Block, callback?: () => void): void;
|
||||||
|
|
||||||
|
@ -60,6 +60,8 @@ const floorId =
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
core.floorIds[core.status.event?.ui?.index] ?? core.status.floorId;
|
core.floorIds[core.status.event?.ui?.index] ?? core.status.floorId;
|
||||||
|
|
||||||
|
console.log(floorId);
|
||||||
|
|
||||||
const enemy = core.getCurrentEnemys(floorId);
|
const enemy = core.getCurrentEnemys(floorId);
|
||||||
const toShow: ToShowEnemy[] = enemy.map(v =>
|
const toShow: ToShowEnemy[] = enemy.map(v =>
|
||||||
getDetailedEnemy(v.enemy, floorId)
|
getDetailedEnemy(v.enemy, floorId)
|
||||||
@ -121,11 +123,13 @@ async function exit() {
|
|||||||
const hold = mainUi.holdOn();
|
const hold = mainUi.holdOn();
|
||||||
mainUi.close(props.num);
|
mainUi.close(props.num);
|
||||||
if (core.events.recoverEvents(core.status.event.interval)) {
|
if (core.events.recoverEvents(core.status.event.interval)) {
|
||||||
|
hold.end(true);
|
||||||
return;
|
return;
|
||||||
} else if (has(core.status.event.ui)) {
|
} else if (has(core.status.event.ui)) {
|
||||||
core.status.boxAnimateObjs = [];
|
core.status.boxAnimateObjs = [];
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
core.ui._drawViewMaps(core.status.event.ui);
|
core.ui._drawViewMaps(core.status.event.ui);
|
||||||
|
hold.end(true);
|
||||||
} else hold.end();
|
} else hold.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,6 +145,7 @@ function checkScroll() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 按键控制
|
// 按键控制
|
||||||
|
setTimeout(() => {
|
||||||
gameKey.use(props.ui.symbol);
|
gameKey.use(props.ui.symbol);
|
||||||
gameKey
|
gameKey
|
||||||
.realize('@book_up', () => {
|
.realize('@book_up', () => {
|
||||||
@ -177,6 +182,7 @@ gameKey
|
|||||||
.realize('confirm', () => {
|
.realize('confirm', () => {
|
||||||
select(toShow[selected.value], selected.value);
|
select(toShow[selected.value], selected.value);
|
||||||
});
|
});
|
||||||
|
}, 0);
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
gameKey.dispose(props.ui.symbol);
|
gameKey.dispose(props.ui.symbol);
|
||||||
|
@ -219,7 +219,7 @@ onUnmounted(() => {
|
|||||||
font-size: 4vw;
|
font-size: 4vw;
|
||||||
bottom: 5%;
|
bottom: 5%;
|
||||||
left: 5vw;
|
left: 5vw;
|
||||||
width: 90vw;
|
width: 80vw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -182,7 +182,7 @@ function use(id: ShowItemIds) {
|
|||||||
const hold = mainUi.holdOn();
|
const hold = mainUi.holdOn();
|
||||||
exit();
|
exit();
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
core.useItem(id, false, () => {
|
core.tryUseItem(id, false, () => {
|
||||||
if (mainUi.stack.length === 0) {
|
if (mainUi.stack.length === 0) {
|
||||||
hold.end(core.status.event.id !== 'toolbox');
|
hold.end(core.status.event.id !== 'toolbox');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user